Guidelines when to include a description class into the domain
model
A description class contains information that describes
something
else like
• a product description records the price, picture and text of an
item
• a flight description contains information about the flight
(number) and the source and target destinations
Guidelines when to include a description class into the domain
model:
• A description class should be added to the domain model
when:
• There needs to be a description about an item or service,
independent of the current existence of any examples of those items
or services
• Deleting instances of things they describe results in a loss of
information that needs to be maintained, but was incorrectly
associated with the deleted thing.
• It reduces redundant or duplicated information When should I
model something as an attribute or a class?
Let’s assume that we develop an airline reservation system.
• Rule of Thumb:If we do not think of some conceptual class X as a
number or text
in the real world, X is probably a conceptual class, not an
attribute.
• Should destination be an attribute of flight, or a conceptual
class airport?
• A destination airport is a building at a specific place, it is
not just a number or some text.
• Hence, it should be a conceptual class.
• How about the name of the airport?
* flies from 1
Flight-------------------------------------------------------
Airport
* flies to 1
When should I add an association to the domain
model?
• Rule of Thumb:Include associations in the domain model for which
knowledge of the relationship needs to be preserved for some
duration.We are working on the conceptual model; we are not
modeling associations
at the software level.
: When should I add an association to the domain
model?33
• When an association is among the common associations list:
• A is a transaction related to another transaction B
• A is a line item of a transaction B
• A is a product or service for a transaction B
• A is a role related to a transaction B
• A is physical or logical part of B
: When should I add an association to the domain model?
• E.g. the relation between a Sale and a SalesLineItem needs to be
remembered
• However, it is not necessary to store the relation between a
Cashier and a Product Description that he looks up
: When should I add an association to the domain model?
• E.g. the relation between a Sale and a SalesnLineItem needs to be
remembered
• However, it is not necessary to store the relation between
a Cashier and a ProductDescription that he looks up Name an
association based on a ClassName-
VerbPhrase-ClassName format.
The verb phrase creates a sequence that is readable and
meaningful.
• Good examples:
• Player Is-on Square
• Sale Paid-by CashPayment
• Bad examples:
• Sale Uses CashPayment
(Uses is usually generic and doesn’t tell us anything.)
• Player Has Square
(Has is usually generic and doesn’t tell us anything.)
The attributes in a domain model should preferably be
“primitive” data types (w.r.t. the domain!).
• Very common data types include: Boolean, Date, Number, Character,
String, Address, Color, Phone
Number,…
• Consider modeling quantities as classes to be able to associate
units
e.g. the data type of the amount attribute of a payment should
indicate the currency
Consider defining a new data type class for something that is
initially considered a string.
• If the string is composed of separate sections
e.g., phone number, name of person,...
• If different operations are associated with the string
e.g., social security number
• If the string has other attributes.
• If the string is a quantity with a unit
e.g., money has a unit .
Object-Oriented Analysis: 7. Specify a guideline for when an abstraction should be modeled as a class and when it s...
JAVA -
Abstraction and Encapsulation are one pillar of OOP (Object
Oriented Programming). Another is inheritance and polymorphism. In
this assignment we will use inheritance and polymorphism to solve a
problem.
Part (a) of the figure below shows a symbolic representation of
an electric circuit called an amplifier. The input to the amplifier
is the voltage vi and the output is the voltage vo. The output of
an amplifier is proportional to the input. The constant of
proportionality is called...
KNOWING C++ CLASSES The below program either violates or misses 5 areas of object-oriented programming in C++ including: Data encapsulation. Accessibility. Separate class declaration and definition. The class is missing some important component even though they're not significant. In general we should explicitly specify class components instead of relying on compiler provided components. getters must not modify member data. Syntax error in main function. Identify the problems (6 of them, 3 pts each), explain the problems in short sentences and...
Question set 1 (Java) object oriented: 1.Write a class called Student. The class should be able to store information regarding the name, age, gpa, and phone number of a Student object. Please write all the setter and getter methods. Finally, write a Demo class to demonstrate the use of the class by creating two different objects. 2.Use the same Student class from the previous problem. This time,you will write a different Demo class, in which you will create three Student...
Please write this code in C++ Object-Oriented Programming,
specify which files are .h, and .cpp, and please add comments for
the whole code.
Include a class diagrams, and explain the approach you used for
the project and how you implemented that, briefly in a few
sentences.
Please note the following:
-Names chosen for classes, functions, and variables should
effectively convey the purpose and meaning of the named
entity.
- Code duplication should be avoided by factoring out common code
into...
You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course...
PYTHON 3 Object Oriented Programming
***a9q3.py file below***
class GradeItem(object):
# A Grade Item is anything a course uses in a grading scheme,
# like a test or an assignment. It has a score, which is assessed by
# an instructor, and a maximum value, set by the instructor, and a weight,
# which defines how much the item counts towards a final grade.
def __init__(self, weight, scored=None, out_of=None):
"""
Purpose:
Initialize the GradeItem object.
Preconditions:
:param weight: the weight...
In this assignment you will practice using Data Structures and Object Oriented concepts in Java. Your implementation should target the most efficient algorithms and data structures. You will be graded based on the efficiency of your implementation. You will not be awarded any points if you use simple nested loops to implement the below tasks. You should use one or more of the below data structures: - ArrayList : - JavaDoc: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html - Tutorial: http://docs.oracle.com/javase/tutorial/collections/interfaces/list.html Question You are provided with...
1. (TCO 7) Which of the following statements are true? (Points : 5) Interfaces contain one and only one implemented method, a constructor. Interfaces are defined inside an abstract class. All methods defined in an interface must be implemented when used by another class. A true object-oriented design must contain as least one interface. Question 2. 2. (TCO 7) In an object-oriented program, methods with no implementation might be found in an _____ and/or a(n) ______....
Y. Daniel Liang’s 8 Class Design Guidelines were posted on the File Manager and handed out in class. Please choose 5 guidelines and discuss them in depth. For each guideline, use 1 page or more for your discussion. You can use the code provided in class to demonstrate your points. The code should not be more than one-third of your writing. 1. Cohesion • [✓] A class should describe a single entity, and all the class operations should logically fit...