Object Oriented Design: Definition, Principles, and Examples

Object-oriented design is the process of planning a system of interacting objects in order to solve a software problem. This is one approach to developing collateral.

An object contains encapsulated data and procedures grouped together to represent an object. An interface defines how it can coexist, and a program describes the interaction of sets. Object-oriented design is the discipline of identifying objects and their processes to solve a problem that has been identified and documented during analysis.

The following is a description of a class-based subset that does not include prototype-based approaches when they are usually not obtained by instantiating classes, but by cloning others. Design is an object-oriented design methodology. It covers the process of decomposition and notation for the image of both logical and physical states, as well as dynamic models of the designed system.

Design Themes

Object Oriented Analysis and Design

The input for object-oriented design is provided by the output of analysis. You must understand that the artifact does not have to be fully designed to serve as a reference point. Analysis and design can occur in parallel. In practice, the results of one action can feed another in a short feedback loop through an iterative process. Both the first and second actions can be performed in stages, artifacts can be constantly increased, and not developed completely at a time.

Some typical items

Consider the most important.

1. The conceptual model.

The results of object-oriented analysis and design are covered by the concept in the subject area. The conceptual model is clearly chosen to be independent of implementation details such as concurrency or data storage.

2. Use case.

A description of the sequences of events that together lead to the system doing something useful. Each use case provides one or more scenarios that convey object-oriented system design. That it should interact with users, called actors, to achieve a specific business goal or function.

Performers of precedents may be end users or other systems. In many cases, applications of this method are further developed in the form of diagrams. Use case diagrams are used to identify the actor and the processes that they perform. More details can be found in Grady Butch’s book “Object-Oriented Design”.

3. System sequence diagram.

It is an image showing, for a specific scenario, options for using the event that are generated by external participants, their order and possible intersystem actions.

4. User Interface Documentation.

A paper that shows and describes the appearance of the final product. This item is optional, but it helps to visualize, which makes the task easier for the designer.

Relational data model

This is an abstract prototype that describes how information is presented and used. If an object base is not used, a relational data model should usually be created before the action, since the strategy chosen to receive object-oriented design is the output of the process.

However, you can simultaneously develop a relational data model, and the growth of an artifact can stimulate the refinement of other components. More details about this are also written in Buch’s book “Object-Oriented Analysis and Design”. Note that in this new edition of Grad Buch you will find many practical tips regarding analysis, implementation, design and project management.

Of the concept

The five basics of object-oriented design are implementation-level functions built into the programming language. They are often called by such common names:

1. The class of the object.

What it is? A class is a close connection or contact of data structures with methods or functions that affect them (an object is created on its basis). Each item performs a function. It is determined by its properties. An object can be part of a class that is a collection of similar objects.

2. Concealment of object-oriented design of information systems, this is the ability to protect some components from external influences.

3. Inheritance.

This is an opportunity for a class to extend or redefine the functionality of another group. The so-called subclass has a whole section, which is derived (inherited) from the superclass, and also has its own set of functions and data.

4. Interface (Among the techniques of object-oriented design, there are so-called patterns. The abstract factory interface is one of them).

The ability to postpone the implementation of the method, as well as the ability to define functions without their implementation.

5. Polymorphism (in particular, a subtype) - the ability to replace an object with its subobjects. And also the ability of a variable object to contain not only this object, but also all its components.

Object-oriented design of information systems

Concept development

Defining objects, creating class diagrams from a conceptual form usually reflect the essence.

Attribute Identification

You must use gamma patterns of object-oriented design techniques. This is not a finished product, but a description of a solution to a common problem in context. The main advantage of using a design pattern is that it can be reused in multiple applications. It is also considered to solve problems that may arise in many different situations. Object-oriented gamma design patterns typically show relationships and interactions between classes or objects without specifying the final application systems or objects that participate in them.

Definition of structure.

This is usually a set of libraries or classes that are used to implement the standard structure of the application for a particular operating system. By combining a large amount of reusable code into a platform, the developer saves a lot of time, because he solves the problem of rewriting a large amount of standard code for each new application being developed.

Conclusion (results) of object-oriented design

The sequence diagram must be resolved to add specific objects that process system events. It shows in the form of parallel vertical lines various processes that live simultaneously, and in the form of horizontal arrows - the exchange of messages between them in the order they appear.

A class diagram is a type of static UML structure that describes systems by showing their attributes and the relationships between them. Messages and classes identified by developing sequence diagrams can serve as input to the automatic generation of a global system.

Some principles and design strategies

Object Oriented Design Patterns

Often use dependency injection. What is the main idea? If the subject depends on the availability of any other instance, then the necessary one is embedded in the dependent. An example of object-oriented design: they pass the connection to the database as an argument to the constructor, rather than creating it internally. Another example using the bridge pattern: separates the abstraction from its implementation so that both objects can be changed independently.

Consider the principles of object-oriented design of acyclic dependencies. Note that the graph of components (the degree of detail depends on the amount of work) should not have cycles. This is also called a directed acyclic graph. An example of object-oriented analysis and design: let's say C depends on B, which obeys subject A. If the latter also relates to C, then there will be a cycle.

What is the principle of compound reuse? Preference is given to a polymorphic composition of inheritance. After the analysis phase, the conceptual model further develops into an object-oriented design of IP. Here, technologically independent analysis concepts are mapped onto implementing classes, constraints are identified, and interfaces are developed, resulting in a model for the solution domain.

Stages for object-oriented design of IP can be defined as follows:

  • Finding a system context.
  • Designing its architecture.
  • Identification of objects in the system.
  • Building design layouts.
  • Specification of object interfaces.
  • Design.

Object-oriented design of the system includes the definition of context, followed by the creation of architecture.

First concept

The system context has static and dynamic parts. The first was created thanks to object-oriented design using a simple block diagram, which is expanded into a hierarchy of subsystems. This model is represented by UML packages. A dynamic context describes how a system interacts with its environment. It is modeled using use case diagrams.

The system architecture is developed on the basis of context and in accordance with the principles of design, as well as subject matter. As a rule, the system is divided into layers, and they are decomposed to form subsystems.

What is object oriented decomposition? Decomposition means dividing a large complex system into a hierarchy of smaller components with less complexity. Each main part is called a subsystem. An object-oriented decomposition identifies individual autonomous objects in the system and the relationship between them.

Decomposition Benefits:

  • Individual components are less complex and therefore more understandable and manageable.
  • There is a division of labor with specialized skills.
  • This allows you to replace or modify subsystems without affecting other parts.

Concurrency detection

It allows several objects to receive events and perform several actions simultaneously. Concurrency is identified and presented in a dynamic model.

To enable it, a separate control flow is assigned to each parallel element. If parallelism is at the object level, then two different control flows are assigned to two symmetrical objects. If two operations of one of them are parallel in nature, then it is distributed between different threads.

Concurrency is associated with data integrity and deadlock issues. That is, a clear strategy should be developed whenever parallelism is required. In addition, it must be identified at the very stage of development and cannot be left at the implementation stage.

Object-oriented design techniques, design patterns

Object Oriented Design Examples

When developing applications, some generally accepted decisions are made for certain categories of problems. These are, for example, design templates. It can be defined as a documented set of building blocks that can be used in certain types of application development tasks.

Some common techniques for object-oriented design (design patterns) can be found in design patterns:

  • Facade drawing.
  • View separation model.
  • Sample observer.
  • Model controller model view.
  • Proxy template.
  • Event management.

During design, the patterns of an object-oriented system of events that can occur in objects must be identified and processed accordingly.

An event is a specification of a significant event that has a location in time and space. There are four types that can be modeled, namely:

  • Signal - a named object thrown by one and captured by another.
  • A call event is a synchronous event representing the sending of an operation.
  • The process of time is presented over time.
  • Change event - events representing a state modification.

Boundary Processing

The design phase should take into account the initialization and completion of the system as a whole, as well as each subsystem. Various aspects:

  • Start-up, i.e. transition from an uninitialized state to a stable one.
  • System shutdown, i.e. closing all running threads, clearing resources and sending messages.
  • Initial configuration and reconfiguration if necessary.
  • Anticipate system crashes or unwanted shutdowns.
  • Boundary conditions are modeled using similar use cases.

Object design

After the hierarchy of subsystems has been developed, objects in the system are identified, and their details are designed. At this stage, the designer works. The emphasis is shifting from the subject area to computer concepts. Objects identified during the analysis period are crowded out for implementation in order to minimize execution time, memory consumption and overall costs.

Designing an object includes the following steps:

  • Identification.
  • Representation. Building design models.
  • Classification of operations.
  • Design algorithm.
  • Relationship design.
  • Exercise control of external interactions.
  • Batch classes and associations in modules.

Object Identification

This is exactly the first stage of design. Objects identified during periods of object-oriented analysis are grouped into classes and refined so that they are suitable for actual implementation.

Functions of this stage:

  • Identification and refinement of classes in each subsystem or package.
  • Defining relationships and associations between sets.
  • Hierarchy development (generalization, specialization and inheritance).
  • Unit design.

Object Representation

Gamma Object Oriented Design Tricks

Once the classes are identified, they should be shown using modeling techniques. This stage, in essence, includes the construction of UML diagrams.

There are two types of designer models that need to be produced:

Static To describe it, diagrams of classes and objects are used.

Dynamic models. To describe it and show the relations between classes, interaction and state diagrams are used.

Classification of operations

At this stage, tasks performed on objects are determined by combining three models: object, dynamic and functional. The operation determines what should be done, not how.

In this regard, the following tasks should be performed:

  • A state transition diagram for each object in the system is developed.
  • Operations are defined for events received by items.
  • Cases have been identified where one event triggers others in the same or another object.
  • Suboperations in actions are defined.
  • Key actions expanded to data flow diagrams.

Algorithm development

Object Oriented Design c

Operations in objects are defined using a sequence. An algorithm is a step-by-step procedure that solves the problem described in the operation. They focus on how this should be done.

There may be more than one algorithm corresponding to an operation. Once alternative sequences are identified, the optimal one is selected for the problem area. Metrics for choosing an algorithm:

  • The complexity of the calculations. It determines the efficiency of the algorithm in terms of computation time and memory requirements.
  • Flexibility. This concept determines whether the selected algorithm can be implemented properly and without loss of conformity in various environments.
  • Clearness. Indicates whether the selected algorithm is easy to understand and implement.

Relationship Design

This strategy should be recorded at the design stage of the facility. Key relationships include association, aggregation, and inheritance.

Regarding associations, the designer must do the following:

  • Determine if the relationship is unidirectional or bidirectional.
  • Analyze association paths and update them if necessary.

Regarding inheritance, the designer must do the following:

  • Customize classes and their associations.
  • Define abstract systems.
  • Create conditions so that, if necessary, you can exchange behavior.

Exercise control

An object developer may include refinements in a state diagram model strategy. When designing a system, the basic policy of a dynamic subject is defined.

Approaches for implementing a dynamic model:

1. .

, , . . , , , .

2. .

. , .

3. - .

. , .

. , .

:

1. . « » , , .

2. . (, , ) , , , .

:

1. .

2. Closely coupled classes should be in one module, and unrelated or weakly grouped classes should be placed in separate parts.

3. Modules should have a high level of interaction between their components.

Design optimization

Object Oriented Design Techniques

The analysis model collects logical information about the system, and the project component adds details to support effective access to it. Before implementation, the program should be optimized to make the output more efficient. The goal of the improvement is to minimize costs in terms of time, space and other indicators.

However, design optimization should not be excessive, as ease of implementation, maintainability and extensibility are also important issues. In practice, this is clearly visible. Developers know that a perfectly optimized design is more efficient, but less reusable. Thus, the master must find a balance between them.

Various things you can do to improve:

  • Add redundant associations.
  • Omit unused joins.
  • Optimize Algorithms.
  • Retain derived attributes to avoid recalculating complex expressions.

Let's consider some points in more detail.

Adding redundant associations.

During project optimization, it is checked whether the creation of new alliances can reduce access costs. Although these redundant associations may not add any information, they can increase the effectiveness of the overall model.

Exclusion of unused associations.

Having too many associations can make the system undecipherable and reduce overall efficiency. That is, during optimization, all unused unions are deleted.

Improvement of algorithms.

In object-oriented systems, data structure optimization is carried out on the basis of cooperation. Once the class project is created, operations and algorithms should be improved.

Optimization is achieved by:

  • Rearrangement of the order of computational problems.
  • Changes in the sequence of cycles.
  • Deletion of the dead ends in the algorithm.
  • Preservation of derived attributes.


All Articles