Question

In: Computer Science

What is the difference among the principles of modularization, abstraction, encapsulation, and separation of interface and...

What is the difference among the principles of modularization, abstraction, encapsulation, and separation of interface and implementation. Please provide with related examples.

#Course: Software Engineering

Solutions

Expert Solution

principles of modularization

The modularity principle is the most basic principle in engineering. It states: Systems should be built from cohesive, loosely coupled components (modules).

A cohesive component has a well defined function or purpose.

Components are loosely coupled if their interdependencies are minimized.

Cohesive, loosely coupled components are easy to understand, reuse, and replace

principles of abstraction

The Abstraction Principle is one of the most fundamental principles in engineering. It states:

The interface of a component should be independent of its implementation.

A component could be a hardware or software component.

The interface of a component is the user's view of the component, while the implementation is the developer's view. If a component is designed following the Abstraction Principle, then the user doesn't need to understand how a component works in order to use the component and the developer can modify the implementation without notifying the user.

Example

The classical example of the Abstraction Principle is a car. We can regard the interface as the dashboard, pedals, and shifter. The implementation is the engine and transmission. Think about how difficult it would be if drivers needed to understand engines in order to drive and had to relearn to drive each time a mechanic replaced an engine part.

principles of encapsulation

Encapsulation is one of the fundamentals of OOP (object-oriented programming). It refers to the bundling of data with the methods that operate on that data. Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties’ direct access to them. Publicly accessible methods are generally provided in the class (so-called getters and setters) to access the values, and other client classes call these methods to retrieve and modify the values within the object.

Encapsulation is a good idea for several reasons:

  • the functionality is defined in one place and not in multiple places.
  • it is defined in a logical place – the place where the data is kept.
  • data inside our object is not modified unexpectedly by external code in a completely different part of our program.
  • when we use a method, we only need to know what result the method will produce – we don’t need to know details about the object’s internals in order to use it. We could switch to using another object which is completely different on the inside, and not have to change any code because both objects have the same interface.

principles of separation of interface and implementation

An Interface defines a set of method signatures, while a Class defines the structure and behavior of its instances. A class may match several interfaces, if it implements the methods defined by each interface. Classes are instantiable, while interfaces are not. In contrast, we propose a different separation of interface and implementation, based on the properties supported by the context relation. A base class defines the structure and interface (method signatures) of its instances, and may provide implementations for the interface as well. If an implementation of a method is not provided directly in the base class, the implementation may be separately given in one or more classes that are context-related to the base class. In contrast to the notion of Interface in Java, a base class that defines only interfaces may still be instantiated. To prevent a method resolution error at run-time, we require an implementation of the method to either exist directly in the base class or to exist in some context-related class that is declared to be the default implementation.

Note: Plzzz don' t give dislike.....Plzzz comment if u have any problem i will try to resolve it.......


Related Solutions

Why is is useful to enforce the separation of interface from implementation (i.e., the abstraction boundary)...
Why is is useful to enforce the separation of interface from implementation (i.e., the abstraction boundary) of an ADT? Provide a concrete example to help justify your explanation
i need a full explanation in details Object Oriented Programming Principles Principles Polymorphism Inheritence Encapsulation Abstraction...
i need a full explanation in details Object Oriented Programming Principles Principles Polymorphism Inheritence Encapsulation Abstraction Class Object Method Message Passing
Which Feature of OOP illustrates code reusability? Abstraction, Encapsulation, Inheritance, Polymorphism or All of them.
Which Feature of OOP illustrates code reusability? Abstraction, Encapsulation, Inheritance, Polymorphism or All of them.
Software Engineering Fundamentals: Classification (Grouping) Abstraction (Representing) Inheritance (Generalizing) Encapsulation (Modularizing) Association (Relating) Polymorphism (Executing) Understanding...
Software Engineering Fundamentals: Classification (Grouping) Abstraction (Representing) Inheritance (Generalizing) Encapsulation (Modularizing) Association (Relating) Polymorphism (Executing) Understanding and applying these fundamentals is crucial to great program design. Please describe, in your own words, any two out of the above 6 fundamentals. The answer must include practical examples (you are welcome to demonstrate your understanding by drawing a UML diagram, writing a small piece of pseudo-code, and/or writing a small piece of real code). Please describe each of the fundamentals you selected...
Thoroughly explain the separation principles of GC and HPLC
Thoroughly explain the separation principles of GC and HPLC
context important in selecting and applying guidelines and principles for interface design?
context important in selecting and applying guidelines and principles for interface design?
What is the difference between method of images (mi) , separation of variables (sv) and multipole...
What is the difference between method of images (mi) , separation of variables (sv) and multipole expansion(me) ? What are the signs that a problem is under mi, sp and me? What solution will i use for each? Thank you!
1) The principles of the Commerce Clause are: a. Separation of Powers b. Rule of Law...
1) The principles of the Commerce Clause are: a. Separation of Powers b. Rule of Law c. Individual rights d. All of the above (2) The Unitary principle is a. When a group of commonly owned companies file separate returns b. When a group of commonly owned companies files one return c. When a group of companies which are not related files one return d. When a single entity files a separate return (3) The throwback rule requires that: a....
what is a runoff coefficient in hydrology and what is hydrologic abstraction? what is their use...
what is a runoff coefficient in hydrology and what is hydrologic abstraction? what is their use and why do they matter in the engineering world? What are the primary strengths or weaknesses of the concept? What would have made it easier for you to understand the method or concept?   
What is encapsulation and why is it important for network communication on the internet?
What is encapsulation and why is it important for network communication on the internet?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT