W1 Flashcards
Relative costs of development vs maintenance?
Maintaining and managing software and its evolution represents more than 90% of the total cost of software
What is a monolithic program?
- a software application or system designed and implemented as a single, indivisible unit
- all components and features of the program tightly integrated and interdependent, typically residing within a single codebase and executable file
- linked to the imperative core of Java, consisting of types, values, variables, expressions, assignment, selection, repetition, and allows the expression of every computation
What is a quantified expression? What are quantifiers?
an expression that involves quantifiers
logical constructs that indicate the extent of the variables in a logical statement
Describe all quantifiers and how they are denoted:
\forall\exists\sum\product\max\min\num_of
What is a procedure in java?
a method or a function
a way of wrapping up solutions
Methods vs Functions
Methods have return type void and are used as statements, whilst functions have return type non-void and are used as expressions.
Statement
Executable units of code that perform actions and do not have a return type
Expression
combinations of values, variables, operators, and function calls that evaluate to a single value, and thus have a return type
What are parameters? What are arguments?
Parameters are variables in a function or method definition that represent the input values the function expects.Arguments are the actual values or expressions passed to a function or method when it is called, filling in the parameters.
What is aliasing?
the situation where two or more variables refer to the same object or memory location, allowing changes through one variable to be reflected in the other
Local vs global variables?
Local variables are declared within a specific block and have limited scope, while global variables, in the context of Java, typically refer to class-level variables accessible throughout the class.
Steps in Divide,Conquer and Rule
- Split the problem into subproblems that are each to be solved by a given method (Divide)2. Solve subproblems independently (Conquer).3. Combine subproblem solutions into a total solution (Rule).
Format of a Method Contract:
@param param_name description_of_param
@return what_function_returns
@pre {@code … precondition}
@modifies name_of_modified_var
@post {@code … postcondition}
@throws some_exception if condition
\old(v) refers to the value of var v at the start of function
\return or \result refers to the value returned by the function
Purposes of a contract
- clearly delineate modules
- acts as an interface between user and provider of solution
- specifies which problem is solved by pre and post condition
- relates invocation and implementation to contract, but not each other directly, as this leads to complexity and errors
Are the preconditions and postconditions concerns or benefits for the users and providers of the solution?
Preconditions are a concern for the users, whilst they are a benefit for the provider.Moreover, postconditions are a benefit for the user, and a concern for the provider.