Category Archives: Weekly Blogs for CS-343

 GRASP

General Responsibility Assignment Software Patterns – is composed of various instructions which make the definition of classes but also of objects in the design that are oriented by different objects. GRASP has 9 different principles and models, each of which presents as a start the problems and solutions they have:

Information expert – What is the basic principle from which the responsibility for objects is determined?

                                    -We have to assign a class responsibility that has

                                     necessary information in order to fulfill it

In this example, the customer class carries references to all the messages that customers have. In this way, taking responsibility from the candidate to do the calculation of the total value of the various orders, comes gradually naturally. For this reason, this is one of the main principles, but also for the fact that if we do not have all the data we need, at that time we would not be able to meet the requirements and determine the responsibility.

Creator Who creates object A?

                We need to define class B in order to create object A (or e

                in other words, B contains the data of A, records them, uses them closely, and with

                most importantly I have the initializing data that A) has.

This model tries to help in order to be able to decide which class should be responsible for creating a new example of a certain class. In principle, creating an object as a whole is one of the most important processes, and it is important to have a principle for deciding who should have the opportunity to create a possible class example.

Controller – Who is the first object to be used beyond the UI layer which receives and

                      coordinates the control that a system operation performs?

                    – The responsibility of an object which represents: “system” e

                     generally represents the “root object” as well as a usage scenario from

                     where the operation of the system is possible.

The high-level design of our system creates dependence on the implementation of this principle. However, we always have to define the object in order to process the business transactions that we have.

Low Merger – How do we enable the impact of change? How to make it possible to

                             do we support low dependency but also increased reuse?

                          -To determine the responsibility that belongs to us so that the union (Which in this case is

                            Unnecessary, to remain the same Low.

The relation is basically about the mass, how one element relates to another. In this way, the higher the union is, the greater the dependence that one element has on another.

High cohesion – The way we keep objects focused, manageable,

                                 understandable, but also as a side role to support the low link?

                                -We have to assign a certain responsibility, for the sole reason that cohesion

                                 to remain high again.

The definition of cohesion is that it has the role of a measure of how tightly all the responsibilities that the element has can be related. In general, classes that have low cohesion, have within the data that are unrelated, or that have unrelated behaviors.

Indirect – The place from where responsibility should be assigned to avoid merging in order

                   direct between two or even more things.

                 – A responsibility must be assigned to an object that is intermediate, from where

                  mediation of services or other components is done, for the sole reason that they

                  not have a direct connection.

At this moment, the position of the mediator model enters the game. Another role that Indirection has is that it supports low fusion, but at the same time reduces all readability and reasoning to be used for the whole system as a whole.

Polymorphism – How are alternatives that are based on their type treated?

                         -At the moment when the alternatives or even the behaviors which are

                          interrelated    change

                       based on the type of class, determine the responsibility we should have for

                       behavior towards the species from where the behavior also changes, using in this way

                       also polymorphic operations.

Polymorphism is a term that indicates the basic design principle that is object-oriented. This principle has very strong links with what is otherwise called the Strategy Model.

Clean fabrication – Which object should have more responsibility, when we need it to violate the

                                  High   Cohesion but also the Low League. But in addition to these, the solutions

                                  which are offered by other principles and which are not considered appropriate?

                                -We need to define a group that is responsible for a certain class

                                  artificial or even a suitable class that can not do the representation of

                                  a concept that has the domain of the problem.

In some cases, it is very difficult to understand the moment where we have to place the responsibility. This is the main reason why there is a Domain Service concept in Domain-driven Design. The logic behind these services is not directly related to the entities that are separate.

Protected variations – How to design subsystems, objects, and systems in

                                              these elements, not to be influenced by other elements?

                                             -How to identify points that have variations or

                                              even the instability that is predicted, must

                                              define the responsibility we need to create an interface that is with

                                              stable.

This principle is the most important and is indirectly related to the other principles that GRASP has. But we must always be ready for the demands that are constantly changing, as programmers that we are.

Refereces:

https://titanwolf.org/Network/Articles/Article?AID=c96c4845-28c5-46c8-ae48-

https://yamm.finance/wiki/GRASP_(Object_Oriented_Design).html

From the blog CS@worcester – Xhulja's Blogs by xmurati and used with permission of the author. All other rights reserved by the author.

Design Principles

The four fundamental ideas of Object-Oriented Programming are Encapsulation, Abstraction, Inheritance, and Polymorphism. OOP allows programmers to approach software development as if they were dealing with real-world objects. People in real life have the skills and expertise to do a variety of tasks. Objects in OOP feature fields for storing knowledge, state, and data, as well as the ability to perform a variety of operations. The basic terms we need to know before getting more into OOP are Object, Class, Method, and Instance.

Object – A class’s instance

Class – A model that describes an object’s functionality

Method – Changing the state of a class applies to all other instances of the class

Instance – Is similar to an object. The blueprint used to build the product is an instance of the class.

Let’s move on to the four fundamental ideas of Object-Oriented Programming:

Encapsulation

When objects are encapsulated inside a class, they each have a private state. Other objects can’t directly access this state, but they can only use a list of public functions to get at it. These functions allow the object to control its own state and no other class has access to it unless access is granted. As a developer, you must use the given ways to communicate with the object. The state of a class invoked by a method created a bond between the private state and public methods.

Abstraction

Abstraction is a continuation of encapsulation. To show just relevant information to an object, data is selected from a large pool. Abstraction is the technique used to get, remove, or select user data from a bigger pool. In the case of abstraction, you can use the same info gathered for a different app to power other programs with little or no coding changes.

Inheritance

Inheritance is the process through which one object gains access to all of the properties of another without actually changing anything about the original. For instance, a child gets personality qualities from both of their parents. Reusability is a significant benefit of inheritance. The existing class’s fields and methods can be reused. Inheritance might be single, multiple, multilevel, hierarchical and hybrid, in Java.

Polymorphism

Polymorphism makes it possible to utilize a class in the same way as its parent, which eliminates the possibility of confusion. As a result, each child sub-class retains its own functions and methods. Each of the child sub-classes should have unique variations.

In a conclusion, Object-Oriented Programming refers to programming languages that use objects. The goal is to implement real-world concepts, keep data and the functions that operate on it separate such that no other part of the code may access it, except for that function.

References:

https://info.keylimeinteractive.com/the-four-pillars-of-object-oriented-programming

https://www.geeksforgeeks.org/understanding-encapsulation-inheritance-polymorphism-abstraction-in-oops/

From the blog CS@worcester – Xhulja's Blogs by xmurati and used with permission of the author. All other rights reserved by the author.