Module 3
Given the following brief description of requirements: The banking system supports a variety of accounts, for example a checking account. Each customer has at least one checking account that allows the customer to pay bills within the existing credit limit. Preferred customers enjoy unlimited credit for their accounts. The designer decides to have an account class and a checking account class. What is the relationship between the account class and the checking account class?
inheritance
What is the difference between the state and strategy pattern?
intentions are different
Select the best completion for the following sentence: When it comes to code-level documentation, the main contributor ...
is not comments, it is good programming style
Choose the pattern that matches the following description: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
iterator
The key concept in software design is to ...
minimize complexity
Choose the pattern that matches the following description: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
observer
The first "C" in CRC cards stands for...
Classes
Pick the most appropriate completion for a statement to describe what UML class diagrams visualize. UML class diagrams show ...
Classes and their relationships
The last "C" in CRC cards stands for
Collaborators
Which type of comments is the most valuable?
Comments that tell me the purpose for some code, that tell what the code should do.
The Manifesto for Agile Software Development values certain items more than others. From the following list of 8 items select the 4 that matter most for Agile Software Development. Customer collaboration Working software Individuals and interactions Contract negotiation Comprehensive documentation Processes and tools Following a plan Responding to change
Customer collaboration Working software Individuals and interactions Responding to change
Choose the pattern that matches the following description: Attach additional responsibilities to an object dynamically. Provide a flexible alternative to sub-classing for extending functionality.
Decorator
When it comes to inheritance in Java, which of the following statements are correct?
- A superclass need not be complete. The class and its missing methods can be declared as abstract. This concept is known as "abstract classes". - In Java, inheritance always results in a hierarchy that takes the form of a tree. The Object class is the root note (most general super class) and all other classes either directly or indirectly inherit from it. - Inheritance relies on Liskov's substitution principle to work. - Inheritance allows classes to share code based on an "is-a" relationship where the subclasses are special cases of a more general super class.
Which of the following documents may serve as a functional specification (the outcome of the analysis phase)?
- A text with a list of features - A text with a set of use cases
An object has an identity (thanks to its memory location), a state (thanks to its attributes and fields), and behavior (thanks to its methods). For encapsulation, which of these aspects should be kept secret/private?
- All attributes of an object should be kept secret/private. - Some methods should be freely accessible (public), others can be kept secret/private.
Mark principles for good software design
- Program to an interface - Encapsulate what varies - Favor composition over inheritance
UML sequence diagrams have a number of properties.
- Sequence diagrams allow for object construction (can represent "new Object()") - Sequence diagrams are good to show interactions among classes - Sequence diagrams allow for self calls - Sequence diagrams can naturally visualize steps that are ordered in a total order - Sequence diagrams are good to show which classes are involved in the execution of a use case
Identify the 3 phases of the Scrum method.
- Series of sprint cycles, each cycle develops an increment of the system - Outline planning phase that establishes general objectives and designs the overall software architecture - Closure phase wraps up and completes documentation.
What do you know about Extreme Programming?
- XP is an incremental software development process designed to cope with change. - With XP you never miss a deadline; you just deliver less content.
Under what circumstances would you consider using UML state diagrams?
- checking of a PIN number for authentication - drawing of a picture on the screen - operating a vending machine. - computing a generic BFS solution for a graph exploration scheme
describe the common workflow for test driven development.
1. Check out sources & tests from code base. 2. Create test suite or enlarge existing test suite for new product feature. 3. Implement functionality and make software pass tests. 4. Refactor software. 5. Perform regression testing. 6. Check-in software & tests into code base.
Given the following brief description of requirements: The banking system supports a variety of accounts, for example a checking account. Each customer has at least one checking account that allows the customer to pay bills within the existing credit limit. Preferred customers enjoy unlimited credit for their accounts. The designer decides to have a customer class and checking account class. What is the relationship between the customer class and the checking account class?
Aggregation
An object is instantiated with the help of the new() method. Example: House x = new House() ; Variable x is a reference to the new House object we instantiated. Where is the new House object located (where is the memory located that is needed for its representation)?
Always on the heap
Which statement describes Liskov's substitution principle?
It applies to inheritance: you can use a subclass object whenever a superclass object is expected.
The "R" in CRC cards stands for
Responsibilities
Which statement describes the open / closed principle?
Software entities should be open for extension, closed for modification.
Choose the pattern that matches the following description: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
State
Choose the pattern that matches the following description: Define a family of algorithms, encapsulate each one, and make them interchangeable. Let the algorithm vary independently from clients that use it.
Strategy
Use cases are often closely related to each other and share a lot of actions. From the following set of use cases, pick the one that would naturally become the base line. All others would the become variations of it: The customer selects "transfer funds into account" option, chooses an account to transfer the funds from, chooses an amount, confirms the transaction, the transaction starts, the funding source has sufficient funds, the transfer is performed and successfully completed. The account balance is updated. The customer selects "transfer funds into account" option, chooses an account to transfer the funds from, network communication timeout, connection closed, transaction is cancelled. The customer selects "transfer funds into account" option, chooses an account to transfer the funds from, chooses an amount, confirms the transaction, the transaction starts, the funding source has insufficient funds, the transfer is cancelled. The customer selects "transfer funds into account" option, chooses an account to transfer the funds from, chooses an amount, cancels the transaction.
The customer selects "transfer funds into account" option, chooses an account to transfer the funds from, chooses an amount, confirms the transaction, the transaction starts, the funding source has sufficient funds, the transfer is performed and successfully completed. The account balance is updated.
For the definition of the term "Use case", please pick the best completion from the following choices. A Use case is a sequence of actions. Each action is ...
an interaction between an actor and a computer system. Each action yields a result and each result has a value to one of the actors.