4. Software Analysis Flashcards
What is the relation of abstraction and analysis?
Abstraction is the idea of mentally separating one or more elements from a complex totality.
Analysis is the act of simplifying these complex concepts into more understandable information, possibly with a diagram.
What are the problems of modeling a concept as a ‘Free-Text Attribute’?
Pros: \+ Simplicity Cons: - Susceptible to user typos and inconsistencies - Harms data aggregation
What are the problems of ‘Hard-Coded Values’?
Pros:
+ Avoid user typos – good for reports!
Cons:
- Less flexible -> the user cannot create new categories
- Susceptible to programmer typos if the value appears in several places
(Should only be used if the value will never change)
When is it better to model something as an enumeration instead of an associated class?
+ When you desire less typos and option-specific operations.
+ When you have automated deployment.
+ When you have easy access to your development team.
When is it better to model something as an inheritance instead of an associated class?
An associated class is used when you want to give the user the control to add options or change certain things.
It is better to use inheritance when everything that you want is predefined; the developer simply decides where to place a category in the inheritance tree.
When is it better to model something as an associated inheritance instead of an inheritance?
Associated inheritance would give the user the ability to add a child class that did not already exist, which is good if the developers wanted to give users more control.
In the event that the developers did not want the user to have much control, one would use “basic” inheritance.
Explain why an analysis can represent concepts either ‘as data’ or ‘source code elements’. Give an example.
As Data:
+ Possible values can be managed by the user (more flexibile)
As Source Code Elements:
+ Need to change the implementation every time the possible values change (recompile and redeploy)
Compare ‘Source Code Elements’ and ‘Data’ representations of concepts.
Say a system has different types of accounts.
Making the account type an attribute of the account is a data representation as the type can easily be changed by a simple setter method. Creating a new account type is just as easy.
If the account types are represented as their own sub-classes of a general Account class, this is a source code element representation. In order to add a new account type, a new subclass needs to be created. This requires the system to be recompiled with this new class now included. In order to change the account type in this representation, the account must be recreated, transferring the attributes of the old class to the new one.
Give an example of a model that contains unnecessary redundancy.
Imagine completely interconnecting the following structures: Course, Section, Professor, Student. Redundant connections can be taken out and the model will still makes sense.
Students are associated with many sections that contain a course. Students are are also in many courses. This is redundant, we could take out the Student class' many-to-many association with the Course class and this would still make sense. The same goes for the professor class, if the professor has many sections he teaches, this implies that each section has a course. So we can erase both connections to the course. and route both classes through the Section class for the same effect.
When are user actions represented in a class diagram?
+ Whenever the user has some sort of interaction with the elements of the system.
+ Usually denoted by a name of the action over the link between the user and the system element.
How can you change a 1 to many association to register the history of this association? Give an example.
You can make the associated connection many to many (—–) for a simple solution.
Example:
[Passenger]——-1[Bus] =>
[Passenger]——-*[Bus]
Other ways to register history of associations: \+ Add a data attribute to “Client” containing an array of client's previous addresses \+ Associate the client class with an address class (make associated connection one to many (1--------*))
When is it worth it to store the value of a derived property in a database?
+ Storing derived data is faster reading
+ There is no calculation and values are simply accessed.
+ Stored derived data simplifies database queries; this is important for complex analytical queries.
What is a ‘Derived Property’?
A property which values are produced or computed from other information, for example, by using values of other properties.