

















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































Object Oriented Programming Object Oriented Programming (OOP) is a method of computer programming (software design) in which programmers describe not only the data types of a date structure, but also the types of operations that may be performed on them (functions) (What is Object Oriented Programming? OOP Explained in Depth, 2021). The first step in OOP is to identify all of the objects that a programmer wishes to work with and their relationships. Once an item is identified, it is classified as a class of objects that defines the sort of data it contains and all logic sequences that can handle it. Every different logical sequence is referred to as a method, and objects can communicate using well-defined message interfaces. Object-oriented programming languages include Java, C++, C#, Python, JavaScript, Ruby, Dart, and others. Features/Characteristics of OOP The features or principles of OOP are explained below briefly:
b. Multiple inheritance The derived class inherits from two or more base classes in this sort of inheritance. Example
5. Object / Class In object-oriented programming, a class is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods). − The user-defined objects are created using the class keyword. The class is a blueprint that defines a nature of a future object. An instance is a specific object created from a particular class. Classes are used to create and manage new objects and support inheritance—a key ingredient in object-oriented programming and a mechanism of reusing code. 6. Polymorphism: − The word polymorphism is used in various contexts and describes situations in which something occurs in several different forms. In computer science, it describes the concept that
objects of different types can be accessed through the same interface. Each type can provide its own, independent implementation of this interface. It is one of the core concepts of object- oriented programming (OOP). − If you’re wondering if an object is polymorphic, you can perform a simple test. If the object successfully passes multiple is-a or instance of tests, it’s polymorphic. As I’ve described in my post about inheritance, all Java classes extend the class Object. Due to this, all objects in Java are polymorphic because they pass at least two instance of checks. − Different types of polymorphism static or compile-time dynamic Benefits of OOP OOP is easy to maintain because of its modularity and encapsulation. OOP simulates the real world, making it simpler to comprehend. Because objects are complete in and of themselves, they can be reused in other programs. More time and resources may be spent on software verification with faster software development and cheaper development expenses. Object-oriented software tends to deliver better software, despite the fact that quality is based on team expertise. Limitation of OOP Object-Oriented programs are typically sluggish and consume a lot of memory. Over-generalization It is possible that programs designed using this paradigm will take longer to develop. Some of the most important programming methods, such as inheritance and polymorphism, can be difficult to grasp.
I. Creational Design Pattern − The creational patterns aim to separate a system from how its objects are created, composed, and represented. They increase the system's flexibility in terms of the what, who, how, and when of object creation. − As modern software engineering depends more on object composition than class inheritance, emphasis shifts away from hard-coding behaviors toward defining a smaller set of basic behaviors that can be composed into more complex ones. Hard-coding behaviors are inflexible because they require overriding or reimplementing the whole thing in order to change parts of the design. Additionally, hard-coding does not promote reuse and makes it difficult to keep track of errors. For these reasons, creational patterns are more useful than hardcoding behaviors. Creational patterns make design become more flexible. They provide different ways to remove explicit references in the concrete classes from the code that needs to instantiate them. In other words, they create independency for objects and classes. − Consider applying creational patterns when: − A system should be independent of how its objects and products are created. − A set of related objects is designed to be used together. − Hiding the implementations of a class library or product, revealing only their interfaces.
− Constructing different representation of independent complex objects. − A class wants its subclass to implement the object it creates. − The class instantiations are specified at run-time. − There must be a single instance and client can access this instance at all times. − Instance should be extensible without being modified. − Types of creational design patterns
design patterns, such as the Visitor Pattern, allow you to do things that would otherwise be impossible or complicated, such as adding new functionality to a group of classes without them realizing it. One would create an interface or virtual methods using standard OOP techniques for each class. An interface or virtual methods that each class implements would be created using standard OOP techniques. This is in violation of the OOP open/closed principle.
Benefits of UML UML is largely used to model the system's work flow and behavior. However, there are more benefits of UML which are listed below briefly: To give consumers with a ready-to-use expressive visual language that aids in the interchange of meaningful models between developers. To provide customization and extensibility mechanisms to the main concepts. To incorporate best practices that aid in the creation of a solid application. To promote concepts such as collaboration, frameworks, patterns, and components at a higher degree of development. UML tools A software program that supports part or all of the syntax and semantics associated with the Unified Modeling Language (UML), which seems to be the industry norm general-purpose modeling language for computer science, is known as a UML tool. The term "UML tool" is used generically here to refer to application programs that are not entirely focused on UML but do support some UML capabilities as an add-on, a component, or as part of a comprehensive capability. Some of the best UML tools which are leading industry are listed below:
Explanation: This is a manager's development system. Create a system that can manage students as well as subject teachers. When users first launch the app, they will have the option of viewing the student or lecturer management screens. The administration has the ability to add, edit, delete, and perform query tasks such as searching. Then you'll be able to see what you've seen. This is the manager's development system. Create a system that can manage students as well as subject teachers. When users first launch the app, they will have the option of viewing the student or lecturer management screens. The administration has the ability to add, edit, delete, and perform query tasks such as searching. Then we'll be able to see what we've changed. This can be viewed as a solution that simplifies management. – Class Program
− Explain: This is a feature of the application that displays a list of newly added lecturers; the required data are Access LecturerID, Name of Lecturer, Date of Birth, Home Address, and finally Mail to Contact, which must be filled out. The lecturer's show list view is successful because there is enough information. Define class diagrams for specific design patterns using a UML tool. I. Creational Design patterns ➢ Factory method:
− "Define an interface for creating an object, but let subclasses decide which class to instantiate. The Factory method lets a class defer instantiation it uses to subclasses." (Gang Of Four) − Creating an object often requires complex processes not appropriate to include within a composing object. The object's creation may lead to a significant duplication of code, may require information not accessible to the composing object, may not provide a sufficient level of abstraction, or may otherwise not be part of the composing object's concerns. The factory method design pattern handles these problems by defining a separate method for creating the objects, which subclasses can then override to specify the derived type of product that will be created. − The factory method pattern relies on inheritance, as object creation is delegated to subclasses that implement the factory method to create objects. − UML class Diagram: In the above UML class diagram, the Creator class that requires a Product object doesn't instantiate the Product1 class directly. Instead, the Creator refers to a separate factoryMethod() to create a product object, which makes the Creator independent of which concrete class is instantiated. Subclasses of Creator can redefine which class to instantiate. In this example, the Creator1 subclass implements the abstract factoryMethod() by instantiating the Product1 class. − Example: