# 94 - Creating SOLID Code: Interface Segregation Principle


3/18/2009
Level: Intermediate
Tags: SOLID Principle
Comments: (4)
Author:
Stephen Bohlen
 
Presented By:
Codebetter.com


This is the fourth in a 5 part series where we will explore the tenets of the S.O.L.I.D principles.

In this episode we will take a look at the I (Interface Segregation Principle) and see how following this principle can help us to create cleaner, more manageable code

S - Single Responsibility Principle
O - Open/Closed Principle
L - Liskov Substitution Principle
I - Interface Segregation Principle
D - Dependency Inversion Principle
Click here to Watch this Episode

Download (16.20) (11:16) (1440x900)
Download (11.78) (11:16) (960x600)

Links/Resources:


Comments: (4)

Stephen Vinck said....

Great screencast and explanation!

Just two questions.

Inheriting interfaces would that not be a problem for classes that just needs to implement the query and save data methods? The queryreportdata method would be 'not implemented'.

A class implementing an interface such as IDataAccess not violate the SRP? It is both responsible for querying data and saving data?


3/19/2009 7:32:15 AM

Steve Bohlen said....

Stephen:

That's a great point -- my idea for inheriting IDataAccess from IReportDataAcccess was really to demonstrate that its possible to inherit Interfaces in the same way that people typically look at inheriting classes and that this represents a feasible way to both decompose FAT interfaces into smaller, more focused interfaces and at the same time ensure reverse-compatibility with any existing code rather than to ensure that the existing 'legacy' interface of IDataAccess adhered to to SRP in all apects of it.

But, yes, absolutely a class that implemented the newly-refactored IDataAccess would nearly-certainly be in violation of SRP both in spirit and in practice :)

-Steve B.


3/19/2009 10:46:19 AM

Tormod said....

Hi. I love this format. Quick and easy. Appreciate the effort.

But I thought that ISP was from a consumer POV, not the implementer.

That, if a set of components are only consuming a subset of the functions in an interface, then this subset should be its own interface.

http://www.objectmentor.com/resources/articles/isp.pdf


4/14/2009 3:32:14 AM

prettyreplica said....

Replica Watches Collection

Bvlgari Watches Replica, Swiss Rolex Watch Collection, Best Fake Watch ,Cartier Watches ,Discount Watches , Fashion Watches , Wristwatch, Fake Watch, Wholesale Watches, Jewelry Watches, Replica Jewelry Watches. How to choose Sales Replica Watches the perfect Rolex Watch IWC Fake Watch for you. Buying a Rolex Jewelery Watches watch is certainly a large Jacob & Co. Watch Replica investment, as Rolex Replica Watches watches certainly cost Emporio Armani Replica Watches more than the average wristwatch. Most Rolex watches such as the Rolex yacht master, cost Replica Watch thousands of dollars. Chopard Watch Replica However, Replica Breguet Watches be aware Fake Franck Muller that you will be buying a watch of TAG Heuer Watches that will not Replica Watches ,Jaeger LeCoultre Replica Watches only Ebel Watches Replica work your whole lifetime, it will also look pretty Replica Watch good doing it. However, a Zenith Replica new Replica Mont Blanc Watches Rolex watch may simply be too much money for some people. Wholesale Replica Watches If that is Replica Bvlgari the Replica Handbag case, Jacob & Co. Watch Replica consider buying a Ebel Wristwatch pre-owned Rolex watch Luxury Vacheron Constantin instead. Whether you buy a new or used Rolex watch, you will definitely enjoy the Rado Replica Watches use of Patek Philippe Mens Watches a finely made watch made by the Fake Chopard Watches finest watch company in the last one hundred Replica Watch years. A Gucci Replica Watch Rolex, watch, Replica Patek Philippe Watches omega or cartier wristwatch Luxury Audemars Piguet are all good investments,Ulysse Nardin Watches but the Swiss Luxury Watches Rolex is simply the best Special Watches .

watches brand | Luxury watches | replica hangbag | Luxury watches | replica watch | Very Nice Bag | Real Replica Watches

A Lange&Sohne Watches     Aigner Watches     Alain Silberstein Watches     Audemars Piguet Watches     Bell&Ross Watches     Breguet Watches     Breitling Watches     Bvlgari Watches Replica     Cartier Watches     Chanel Watches Replica     Chopard Watches Replica     Concord Watches     Corum Watches     D&G Watches     Dior Watches Replica     Ebel Replica Watches     Emporio Armani Watches     Ferrari Watches     Franck Muller Watches     Glashutte Watches     Gucci Watches     Hermes Watches     Hublot Watches     IWC Watches     Jacob&Co Watches     Jaeger LeCoultre watches     Longines Watches     Louis Vuitton Watches     Michele Watches     Montblanc Watches     Movado Watches     Omega Watches     Oris Watches     Panerai Watches Replica     Patek Philippe Watches     Philip Stein Watches     Piaget Watches     Porsche Design Watches     Rado Replica Watches     Raymond Weil Watches     Richard Mille Watches     Roger Dubuis Watches     Rolex Japan Watches     Rolex Swiss Watches     Sarcar Watches     Swiss Watch International     TAG Heuer Watches     Tissot Watches     Tudor Watches     Ulysse Nardin Watches     Vacheron Constantin Watches     Versace Replica Watches     Victorinox Swiss Watches     Zenith Watches  

Balenciaga ;   Bally     Burberry     Chanel     Chloe     Christian Dior     Coach     D&G     Fendi     Gucci Handbags     Hermes     Jimmy Choo Handbags     Loewe Handbags     Louis Vuitton Bags     Marc Jacobs Handbags     Miu Miu Handbags     Mulberry Handbags     Prada     Thomas Wylde Handbags     Versace Handbags     YSL Handbag  

A Lange&Sohne Watches     Aigner Watches     Alain Silberstein Watches     Audemars Piguet Watches     Bell&Ross Watches     Breguet Watches     Breitling Watches     Bvlgari Watches     Cartier Watches     Chanel Watches     Chopard Watches     Concord Watches     Corum Watches     Dior Watches     Dolce&Gabbana Watches     Ebel Watches     Emporio Armani Watches     Ferrari Watches     Franck Muller Watches     Glashutte Watches     Gucci Watches     Hermes Watches     Hublot Watches     IWC Watches     Jacob&Co Watches     Jaeger LeCoultre watches     Longines Watches     Louis Vuitton Watches     Michele Watches     Mont Blanc Watches     Movado Watches     Omega Watches     Oris Watches     Panerai Watches     Patek Philippe Watches     Philip Stein Watches     Piaget Watches     Porsche Design Watches     Rado Watches     Raymond Weil Watches     Richard Mille Watches     Roger Dubuis Watches     Rolex Japan Watches     Rolex Swiss Watches     Sarcar Watches     Swiss Watch International     TAG Heuer Watches     Tissot Watches     Tudor Watches     Ulysse Nardin Watches     Vacheron Constantin Watches     Versace Watches     Victorinox Swiss Watches     Zenith Watches  


2/1/2010 7:59:20 PM


Name: *
Email (not displayed): *
Url:
Comments: *



So, you Human...?



Submit this story to DotNetKicks
Shout it