Object Oriented and UML Class Diagram:

Object Oriented and UML Class Diagram:

• **What is an object ?**
• An object is an abstraction of something in a problem domain. Basically a representation of data reflecting the capabilities of the system to keep track of information about it and interaction with it.
• An object must have a State, Behaviour and Identity.
    ◦ State: is what something is.  Basically the data representation or attributes. So the State is what the object is at any moment which affect the behaviour of the object.
    ◦ Behaviour: is what something does. Basically is how we interact with our data representation. Thus procedure attribute.  So the Behaviour is what the object can do and how it respond to event and stimuli.
    ◦ Identity: is what makes something unique. So is the unique name given to the object.

• Example using whatApp Profile: object::userPaul    identity::paul    behaviour::chatting state::online    
• Example2 using whatApp Profile: object::userMike    identity::mike    behaviour::incomingCall state::offline  


• **How are objects created ?**
• They are created using a Class. In programming a class is what we use t model State, Behaviour and Identity. So all objects are instances of a class.  So object are concrete representation of a class and a class is a blueprint for creating an object.
• What is a Class ?
    ◦ A class is a description of a set of object with similar features, characteristics, semantics and constraints.   Example: class::Profile     class::Account        class::Chats class::Notification    class::Help    class::Storage
• Concept of Classes gives birth to Inheritance(is a relationship)
    ◦ Inheritance is the idea that we can inherit a characteristics of a particular class we need into another class instead of creating the whole thing from scratch.
    ◦ We call it Generalization(super class) and Specialization(sub class). So the higher the class the more General it is and the lower the class the more Specialize it is.
    ◦ Example: class::Profile is a class::Account (Account is a Generalization of Profile or Profile is a Specialization of Account)


• Concept of Classes makes room for Encapsulation
    ◦ Encapsulation allows a message to passed through an object while hiding its information. 
    ◦ So is all about  is to focus on achieving the result whiles abstracting all the details and background information the object goes through to deliver the result.
    ◦ Example: object::userPaul making a video call with object::userMike     - so here where don’t care where we are using TCP or UDP network connection.

• Concept of Classes makes room for  Polymorphism
    ◦ Polymorphism is allowing a message to achieve the same result by have multiple functionality even when the mechanism for achieving the result differ between object.
    ◦ Example: object::userPaul can write on status wall     object::userMike can upload image or videos on status wall. 



**• How to we solve large complex problem with help of Object Oriented ?**
• We  use UML Class Diagram to break the problem into pieces and solve it.
• To understand UML Class Diagram we have to know the concept of Structural Modelling.
    ◦  Structure Model is a formal of represent the key objects in our problem domain
    ◦ It consist of Four basic element:
        1. Class (Blueprint for our object and object are the concrete representation of the class)
        2. Attribute (Useful information to the task we feel our system we are building should keep track of it)
        3. Operation (Action and method we eject into the class to make it interactive and four main operations are constructor, query, update and destructor)
        4. Relationship (involves association(and we can have 0..*(zero to many), 1..5(1 to 5), 1(only one), 1,3..5(1 to 3 up to 5) and so on association), aggregation(weak type)/composition(strong type), generalization and dependency)

• Using Facebook WhatApp  As Example:

UML1.png

UML2.png

UML3.png

UML4.png