Week 2 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 monoloithic program?
Software architecture where all components of an application are tightly integrated into a single codebase, making it a unified and indivsible unit.Tightly 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 quantifierslogical 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 ways 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.
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.
Test-driven development (TDD)
software development approach where tests are written before the actual code, guiding the development process by ensuring that the code meets the specified requirements and functions correctly
Steps in TDD
- Gather and analyse the requirements to realise.2. Decide which requirement to develop next and what class and method it concerns.3. Specify the module informally in source code, using natural language.4. Specify the module formally, by providing its interface and contract.5. Design and implement a test case; document their motivation in the source code.6. Design and implement module features intended to make the test case pass.7. Test the new module implementation and fix any defects found.8. Where relevant, improve the structure of the code, preserving correcntess by running all test cases again.9. Repeat from step 5, until the entire module has been implemented and tested.10. If, after delivery, a defect is reported for the module in vivo, then first add a test case to defect that defect in vitro and only then repair the defect.