To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Interface segregation principle

From Wikipedia, the free encyclopedia

In the field of software engineering, the interface segregation principle (ISP) states that no code should be forced to depend on methods it does not use.[1] ISP splits interfaces that are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them. Such shrunken interfaces are also called role interfaces.[2] ISP is intended to keep a system decoupled and thus easier to refactor, change, and redeploy. ISP is one of the five SOLID principles of object-oriented design, similar to the High Cohesion Principle of GRASP.[3] Beyond object-oriented design, ISP is also a key principle in the design of distributed systems in general and microservices in particular. ISP is one of the six IDEALS principles for microservice design.[4]

YouTube Encyclopedic

  • 1/3
    Views:
    11 647
    96 345
    186 845
  • What is Interface Segregation Principle ?
  • Interface Segregation Principle Explained - SOLID Design Principles
  • Interface Segregation Principle

Transcription

Importance in object-oriented design

Within object-oriented design, interfaces provide layers of abstraction that simplify code and create a barrier preventing coupling to dependencies. A system may become so coupled at multiple levels that it is no longer possible to make a change in one place without necessitating many additional changes.[1] Using an interface or an abstract class can prevent this side effect.

Origin

The ISP was first used and formulated by Robert C. Martin[5] while consulting for Xerox. Xerox had created a new printer system that could perform a variety of tasks such as stapling and faxing. The software for this system was created from the ground up. As the software grew, making modifications became more and more difficult so that even the smallest change would take a redeployment cycle of an hour, which made development nearly impossible.

The design problem was that a single Job class was used by almost all of the tasks. Whenever a print job or a stapling job needed to be performed, a call was made to the Job class. This resulted in a 'fat' class with multitudes of methods specific to a variety of different clients. Because of this design, a staple job would know about all the methods of the print job, even though there was no use for them.

The solution suggested by Martin utilized what is today called the Interface Segregation Principle. Applied to the Xerox software, an interface layer between the Job class and its clients was added using the Dependency Inversion Principle. Instead of having one large Job class, a Staple Job interface or a Print Job interface was created that would be used by the Staple or Print classes, respectively, calling methods of the Job class. Therefore, one interface was created for each job type, which was all implemented by the Job class.

Typical violation

A typical violation of the Interface Segregation Principle is given in Agile Software Development: Principles, Patterns, and Practices[1] in 'ATM Transaction example' and in an article also written by Robert C. Martin specifically about the ISP.[6] This example discusses the User Interface for an ATM, which handles all requests such as a deposit request, or a withdrawal request, and how this interface needs to be segregated into individual and more specific interfaces.

See also

  • SOLID – the "I" in SOLID stands for Interface segregation principle

References

  1. ^ a b c Martin, Robert (2002). Agile Software Development: Principles, Patterns, and Practices. Pearson Education.
  2. ^ Role Interface
  3. ^ "David Hayden, Interface-Segregation Principle (ISP) - Principles of Object-Oriented Class Design". Archived from the original on 2010-08-20. Retrieved 2009-11-07.
  4. ^ Paulo Merson,Principles for Microservice Design: Think IDEALS, Rather than SOLID, The InfoQ eMag Issue #91, February 2021
  5. ^ "This principle was first defined by Robert C. Martin".
  6. ^ Robert C. Martin,The Interface Segregation Principle, C++ Report, June 1996

External links

This page was last edited on 21 February 2024, at 22:22
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.