Introduction to OOP concepts and UML
In this tutorial, the basic concepts of Object-Oriented Programming (OOP) and Unified Modeling Language (UML) are described. Both these topics are integral parts of the analysis and design of the object-oriented systems.
Basics of OOP
OOP is the most popular programming paradigm for building software systems in the IT industry. The article tries to introduce OOP concept by making a comparison with the conventional programming languages (e.g. C, PASCAL, COBOL, FORTRAN etc.) which use the Procedure-Oriented Programming (POP) approach.
In POP approach, a program is divided into a number of components called functions, while in OOP approach (e.g. C++, Java, Python, Ruby etc.); the program is divided into components called objects. Another point is that object-oriented programming follows the “bottom-up” approach, while procedural programming follows the “top-down” approach.
Because objects are more versatile, OOP can be used to develop complex programs with less code. The use of objects also facilitates code reuse. In POP, the focus is placed on the functions and sequence of actions to be performed and not on data. In OOP, however, the focus is placed on the data and not the functions. That is why object-oriented programming approach can provide a more realistic view of a software system.
Essential features of OOP
♦ Encapsulation: This is an important concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Encapsulation led to the OOP concept of data hiding.
♦ Inheritance: It is the procedure by which one object acquires the properties of another object. This increases code re-usability.
♦ Polymorphism: This concept enables one entity to be used as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as “one interface, multiple methods”.
Basics of UML
The Unified Modeling Language (UML) is a standardized general-purpose modeling language in the field of Software Engineering. It has quickly become the de-facto standard for building Object-Oriented software. This chapter provides a technical overview of the UML diagrams supported by Enterprise Architect. To become familiar with the concepts of UML, first of all we have to know “What is UML?”
The OMG specification states:
“The Unified Modeling Language (UML) is a graphical language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system. The UML offers a standard way to write a system’s blueprints, including conceptual things such as business processes and system functions as well as concrete things such as programming language statements, database schemas, and reusable software components.”
The important point to note here is that UML is a ‘language’ for specifying and not a method or procedure. The UML is used to define a software system; to detail the artifacts in the system, to document and construct – it is the language that the blueprint is written in. The UML may be used in a variety of ways to support a Software Development Methodology (such as the Rational Unified Process) – but in itself it does not specify that methodology or process.
The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems. The UML is a very important part of developing objects oriented software and the software development process. The UML uses mostly graphical notations to express the design of software projects. Using the UML helps project teams communicate, explore potential designs, and validate the architectural design of the software.
Goals of UML
The primary goals in the design of the UML are:
- Provide users with a ready-to-use, expressive visual modeling language so they can develop and exchange meaningful models.
- Provide extensibility and specialization mechanisms to extend the core concepts.
- Be independent of particular programming languages and development processes.
- Provide a formal basis for understanding the modeling language.
- Encourage the growth of object oriented tools in the market.
- Support higher-level development concepts such as collaborations, frameworks, patterns and components.
- Integrate best practices in Software Development Life Cycle (SDLC).