Module5 - Object Oriented Analysis Static Model
Module5 - Object Oriented Analysis Static Model
Software Engineering
Computer Science
Academic Year 2023/2024
1
Contents
1. Introduction
• What will we learn
2. Domain Model
3. Class Diagrams
- Classes
- Attributes
- Operations
- Class Relationships
4. Object Diagrams
- Constraints
1. Introduction
What will we learn?
• Static or Structural modeling captures the static features of a system.
• Structural model represents the framework for the system and this framework is the place
where all other components exist. Hence, the class diagram, component diagram and
deployment diagrams are part of structural modeling. They all represent the elements and
the mechanism to assemble them.
• The structural model does not describe the dynamic behavior of the system.
• What are we going to see in this section? Modeling Elements in UML! Such as:
ü Class diagrams
ü Objects diagrams
1. Introduction
What will we learn?
• The static model: aspects of the internal structure of the system.
ü Intra-object: attributes and operations of classes.
ü Inter-object: relations between object classes.
• OOA/D uses the Analysis done in UML use cases and diagrams to help developers
understand the requirements and to design software. OOAD uses UML diagrams to
represent the different components and interactions of a software system.
1. Introduction
What will we learn?
1. Introduction
What will we learn?
1. Introduction
What will we learn?
OOA/D
Examples
Discovering Static Model
Objects
OOA/D
Object
Domain Model
Diagrams
Class
Diagrams
1. Introduction
• Book References
https://youtu.be/3LrOpwhsplY?si=Sx5ur8Zbs-8D65r1
OOA/D in UML
https://youtu.be/qoxoX3ZiazI?si=hjMVkshhZ--z-h-s
UML Modeling
https://youtu.be/kNV-NvBuH7M?si=DD5UW_PrxOar-7kW
https://youtu.be/NEmZZX8Xgns?si=ZRHvNPqzTpZzSpjy
Class Diagram https://youtu.be/wkTuCIScFQI?si=8GpNOVVTVYoOCZNU
https://youtu.be/sKqMDsDoeQ8?si=zgkNWfeVMrLnmCFO
https://youtu.be/Rhgg3hSI6I0?si=ASMFoc61a_PCOlLI
Object Diagram
Contents
1. Introduction
• What will we learn
2. Domain Model
3. Class Diagrams
- Classes
- Attributes
- Operations
- Class Relationships
4. Object Diagrams
- Constraints
2. Domain Model
• The quintessential object-oriented analysis step is the decomposition of a domain
into noteworthy concepts or objects.
• A domain model is a visual representation of conceptual classes or real-situation
objects in a domain.
• Domain models have also been called conceptual models, domain object models,
and analysis object models.
• Domain model means a representation of real-situation conceptual classes, not of
software objects. The term does not mean a set of diagrams describing software
classes, the domain layer of a software architecture, or software objects with
responsibilities.
2. Domain Model
• Domain model means a representation of real-situation conceptual classes, not of software
objects. The term does not mean a set of diagrams describing software classes, the domain
layer of a software architecture, or software objects with responsibilities (like coded in
Pyhton, C++, Java etc).
• The object-oriented developer
will take inspiration from the real
world domain in creating
software clases (Design Model).
• Therefore, the representational
gap between how stakeholders
conceive the domain, and its
representation in software, is
lowered.
2. Domain Model
• A system’s structure is made up of a collection of pieces often referred to as
objects. Classes describe the different types of objects that your system can have,
and class diagrams show these classes and their relationships.
• Use cases describe the behavior of your system as a set of concerns. Classes
describe the different types of objects that are needed within your system to meet
those concerns.
• Classes form part of the model’s logical view, as described in Module 3 (section 3).
• Let see conceptual Classes and Objects in more detail in the next sections.
Contents
1. Introduction
• What will we learn
2. Domain Model
3. Class Diagrams
- Attributes
- Operations
- Class Relationships
4. Object Diagrams
- Constraints
3. Class Diagrams
• A UML class diagram is therefore used to show the existence of classes and their
relationships in the logical view of a system.
• During analysis, we use class diagrams to indicate the common roles and
responsibilities of the entities that provide the system’s behavior. During design, we
will use those class diagrams to capture the structure of the classes that form the
system’s architecture.
• The two essential elements of a class diagram are classes and their basic
relationships.
3. Class Diagrams
• Attributes are shared characteristics of all objects created from the same class.
• For each object attributes we get to assign a value.
• Each attribute has a type (the ones found in any programming language (int, boolean…).
• Note from the example figure that in the TemperatureSensor class, the multiplicity of [0..60] on the
measuredTemperature attribute indicates an array of 0 to 60 temperature measurements.
• The default value for an attribute is the value to be given at creation time, if none was provided.
• The property string listed in braces provides additional properties such as {list} shown after the
measuredTemperature attribute. In this case, the keyword list means that the temperature
measurements will be ordered and may be nonunique. This provides the means to see the time
ordering of the measurements and to permit a repetition in measured temperature.
3. Class Diagrams
Operations
• A class’s operations describe what a class can do but not necessarily how it is going to do it. An
operation is more like a promise or a minimal contract that declares that a class will contain some
behavior that does what the operation says it will do. The collection of all the operations that a class
contains should totally encompass all of the behavior that the class contains.
• Operations are common to all object’s instances of a same class.
• The behaviour is applied on the object for which it is called (the one that executes the operation).
• They have a name, parameters, return type, exceptions and possibly a set of pre and post condition.
• Parameters are used to specify the information provided to an operation to allow it to complete its job.
More than one parameter can be passed to an operation by splitting the parameters with a comma.
• An operation’s signature also contains a return type. A return type is specified after a colon at the end.
3. Class Diagrams
Visibility
• Visibility notations indicate the
access level of attributes and
methods. Common visibility
notations include:
• We have already discussed that an object diagram is an instance of a class diagram. It implies that an
object diagram consists of instances of things used in a class diagram. So both diagrams are made of
same basic elements but in different form. In class diagram elements are in abstract form to represent
the blue print and in object diagram the elements are in concrete form to represent the real world object.
• To capture a particular system, numbers of class diagrams are limited. However, if we consider object
diagrams then we can have unlimited number of instances, which are unique in nature.
4. Object Diagrams
Constraints
• Sometimes you will want to restrict the ways in which a class can operate.
• These types of constraints go beyond what can be done with simple UML notation and calls for a
language in its own right: the OCL (Object Constraint Language).
• Invariants:
ü An invariant is a constraint that must always be true; otherwise the system is in an invalid state.
Invariants are defined on class attributes.
• Preconditions:
ü A precondition is a constraint that is defined on a method and is checked before the method
executes. Preconditions are frequently used to validate input parameters to a method.
• Postconditions:
ü A postcondition is also defined on a method and is checked after the method executes.
Postconditions are frequently used to describe how values were changed by a method.
4. Object Diagrams
Constraints
• Constraints are specified using either the OCL statement in curly brackets next to the class member
or in a separate note, as shown in the next figure