<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gstungat</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gstungat"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Gstungat"/>
	<updated>2026-10-03T18:14:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51728</id>
		<title>Using heroku to deploy your projects</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51728"/>
		<updated>2011-10-06T01:15:33Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: /* What do I need? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Heroku for deploying projects =&lt;br /&gt;
== What is Heroku? ==&lt;br /&gt;
Heroku is a cloud application platform (or a PaaS) that allows developers to easily deploy their apps without worrying about servers, hosting, etc. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
We are going to use heroku to deploy the backchannel app of project 1. There are several advantages:&lt;br /&gt;
# You have a deployed app ready to test in under 5 minutes&lt;br /&gt;
# You have a public URL that you can show off to potential interviewers :)&lt;br /&gt;
# Basic signup is free!&lt;br /&gt;
&lt;br /&gt;
== What do I need? ==&lt;br /&gt;
* Go to [http://www.heroku.com Heroku] and sign up for an account. It is free to sign up.&lt;br /&gt;
* Develop and run your app locally&lt;br /&gt;
* Install git and use it to track your application. More about how to do that [[Using_git_and_github_for_projects]]&lt;br /&gt;
* Create a public SSH key &lt;br /&gt;
  $ ssh-keygen -t rsa -C &amp;quot;your_email@youremail.com&amp;quot;&lt;br /&gt;
* Install the heroku gem&lt;br /&gt;
  gem install heroku&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
You will have to enter your heroku credentials&lt;br /&gt;
* Create your heroku application.&lt;br /&gt;
In your project directory,&lt;br /&gt;
  heroku create&lt;br /&gt;
* Push to heroku&lt;br /&gt;
  git push heroku master&lt;br /&gt;
* Migrate your database&lt;br /&gt;
  heroku rake db:migrate&lt;br /&gt;
Viola you are done! Your public URL is specified when you did heroku create. Your application is all set to go!&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Heroku help ==&lt;br /&gt;
This guide has been taken largely from the heroku dev center. Look at [http://devcenter.heroku.com/articles/quickstart Heroku HowTo] for more details. Also, effectively use google to solve your doubts, there is plenty of help available.&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51723</id>
		<title>Using heroku to deploy your projects</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51723"/>
		<updated>2011-10-05T17:05:25Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: /* What do I need? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Heroku for deploying projects =&lt;br /&gt;
== What is Heroku? ==&lt;br /&gt;
Heroku is a cloud application platform (or a PaaS) that allows developers to easily deploy their apps without worrying about servers, hosting, etc. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
We are going to use heroku to deploy the backchannel app of project 1. There are several advantages:&lt;br /&gt;
# You have a deployed app ready to test in under 5 minutes&lt;br /&gt;
# You have a public URL that you can show off to potential interviewers :)&lt;br /&gt;
# Basic signup is free!&lt;br /&gt;
&lt;br /&gt;
== What do I need? ==&lt;br /&gt;
* Go to [http://www.heroku.com Heroku] and sign up for an account. It is free to sign up.&lt;br /&gt;
* Develop and run your app locally&lt;br /&gt;
* Install git and use it to track your application. More about how to do that [[Using_git_and_github_for_projects]]&lt;br /&gt;
* Create a public SSH key &lt;br /&gt;
  $ ssh-keygen -t rsa -C &amp;quot;your_email@youremail.com&amp;quot;&lt;br /&gt;
* Install the heroku gem&lt;br /&gt;
  gem install heroku&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
You will have to enter your heroku credentials&lt;br /&gt;
* Create your heroku application.&lt;br /&gt;
In your project directory,&lt;br /&gt;
  heroku create&lt;br /&gt;
* Push to heroku&lt;br /&gt;
  git push heroku master&lt;br /&gt;
* Migrate your database&lt;br /&gt;
  heroku rake db:create&lt;br /&gt;
Viola you are done! Your public URL is specified when you did heroku create. Your application is all set to go!&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Heroku help ==&lt;br /&gt;
This guide has been taken largely from the heroku dev center. Look at [http://devcenter.heroku.com/articles/quickstart Heroku HowTo] for more details. Also, effectively use google to solve your doubts, there is plenty of help available.&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51720</id>
		<title>Using heroku to deploy your projects</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51720"/>
		<updated>2011-10-05T01:45:04Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Heroku for deploying projects =&lt;br /&gt;
== What is Heroku ==&lt;br /&gt;
Heroku is a cloud application platform (or a PaaS) that allows developers to easily deploy their apps without worrying about servers, hosting, etc. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
We are going to use heroku to deploy the backchannel app of project 1. There are several advantages:&lt;br /&gt;
# You have a deployed app ready to test in under 5 minutes&lt;br /&gt;
# You have a public URL that you can show off to potential interviewers :)&lt;br /&gt;
# Basic signup is free!&lt;br /&gt;
&lt;br /&gt;
== What do I need ==&lt;br /&gt;
* Go to [http://www.heroku.com Heroku] and sign up for an account. It is free to sign up.&lt;br /&gt;
* Develop and run your app locally&lt;br /&gt;
* Install git and use it to track your application. More about how to do that [[Using_git_and_github_for_projects]]&lt;br /&gt;
* Create a public SSH key &lt;br /&gt;
  $ ssh-keygen -t rsa -C &amp;quot;your_email@youremail.com&amp;quot;&lt;br /&gt;
* Install the heroku gem&lt;br /&gt;
  gem install heroku&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
You will have to enter your heroku credentials&lt;br /&gt;
* Create your heroku application.&lt;br /&gt;
In your project directory,&lt;br /&gt;
  heroku create&lt;br /&gt;
* Push to heroku&lt;br /&gt;
  git push heroku master&lt;br /&gt;
* Migrate your database&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
Viola you are done! Your public URL is specified when you did heroku create. Your application is all set to go!&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
== Heroku help ==&lt;br /&gt;
This guide has been taken largely from the heroku dev center. Look at [http://devcenter.heroku.com/articles/quickstart Heroku HowTo] for more details. Also, effectively use google to solve your doubts, there is plenty of help available.&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51719</id>
		<title>Using heroku to deploy your projects</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Using_heroku_to_deploy_your_projects&amp;diff=51719"/>
		<updated>2011-10-05T01:43:49Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: Created page with &amp;quot;= Heroku for deploying projects = == What is Heroku == Heroku is a cloud application platform (or a PaaS) that allows developers to easily deploy their apps without worrying abou...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Heroku for deploying projects =&lt;br /&gt;
== What is Heroku ==&lt;br /&gt;
Heroku is a cloud application platform (or a PaaS) that allows developers to easily deploy their apps without worrying about servers, hosting, etc. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
We are going to use heroku to deploy the backchannel app of project 1. There are several advantages:&lt;br /&gt;
# You have a deployed app ready to test in under 5 minutes&lt;br /&gt;
# You have a public URL that you can show off to potential interviewers :)&lt;br /&gt;
# Basic signup is free!&lt;br /&gt;
&lt;br /&gt;
== What do I need ==&lt;br /&gt;
# Go to [http://www.heroku.com Heroku] and sign up for an account. It is free to sign up.&lt;br /&gt;
# Develop and run your app locally&lt;br /&gt;
# Install git and use it to track your application. More about how to do that [[Using_git_and_github_for_projects]]&lt;br /&gt;
# Create a public SSH key &lt;br /&gt;
  $ ssh-keygen -t rsa -C &amp;quot;your_email@youremail.com&amp;quot;&lt;br /&gt;
# Install the heroku gem&lt;br /&gt;
  gem install heroku&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
You will have to enter your heroku credentials&lt;br /&gt;
# Create your heroku application.&lt;br /&gt;
In your project directory,&lt;br /&gt;
  heroku create&lt;br /&gt;
# Push to heroku&lt;br /&gt;
  git push heroku master&lt;br /&gt;
# Migrate your database&lt;br /&gt;
  heroku keys:add&lt;br /&gt;
Viola you are done! Your public URL is specified when you did heroku create. Your application is all set to go!&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
== Heroku help ==&lt;br /&gt;
This guide has been taken largely from the heroku dev center. Look at [http://devcenter.heroku.com/articles/quickstart Heroku HowTo] for more details. Also, effectively use google to solve your doubts, there is plenty of help available.&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=51718</id>
		<title>MainPage</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=MainPage&amp;diff=51718"/>
		<updated>2011-10-05T00:56:43Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[ELI demo]]&lt;br /&gt;
* [[CSC 216]] learning exercise&lt;br /&gt;
* [[Expertiza documentation]]&lt;br /&gt;
* [[CSC 379]]&lt;br /&gt;
* [[CSC/ECE 506 Fall 2007]]&lt;br /&gt;
* [[ECE506_Main_Page | CSC/ECE 506 Main Portal]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2007]]&lt;br /&gt;
* [[CSC/ECE 517 Summer 2008]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2010]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2011]]&lt;br /&gt;
* [[Object-Oriented Design and Programming]]&lt;br /&gt;
* [[ECE 633]]&lt;br /&gt;
* [[KCU]]&lt;br /&gt;
* [[Progress reports]]&lt;br /&gt;
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]&lt;br /&gt;
* [[Using git and github for projects]]&lt;br /&gt;
* [[Using heroku to deploy your projects]]&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Desert.jpg&amp;diff=46898</id>
		<title>File:Desert.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Desert.jpg&amp;diff=46898"/>
		<updated>2011-09-07T21:06:07Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=43469</id>
		<title>CSC/ECE 517 Fall 2010/ch6 6f ag</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=43469"/>
		<updated>2010-12-12T22:35:54Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Interface Segregation Principle&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Design phase is a very important phase in the entire process of [http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle] object-oriented software development. The need for a good design of software is to accommodate change into the software, a definite attribute of any software. For the benefit of the developers of these software, certain principles are laid out which ensure that the outcome of development phase is an easily manageable software rather than a rigid and fragile software. The principles of object-oriented software development are listed differently in different sources. The most commonly accepted and recognized is the [http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29]SOLID object oriented principles. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; SRP- The Single Responsibility Principle - A class should have one, and only one, reason to change.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; OCP- The Open Closed Principle - You should be able to extend a classes behavior, without modifying it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; LSP- The Liskov Substitution Principle - Derived classes must be substitutable for their base classes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DIP- The Dependency Inversion Principle- Depend on abstractions, not on concretions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; ISP- The Interface Segregation Principle- Make fine grained interfaces that are client specific.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this chapter we focus on Interface segregation principle (ISP).&lt;br /&gt;
&lt;br /&gt;
==Interface Segregation Principle==&lt;br /&gt;
Interface Segregation Principle emphasizes on&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;MANY CLIENT SPECIFIC INTERFACES ARE BETTER THAN ONE GENERAL PURPOSE INTERFACE&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DON'T USE.[http://www.objectmentor.com/resources/articles/isp.pdf]&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Good OO design is characterized by high cohesion and low coupling. This principle deals with high cohesion in designing interfaces.&lt;br /&gt;
&lt;br /&gt;
==Implications of the emphasis==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This principle provides guidelines to write our interfaces. When we write interfaces we should avoid the temptation to bunch together several different methods in one interface. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The interfaces that are designed should not be fat, i.e the interface should not have too many methods which often do not get used together. &lt;br /&gt;
The idea here is to avoid loading all the methods into a single interface, instead segregate the methods in the interface such that all the methods that contribute towards offering a single type of service (or single type of clients) are grouped under one single interface.  Thereby dealing with a bulky interface that might be difficult to manage is avoided.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
The interface should be specific. The methods in the interface should be the ones that contribute towards offering only a specific type of service. For example, if there is an interface that offers methods that provide mathematical services to its clients, then the same interface should not contain methods that accomplish totally different types of tasks say, like a database functionality implementation.&lt;br /&gt;
&amp;lt;p&amp;gt;The main reason behind such interfaces being discouraged is that if a class decides to (or has to) implement that interface, then, it has to provide an implementation even for those methods that it doesn’t intend to use. Even though such implementations may be empty methods, it is not convenient and also distorts the readability of the code.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results of following ISP==&lt;br /&gt;
Designing software by adopting ISP will yield many simple interfaces that are more specific in nature which in turn will make the classes more cohesive.&lt;br /&gt;
==How ISP can be implemented in the design==&lt;br /&gt;
===Segregation through Delegation===&lt;br /&gt;
The object form of the ADAPTER Pattern can be used to delegate the responsibility of implementing the thin interface to the class that is the client of the interface.&lt;br /&gt;
===Segregation through multiple inheritance===&lt;br /&gt;
The methods that are to be included into the interfaces are grouped into interfaces such that all the methods in the interface are directed towards accomplishing a certain type of service. When a class has to use the methods in the interface, it has to implement the interface. When the class is required to implement methods from many interfaces, the class will have to inherit multiple light interfaces and also implement the methods in the interfaces.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Consider an example of Course registration system which allows students to enroll in courses, similar to the one we have at NCSU.&lt;br /&gt;
Let us assume we have a student base class which other specialized student classes inherit from.&lt;br /&gt;
&lt;br /&gt;
A full time student is allowed to register for a class. He can also choose to audit a particular class.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an interface called IEnroll. &lt;br /&gt;
The IEnroll interface exposes two methods viz. registerClass() which should allow a student to register himself for a class, and auditClass() which allows a student to audit a class he has registered for.&lt;br /&gt;
The FullStudent class is used to represent full time students. It extends the Student class and implements this IEnroll interface.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 1Class diagram for FullStudent (violates ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 interface IEnroll {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
    public void auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now lets suppose, NCSU decided not to allow part time students to audit a class once they have registered.&lt;br /&gt;
The PartStudent class represents the part time students. It extends the Student class.&lt;br /&gt;
Now PartStudent class can either implement IEnroll to provide the registration facility. But in that case, PartStudent is forced to implement the auditClass method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 2Class diagram for PartStudent (violates ISP).png ]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //do nothing since we didn't want this method in the first place!&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The other option is to define a new interface with just registClass method and use it in PartStudent class. But this defeats the purpose of having a common interface.&lt;br /&gt;
&lt;br /&gt;
This is a good example of how our interface has become 'Fat' or 'Polluted'. It is exposing 2 different methods which its clients are forced to honor. This violates the ISP.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can correct this.&lt;br /&gt;
&lt;br /&gt;
We separate out the 2 functions into different interfaces now,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 interface IRegisterClass {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
 }&lt;br /&gt;
 interface IAuditClass {&lt;br /&gt;
    public auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This allows the FullStudent and PartStudent to be defined as following:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 3Class diagram for FullStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IRegisterClass, IAuditClass&lt;br /&gt;
 {	&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 4Class diagram for PartStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IRegisterClass&lt;br /&gt;
 {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
This gives a clean and correct way in which the PartStudent class is not forced to depend on an interface it does not want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
#Fat Interfaces are the interfaces that are not specific to a single client. Fat interfaces lead to unintended couplings between clients that ought otherwise to be isolated. By making use of the ADAPTER pattern, through multiple inheritance (class form), fat interfaces can be segregated into abstract base classes that resolve the unwanted coupling between clients. Thus maintaining loose coupling and high cohesion, which is an essential attribute of good software design.&lt;br /&gt;
#Interfaces containing methods that are not specific to a particular type of service are called polluted or fat interfaces. These must be avoided.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
#[http://www.oodesign.com/design-principles.html Design principles]&lt;br /&gt;
#[http://java.sys-con.com/node/84633/print Three Sources of a Solid Object-Oriented Design]&lt;br /&gt;
#[http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Principles of OOD]&lt;br /&gt;
#[http://www.hanselminutes.com/default.aspx?showID=163 Hanselminutes episode on SOLID]&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com/resources/articles/isp.pdf The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com Design Principles and Design Patterns, Robert C Martin]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://ontwik.com/ruby/sandi-metz-solid-object-oriented-design/ 2009 Gotham Ruby Conference, presentation on SOLID Object Oriented Design by Sandi Metz, Duke University.]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.oodesign.com/interface-segregation-principle.html The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=43468</id>
		<title>CSC/ECE 517 Fall 2010/ch6 6f ag</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=43468"/>
		<updated>2010-12-12T22:34:40Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Interface Segregation Principle&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Design phase is a very important phase in the entire process of [http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle] object-oriented software development. The need for a good design of software is to accommodate change into the software, a definite attribute of any software. For the benefit of the developers of these software, certain principles are laid out which ensure that the outcome of development phase is an easily manageable software rather than a rigid and fragile software. The principles of object-oriented software development are listed differently in different sources. The most commonly accepted and recognized is the [http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29]SOLID object oriented principles. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; SRP- The Single Responsibility Principle - A class should have one, and only one, reason to change.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; OCP- The Open Closed Principle - You should be able to extend a classes behavior, without modifying it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; LSP- The Liskov Substitution Principle - Derived classes must be substitutable for their base classes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DIP- The Dependency Inversion Principle- Depend on abstractions, not on concretions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; ISP- The Interface Segregation Principle- Make fine grained interfaces that are client specific.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this chapter we focus on Interface segregation principle (ISP).&lt;br /&gt;
&lt;br /&gt;
==Interface Segregation Principle==&lt;br /&gt;
Interface Segregation Principle emphasizes on&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;MANY CLIENT SPECIFIC INTERFACES ARE BETTER THAN ONE GENERAL PURPOSE INTERFACE&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DON'T USE.[http://www.objectmentor.com/resources/articles/isp.pdf 1]&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Good OO design is characterized by high cohesion and low coupling. This principle deals with high cohesion in designing interfaces.&lt;br /&gt;
&lt;br /&gt;
==Implications of the emphasis==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This principle provides guidelines to write our interfaces. When we write interfaces we should avoid the temptation to bunch together several different methods in one interface. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The interfaces that are designed should not be fat, i.e the interface should not have too many methods which often do not get used together. &lt;br /&gt;
The idea here is to avoid loading all the methods into a single interface, instead segregate the methods in the interface such that all the methods that contribute towards offering a single type of service (or single type of clients) are grouped under one single interface.  Thereby dealing with a bulky interface that might be difficult to manage is avoided.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
The interface should be specific. The methods in the interface should be the ones that contribute towards offering only a specific type of service. For example, if there is an interface that offers methods that provide mathematical services to its clients, then the same interface should not contain methods that accomplish totally different types of tasks say, like a database functionality implementation.&lt;br /&gt;
&amp;lt;p&amp;gt;The main reason behind such interfaces being discouraged is that if a class decides to (or has to) implement that interface, then, it has to provide an implementation even for those methods that it doesn’t intend to use. Even though such implementations may be empty methods, it is not convenient and also distorts the readability of the code.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results of following ISP==&lt;br /&gt;
Designing software by adopting ISP will yield many simple interfaces that are more specific in nature which in turn will make the classes more cohesive.&lt;br /&gt;
==How ISP can be implemented in the design==&lt;br /&gt;
===Segregation through Delegation===&lt;br /&gt;
The object form of the ADAPTER Pattern can be used to delegate the responsibility of implementing the thin interface to the class that is the client of the interface.&lt;br /&gt;
===Segregation through multiple inheritance===&lt;br /&gt;
The methods that are to be included into the interfaces are grouped into interfaces such that all the methods in the interface are directed towards accomplishing a certain type of service. When a class has to use the methods in the interface, it has to implement the interface. When the class is required to implement methods from many interfaces, the class will have to inherit multiple light interfaces and also implement the methods in the interfaces.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Consider an example of Course registration system which allows students to enroll in courses, similar to the one we have at NCSU.&lt;br /&gt;
Let us assume we have a student base class which other specialized student classes inherit from.&lt;br /&gt;
&lt;br /&gt;
A full time student is allowed to register for a class. He can also choose to audit a particular class.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an interface called IEnroll. &lt;br /&gt;
The IEnroll interface exposes two methods viz. registerClass() which should allow a student to register himself for a class, and auditClass() which allows a student to audit a class he has registered for.&lt;br /&gt;
The FullStudent class is used to represent full time students. It extends the Student class and implements this IEnroll interface.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 1Class diagram for FullStudent (violates ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 interface IEnroll {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
    public void auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now lets suppose, NCSU decided not to allow part time students to audit a class once they have registered.&lt;br /&gt;
The PartStudent class represents the part time students. It extends the Student class.&lt;br /&gt;
Now PartStudent class can either implement IEnroll to provide the registration facility. But in that case, PartStudent is forced to implement the auditClass method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 2Class diagram for PartStudent (violates ISP).png ]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //do nothing since we didn't want this method in the first place!&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The other option is to define a new interface with just registClass method and use it in PartStudent class. But this defeats the purpose of having a common interface.&lt;br /&gt;
&lt;br /&gt;
This is a good example of how our interface has become 'Fat' or 'Polluted'. It is exposing 2 different methods which its clients are forced to honor. This violates the ISP.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can correct this.&lt;br /&gt;
&lt;br /&gt;
We separate out the 2 functions into different interfaces now,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 interface IRegisterClass {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
 }&lt;br /&gt;
 interface IAuditClass {&lt;br /&gt;
    public auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This allows the FullStudent and PartStudent to be defined as following:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 3Class diagram for FullStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IRegisterClass, IAuditClass&lt;br /&gt;
 {	&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 4Class diagram for PartStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IRegisterClass&lt;br /&gt;
 {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
This gives a clean and correct way in which the PartStudent class is not forced to depend on an interface it does not want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
#Fat Interfaces are the interfaces that are not specific to a single client. Fat interfaces lead to unintended couplings between clients that ought otherwise to be isolated. By making use of the ADAPTER pattern, through multiple inheritance (class form), fat interfaces can be segregated into abstract base classes that resolve the unwanted coupling between clients. Thus maintaining loose coupling and high cohesion, which is an essential attribute of good software design.&lt;br /&gt;
#Interfaces containing methods that are not specific to a particular type of service are called polluted or fat interfaces. These must be avoided.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
#[http://www.oodesign.com/design-principles.html Design principles]&lt;br /&gt;
#[http://java.sys-con.com/node/84633/print Three Sources of a Solid Object-Oriented Design]&lt;br /&gt;
#[http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Principles of OOD]&lt;br /&gt;
#[http://www.hanselminutes.com/default.aspx?showID=163 Hanselminutes episode on SOLID]&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com/resources/articles/isp.pdf The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com Design Principles and Design Patterns, Robert C Martin]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://ontwik.com/ruby/sandi-metz-solid-object-oriented-design/ 2009 Gotham Ruby Conference, presentation on SOLID Object Oriented Design by Sandi Metz, Duke University.]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.oodesign.com/interface-segregation-principle.html The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41695</id>
		<title>CSC/ECE 517 Fall 2010/ch6 6f ag</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41695"/>
		<updated>2010-11-18T00:16:20Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: /* External References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Interface Segregation Principle&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Design phase is a very important phase in the entire process of [http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle] object-oriented software development. The need for a good design of software is to accommodate change into the software, a definite attribute of any software. For the benefit of the developers of these software, certain principles are laid out which ensure that the outcome of development phase is an easily manageable software rather than a rigid and fragile software. The principles of object-oriented software development are listed differently in different sources. The most commonly accepted and recognized is the [http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29]SOLID object oriented principles. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; SRP- The Single Responsibility Principle - A class should have one, and only one, reason to change.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; OCP- The Open Closed Principle - You should be able to extend a classes behavior, without modifying it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; LSP- The Liskov Substitution Principle - Derived classes must be substitutable for their base classes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DIP- The Dependency Inversion Principle- Depend on abstractions, not on concretions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; ISP- The Interface Segregation Principle- Make fine grained interfaces that are client specific.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this chapter we focus on Interface segregation principle (ISP).&lt;br /&gt;
&lt;br /&gt;
==Interface Segregation Principle==&lt;br /&gt;
Interface Segregation Principle emphasizes on&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;MANY CLIENT SPECIFIC INTERFACES ARE BETTER THAN ONE GENERAL PURPOSE INTERFACE&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DON'T USE.&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Good OO design is characterized by high cohesion and low coupling. This principle deals with high cohesion in designing interfaces.&lt;br /&gt;
&lt;br /&gt;
==Implications of the emphasis==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This principle provides guidelines to write our interfaces. When we write interfaces we should avoid the temptation to bunch together several different methods in one interface. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The interfaces that are designed should not be fat, i.e the interface should not have too many methods which often do not get used together. &lt;br /&gt;
The idea here is to avoid loading all the methods into a single interface, instead segregate the methods in the interface such that all the methods that contribute towards offering a single type of service (or single type of clients) are grouped under one single interface.  Thereby dealing with a bulky interface that might be difficult to manage is avoided.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
The interface should be specific. The methods in the interface should be the ones that contribute towards offering only a specific type of service. For example, if there is an interface that offers methods that provide mathematical services to its clients, then the same interface should not contain methods that accomplish totally different types of tasks say, like a database functionality implementation.&lt;br /&gt;
&amp;lt;p&amp;gt;The main reason behind such interfaces being discouraged is that if a class decides to (or has to) implement that interface, then, it has to provide an implementation even for those methods that it doesn’t intend to use. Even though such implementations may be empty methods, it is not convenient and also distorts the readability of the code.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results of following ISP==&lt;br /&gt;
Designing software by adopting ISP will yield many simple interfaces that are more specific in nature which in turn will make the classes more cohesive.&lt;br /&gt;
==How ISP can be implemented in the design==&lt;br /&gt;
===Segregation through Delegation===&lt;br /&gt;
The object form of the ADAPTER Pattern can be used to delegate the responsibility of implementing the thin interface to the class that is the client of the interface.&lt;br /&gt;
===Segregation through multiple inheritance===&lt;br /&gt;
The methods that are to be included into the interfaces are grouped into interfaces such that all the methods in the interface are directed towards accomplishing a certain type of service. When a class has to use the methods in the interface, it has to implement the interface. When the class is required to implement methods from many interfaces, the class will have to inherit multiple light interfaces and also implement the methods in the interfaces.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Consider an example of Course registration system which allows students to enroll in courses, similar to the one we have at NCSU.&lt;br /&gt;
Let us assume we have a student base class which other specialized student classes inherit from.&lt;br /&gt;
&lt;br /&gt;
A full time student is allowed to register for a class. He can also choose to audit a particular class.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an interface called IEnroll. &lt;br /&gt;
The IEnroll interface exposes two methods viz. registerClass() which should allow a student to register himself for a class, and auditClass() which allows a student to audit a class he has registered for.&lt;br /&gt;
The FullStudent class is used to represent full time students. It extends the Student class and implements this IEnroll interface.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 1Class diagram for FullStudent (violates ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 interface IEnroll {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
    public void auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now lets suppose, NCSU decided not to allow part time students to audit a class once they have registered.&lt;br /&gt;
The PartStudent class represents the part time students. It extends the Student class.&lt;br /&gt;
Now PartStudent class can either implement IEnroll to provide the registration facility. But in that case, PartStudent is forced to implement the auditClass method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 2Class diagram for PartStudent (violates ISP).png ]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //do nothing since we didn't want this method in the first place!&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The other option is to define a new interface with just registClass method and use it in PartStudent class. But this defeats the purpose of having a common interface.&lt;br /&gt;
&lt;br /&gt;
This is a good example of how our interface has become 'Fat' or 'Polluted'. It is exposing 2 different methods which its clients are forced to honor. This violates the ISP.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can correct this.&lt;br /&gt;
&lt;br /&gt;
We separate out the 2 functions into different interfaces now,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 interface IRegisterClass {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
 }&lt;br /&gt;
 interface IAuditClass {&lt;br /&gt;
    public auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This allows the FullStudent and PartStudent to be defined as following:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 3Class diagram for FullStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IRegisterClass, IAuditClass&lt;br /&gt;
 {	&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 4Class diagram for PartStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IRegisterClass&lt;br /&gt;
 {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
This gives a clean and correct way in which the PartStudent class is not forced to depend on an interface it does not want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
#Fat Interfaces are the interfaces that are not specific to a single client. Fat interfaces lead to unintended couplings between clients that ought otherwise to be isolated. By making use of the ADAPTER pattern, through multiple inheritance (class form), fat interfaces can be segregated into abstract base classes that resolve the unwanted coupling between clients. Thus maintaining loose coupling and high cohesion, which is an essential attribute of good software design.&lt;br /&gt;
#Interfaces containing methods that are not specific to a particular type of service are called polluted or fat interfaces. These must be avoided.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
#[http://www.oodesign.com/design-principles.html Design principles]&lt;br /&gt;
#[http://java.sys-con.com/node/84633/print Three Sources of a Solid Object-Oriented Design]&lt;br /&gt;
#[http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Principles of OOD]&lt;br /&gt;
#[http://www.hanselminutes.com/default.aspx?showID=163 Hanselminutes episode on SOLID]&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com/resources/articles/isp.pdf The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com Design Principles and Design Patterns, Robert C Martin]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://ontwik.com/ruby/sandi-metz-solid-object-oriented-design/ 2009 Gotham Ruby Conference, presentation on SOLID Object Oriented Design by Sandi Metz, Duke University.]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.oodesign.com/interface-segregation-principle.html The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41691</id>
		<title>CSC/ECE 517 Fall 2010/ch6 6f ag</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41691"/>
		<updated>2010-11-18T00:13:40Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: /* Interface Segregation Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Interface Segregation Principle&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Design phase is a very important phase in the entire process of [http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle] object-oriented software development. The need for a good design of software is to accommodate change into the software, a definite attribute of any software. For the benefit of the developers of these software, certain principles are laid out which ensure that the outcome of development phase is an easily manageable software rather than a rigid and fragile software. The principles of object-oriented software development are listed differently in different sources. The most commonly accepted and recognized is the [http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29]SOLID object oriented principles. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; SRP- The Single Responsibility Principle - A class should have one, and only one, reason to change.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; OCP- The Open Closed Principle - You should be able to extend a classes behavior, without modifying it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; LSP- The Liskov Substitution Principle - Derived classes must be substitutable for their base classes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DIP- The Dependency Inversion Principle- Depend on abstractions, not on concretions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; ISP- The Interface Segregation Principle- Make fine grained interfaces that are client specific.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this chapter we focus on Interface segregation principle (ISP).&lt;br /&gt;
&lt;br /&gt;
==Interface Segregation Principle==&lt;br /&gt;
Interface Segregation Principle emphasizes on&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;MANY CLIENT SPECIFIC INTERFACES ARE BETTER THAN ONE GENERAL PURPOSE INTERFACE&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DON'T USE.&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
Good OO design is characterized by high cohesion and low coupling. This principle deals with high cohesion in designing interfaces.&lt;br /&gt;
&lt;br /&gt;
==Implications of the emphasis==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This principle provides guidelines to write our interfaces. When we write interfaces we should avoid the temptation to bunch together several different methods in one interface. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The interfaces that are designed should not be fat, i.e the interface should not have too many methods which often do not get used together. &lt;br /&gt;
The idea here is to avoid loading all the methods into a single interface, instead segregate the methods in the interface such that all the methods that contribute towards offering a single type of service (or single type of clients) are grouped under one single interface.  Thereby dealing with a bulky interface that might be difficult to manage is avoided.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
The interface should be specific. The methods in the interface should be the ones that contribute towards offering only a specific type of service. For example, if there is an interface that offers methods that provide mathematical services to its clients, then the same interface should not contain methods that accomplish totally different types of tasks say, like a database functionality implementation.&lt;br /&gt;
&amp;lt;p&amp;gt;The main reason behind such interfaces being discouraged is that if a class decides to (or has to) implement that interface, then, it has to provide an implementation even for those methods that it doesn’t intend to use. Even though such implementations may be empty methods, it is not convenient and also distorts the readability of the code.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results of following ISP==&lt;br /&gt;
Designing software by adopting ISP will yield many simple interfaces that are more specific in nature which in turn will make the classes more cohesive.&lt;br /&gt;
==How ISP can be implemented in the design==&lt;br /&gt;
===Segregation through Delegation===&lt;br /&gt;
The object form of the ADAPTER Pattern can be used to delegate the responsibility of implementing the thin interface to the class that is the client of the interface.&lt;br /&gt;
===Segregation through multiple inheritance===&lt;br /&gt;
The methods that are to be included into the interfaces are grouped into interfaces such that all the methods in the interface are directed towards accomplishing a certain type of service. When a class has to use the methods in the interface, it has to implement the interface. When the class is required to implement methods from many interfaces, the class will have to inherit multiple light interfaces and also implement the methods in the interfaces.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Consider an example of Course registration system which allows students to enroll in courses, similar to the one we have at NCSU.&lt;br /&gt;
Let us assume we have a student base class which other specialized student classes inherit from.&lt;br /&gt;
&lt;br /&gt;
A full time student is allowed to register for a class. He can also choose to audit a particular class.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an interface called IEnroll. &lt;br /&gt;
The IEnroll interface exposes two methods viz. registerClass() which should allow a student to register himself for a class, and auditClass() which allows a student to audit a class he has registered for.&lt;br /&gt;
The FullStudent class is used to represent full time students. It extends the Student class and implements this IEnroll interface.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 1Class diagram for FullStudent (violates ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 interface IEnroll {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
    public void auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now lets suppose, NCSU decided not to allow part time students to audit a class once they have registered.&lt;br /&gt;
The PartStudent class represents the part time students. It extends the Student class.&lt;br /&gt;
Now PartStudent class can either implement IEnroll to provide the registration facility. But in that case, PartStudent is forced to implement the auditClass method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 2Class diagram for PartStudent (violates ISP).png ]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //do nothing since we didn't want this method in the first place!&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The other option is to define a new interface with just registClass method and use it in PartStudent class. But this defeats the purpose of having a common interface.&lt;br /&gt;
&lt;br /&gt;
This is a good example of how our interface has become 'Fat' or 'Polluted'. It is exposing 2 different methods which its clients are forced to honor. This violates the ISP.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can correct this.&lt;br /&gt;
&lt;br /&gt;
We separate out the 2 functions into different interfaces now,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 interface IRegisterClass {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
 }&lt;br /&gt;
 interface IAuditClass {&lt;br /&gt;
    public auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This allows the FullStudent and PartStudent to be defined as following:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 3Class diagram for FullStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IRegisterClass, IAuditClass&lt;br /&gt;
 {	&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 4Class diagram for PartStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IRegisterClass&lt;br /&gt;
 {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
This gives a clean and correct way in which the PartStudent class is not forced to depend on an interface it does not want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
#Fat Interfaces are the interfaces that are not specific to a single client. Fat interfaces lead to unintended couplings between clients that ought otherwise to be isolated. By making use of the ADAPTER pattern, through multiple inheritance (class form), fat interfaces can be segregated into abstract base classes that resolve the unwanted coupling between clients. Thus maintaining loose coupling and high cohesion, which is an essential attribute of good software design.&lt;br /&gt;
#Interfaces containing methods that are not specific to a particular type of service are called polluted or fat interfaces. These must be avoided.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
#[http://www.oodesign.com/design-principles.html Design principles]&lt;br /&gt;
#[http://java.sys-con.com/node/84633/print Three Sources of a Solid Object-Oriented Design]&lt;br /&gt;
#[http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Principles of OOD]&lt;br /&gt;
#[http://www.hanselminutes.com/default.aspx?showID=163 Hanselminutes episode on SOLID]&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com/resources/articles/isp.pdf The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com Design Principles and Design Patterns, Robert C Martin]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://ontwik.com/ruby/sandi-metz-solid-object-oriented-design/ 2009 Gotham Ruby Conference, presentation on SOLID Object Oriented Design by Sandi Metz, Duke University.]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41680</id>
		<title>CSC/ECE 517 Fall 2010/ch6 6f ag</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch6_6f_ag&amp;diff=41680"/>
		<updated>2010-11-18T00:07:50Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: /* Implications of the emphasis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Interface Segregation Principle&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Design phase is a very important phase in the entire process of [http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle] object-oriented software development. The need for a good design of software is to accommodate change into the software, a definite attribute of any software. For the benefit of the developers of these software, certain principles are laid out which ensure that the outcome of development phase is an easily manageable software rather than a rigid and fragile software. The principles of object-oriented software development are listed differently in different sources. The most commonly accepted and recognized is the [http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29]SOLID object oriented principles. &lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; SRP- The Single Responsibility Principle - A class should have one, and only one, reason to change.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; OCP- The Open Closed Principle - You should be able to extend a classes behavior, without modifying it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; LSP- The Liskov Substitution Principle - Derived classes must be substitutable for their base classes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; DIP- The Dependency Inversion Principle- Depend on abstractions, not on concretions.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; ISP- The Interface Segregation Principle- Make fine grained interfaces that are client specific.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this chapter we focus on Interface segregation principle (ISP).&lt;br /&gt;
&lt;br /&gt;
==Interface Segregation Principle==&lt;br /&gt;
Interface Segregation Principle emphasizes on&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;MANY CLIENT SPECIFIC INTERFACES ARE BETTER THAN ONE GENERAL PURPOSE INTERFACE&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;i&amp;gt;CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DON'T USE.&amp;lt;/i&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
==Implications of the emphasis==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This principle provides guidelines to write our interfaces. When we write interfaces we should avoid the temptation to bunch together several different methods in one interface. If we add methods that should not be there the classes implementing the interface will have to implement those methods as well.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The interfaces that are designed should not be fat, i.e the interface should not have too many methods which often do not get used together. &lt;br /&gt;
The idea here is to avoid loading all the methods into a single interface, instead segregate the methods in the interface such that all the methods that contribute towards offering a single type of service (or single type of clients) are grouped under one single interface.  Thereby dealing with a bulky interface that might be difficult to manage is avoided.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
The interface should be specific. The methods in the interface should be the ones that contribute towards offering only a specific type of service. For example, if there is an interface that offers methods that provide mathematical services to its clients, then the same interface should not contain methods that accomplish totally different types of tasks say, like a database functionality implementation.&lt;br /&gt;
&amp;lt;p&amp;gt;The main reason behind such interfaces being discouraged is that if a class decides to (or has to) implement that interface, then, it has to provide an implementation even for those methods that it doesn’t intend to use. Even though such implementations may be empty methods, it is not convenient and also distorts the readability of the code.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Results of following ISP==&lt;br /&gt;
Designing software by adopting ISP will yield many simple interfaces that are more specific in nature which in turn will make the classes more cohesive.&lt;br /&gt;
==How ISP can be implemented in the design==&lt;br /&gt;
===Segregation through Delegation===&lt;br /&gt;
The object form of the ADAPTER Pattern can be used to delegate the responsibility of implementing the thin interface to the class that is the client of the interface.&lt;br /&gt;
===Segregation through multiple inheritance===&lt;br /&gt;
The methods that are to be included into the interfaces are grouped into interfaces such that all the methods in the interface are directed towards accomplishing a certain type of service. When a class has to use the methods in the interface, it has to implement the interface. When the class is required to implement methods from many interfaces, the class will have to inherit multiple light interfaces and also implement the methods in the interfaces.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Consider an example of Course registration system which allows students to enroll in courses, similar to the one we have at NCSU.&lt;br /&gt;
Let us assume we have a student base class which other specialized student classes inherit from.&lt;br /&gt;
&lt;br /&gt;
A full time student is allowed to register for a class. He can also choose to audit a particular class.&lt;br /&gt;
&lt;br /&gt;
Lets say we have an interface called IEnroll. &lt;br /&gt;
The IEnroll interface exposes two methods viz. registerClass() which should allow a student to register himself for a class, and auditClass() which allows a student to audit a class he has registered for.&lt;br /&gt;
The FullStudent class is used to represent full time students. It extends the Student class and implements this IEnroll interface.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 1Class diagram for FullStudent (violates ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 interface IEnroll {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
    public void auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now lets suppose, NCSU decided not to allow part time students to audit a class once they have registered.&lt;br /&gt;
The PartStudent class represents the part time students. It extends the Student class.&lt;br /&gt;
Now PartStudent class can either implement IEnroll to provide the registration facility. But in that case, PartStudent is forced to implement the auditClass method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 2Class diagram for PartStudent (violates ISP).png ]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IEnroll {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
        //do nothing since we didn't want this method in the first place!&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The other option is to define a new interface with just registClass method and use it in PartStudent class. But this defeats the purpose of having a common interface.&lt;br /&gt;
&lt;br /&gt;
This is a good example of how our interface has become 'Fat' or 'Polluted'. It is exposing 2 different methods which its clients are forced to honor. This violates the ISP.&lt;br /&gt;
&lt;br /&gt;
Lets see how we can correct this.&lt;br /&gt;
&lt;br /&gt;
We separate out the 2 functions into different interfaces now,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 interface IRegisterClass {&lt;br /&gt;
    public void registerClass();&lt;br /&gt;
 }&lt;br /&gt;
 interface IAuditClass {&lt;br /&gt;
    public auditClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This allows the FullStudent and PartStudent to be defined as following:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 3Class diagram for FullStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 class FullStudent extends Student implements IRegisterClass, IAuditClass&lt;br /&gt;
 {	&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
    public void auditClass()&lt;br /&gt;
    {&lt;br /&gt;
       //allow a student to audit an enrolled class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Image:Figure 4Class diagram for PartStudent (conforms to ISP).png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
 class PartStudent extends Student implements IRegisterClass&lt;br /&gt;
 {&lt;br /&gt;
    public void registerClass()&lt;br /&gt;
    {&lt;br /&gt;
        //allow a student to register for a particular class&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
This gives a clean and correct way in which the PartStudent class is not forced to depend on an interface it does not want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
#Fat Interfaces are the interfaces that are not specific to a single client. Fat interfaces lead to unintended couplings between clients that ought otherwise to be isolated. By making use of the ADAPTER pattern, through multiple inheritance (class form), fat interfaces can be segregated into abstract base classes that resolve the unwanted coupling between clients. Thus maintaining loose coupling and high cohesion, which is an essential attribute of good software design.&lt;br /&gt;
#Interfaces containing methods that are not specific to a particular type of service are called polluted or fat interfaces. These must be avoided.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
#[http://www.oodesign.com/design-principles.html Design principles]&lt;br /&gt;
#[http://java.sys-con.com/node/84633/print Three Sources of a Solid Object-Oriented Design]&lt;br /&gt;
#[http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Principles of OOD]&lt;br /&gt;
#[http://www.hanselminutes.com/default.aspx?showID=163 Hanselminutes episode on SOLID]&lt;br /&gt;
&lt;br /&gt;
==External References==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com/resources/articles/isp.pdf The Interface Segregation Principle]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://www.objectmentor.com Design Principles and Design Patterns, Robert C Martin]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; [http://ontwik.com/ruby/sandi-metz-solid-object-oriented-design/ 2009 Gotham Ruby Conference, presentation on SOLID Object Oriented Design by Sandi Metz, Duke University.]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch2_2d_dg&amp;diff=36256</id>
		<title>CSC/ECE 517 Fall 2010/ch2 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch2_2d_dg&amp;diff=36256"/>
		<updated>2010-09-23T01:07:25Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;font-size:20pt&amp;quot;&amp;gt;Scaffolding in Web Application Frameworks&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
=Overview=&lt;br /&gt;
==Scaffolding in General==&lt;br /&gt;
&lt;br /&gt;
Scaffolding in education is basically the support a teacher gives to a new student to get him started on his subject. Scaffolding is also the temporary structure often used by workers in construction. &lt;br /&gt;
So what we know of the word scaffolding in real world – a temporary structure to lean on while you build the main structure. The temporary structure can then be discarded.&lt;br /&gt;
&lt;br /&gt;
==Scaffolding in Programming==&lt;br /&gt;
&lt;br /&gt;
It is with the same basic idea that scaffolding in web programming frameworks refer to. It refers to a temporary structure, which is useful as a starting point for developing an application.&lt;br /&gt;
Scaffolding is nothing but a basic structure that helps a new programmer to get started quickly. It is meta-programming method to quickly generate a functioning web application with the CRUD functionality. Any web application that interacts with database has 4 basic functions generally called CRUD, which it always needs and these are: &lt;br /&gt;
&lt;br /&gt;
*	Create, &lt;br /&gt;
*	Read, &lt;br /&gt;
*	Update or &lt;br /&gt;
*	Delete a record. &lt;br /&gt;
&lt;br /&gt;
A scaffold will generate a functioning web application that allows you to carry out these functions. Usually you get a running web application with not more than a few lines of code. &lt;br /&gt;
It generates for you what is often termed as boilerplate code. In a MVC framework, scaffolding will usually create basic model, views and controllers and also the database objects needed. &lt;br /&gt;
&lt;br /&gt;
==Features of Scaffolding==&lt;br /&gt;
&lt;br /&gt;
In software applications, we need to use a number of frameworks to make application run. The frameworks may include:&lt;br /&gt;
&lt;br /&gt;
*	Database access&lt;br /&gt;
*	Screen design, and &lt;br /&gt;
*	Business rules&lt;br /&gt;
&lt;br /&gt;
And scaffolding is the mechanism by which we can create the skeletal of the web application at first go.&lt;br /&gt;
So, now after having some basic concept of scaffolding, we can list out the main features of scaffolding below,&lt;br /&gt;
 &lt;br /&gt;
*	It is a framework that provides the minimal setup of the components like database, application servers, and web servers.&lt;br /&gt;
*	When you want to use the structure early on in the development cycle when you are experimenting with the database schema and layout, it helps to quickly generate basic functional application for you directly from the database schema.&lt;br /&gt;
*	Scaffolding helps when the schema undergoes refinement and you don't need to waste your time to change the views and controllers explicitly to align with the change.&lt;br /&gt;
*	It isn't what you would like to use directly in your production systems, you can eventually make changes as you move on with your added and updated project requirements. &lt;br /&gt;
&lt;br /&gt;
=History of Scaffolding=&lt;br /&gt;
==Origin and Evolution==&lt;br /&gt;
===Scaffolding Theory===&lt;br /&gt;
&lt;br /&gt;
Scaffolding theory in education came into being in 1950, by, Jerome Bruner, where he described the various scaffolding techniques for oral language and written vocabulary. &lt;br /&gt;
In Oral scaffolding, parents and adults help the children to make them know how to speak and communicate, how they should use the words and develop the base or a temporary framework for their children to walk in the new world. And once the child secures the control over the things, the support can be taken away. Similarly, in written scaffolding, typical supporting instructions were given by the instructor to the students to learn vocabulary, to calibrate the task, to identify the task and work independently on the task, in this way they built the scaffold for them on which they can lean on while learning. &lt;br /&gt;
So children use oral scaffolding as a vehicle to communicate and written scaffolding as tool for new thinking. And the teacher’s instructions also get changed from time to time, starting from the directions, to suggestions, to encouragement, and then observation.&lt;br /&gt;
&lt;br /&gt;
===Scaffolding Origin in Web Applications===&lt;br /&gt;
&lt;br /&gt;
Scaffolding has been around in various forms for some time. Earlier, separate code generators were written, which would generate CRUD functionality for certain frameworks. They were often the third party generators which offered varying capabilities and mainly acted as database code generators. &lt;br /&gt;
&lt;br /&gt;
You could also have custom scripts, which could generate the CRUD screens from some database specifications. Often each new project involved writing up some templates to get the basic functionality or writing a template generator script, which created these templates for a project. But these generators and scripts were non-standardized and often viewed as taking time away from the core development of an application.&lt;br /&gt;
&lt;br /&gt;
==What Scaffolding is Today?==&lt;br /&gt;
===Current Scaffolding Scope===&lt;br /&gt;
&lt;br /&gt;
Scaffolding is now a part of many web application frameworks. We can find a number of development software’s that uses web application scaffolding approach. Frameworks include,			&lt;br /&gt;
&lt;br /&gt;
*Ruby on Rails, 	&lt;br /&gt;
*CakePHP , &lt;br /&gt;
*ASP.NET&lt;br /&gt;
*CodeIgniter  &lt;br /&gt;
*iPhone Web Scaffolding&lt;br /&gt;
*Grails &lt;br /&gt;
&lt;br /&gt;
These frameworks actually contain some software components that create the skeletal attachments to the application’s database and other external devices.&lt;br /&gt;
We will see how this scaffolding works in some of the frameworks described above in next few paragraphs.&lt;br /&gt;
&lt;br /&gt;
===Benefits of Scaffolding===&lt;br /&gt;
&lt;br /&gt;
We have noticed that scaffolding makes the developers job easier, and rather than making a lot of configuration changes at the very first time or may be at the time of updations, he can concentrate on the business logic of the application, which saves lot of time that he may have spent in creating and maintaining the database code. So you can read out the benefits of Scaffolding below,&lt;br /&gt;
&lt;br /&gt;
*It acts as a tool for the developers to quickly generate running web application environment for the Internet.&lt;br /&gt;
*It provides modular stubs to perform typical CRUD implementations.&lt;br /&gt;
*It improves development productivity for system architects.&lt;br /&gt;
*It improves efficiency by creating reusable components for developers by using frameworks and code generators.&lt;br /&gt;
&lt;br /&gt;
=Scaffolding in MVC based Web Frameworks=&lt;br /&gt;
&lt;br /&gt;
First we will describe how the scaffolding approach works in Rails framework. Scaffolding gets its popularity with the rails framework only, and it comes as the inbuilt feature of the rails framework.&lt;br /&gt;
&lt;br /&gt;
==Scaffolding in Rails Framework==&lt;br /&gt;
&lt;br /&gt;
Now lets see how scaffolding in the rails framework helps to create the database schema at the start of an application by using very simple commands.&lt;br /&gt;
Rails scaffolding helps to create model, view and controllers for the new resource in a single operation.&lt;br /&gt;
Follow these steps in the [http://www.eclipse.org/  Eclipse IDE] to create a scaffolding of a car website. We just define some attributes of a car like its color, year and model.&lt;br /&gt;
&lt;br /&gt;
Step -1.	Create New Rails Project: New-&amp;gt;New Rails Project&lt;br /&gt;
&lt;br /&gt;
Step -2.	Get the generator view: Window-&amp;gt;Show View-&amp;gt;Generators&lt;br /&gt;
&lt;br /&gt;
Step -3.	Make sure current project for Generator is the project that you want.&lt;br /&gt;
&lt;br /&gt;
Step -4.	Select the scaffold generator from drop down box: Generator-&amp;gt;scaffold&lt;br /&gt;
&lt;br /&gt;
Step -5.	In parameters, specify the model, fields and their type&lt;br /&gt;
Here we take, Car color:string maker:string year:date&lt;br /&gt;
&lt;br /&gt;
Step -6.	This will run the generate script and create files in View, controllers, model, db etc as shown below: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;gt;script/generate scaffold Car color:string maker:string model:number year:date&lt;br /&gt;
&lt;br /&gt;
exists app/models/&lt;br /&gt;
exists app/controllers/&lt;br /&gt;
exists app/helpers/&lt;br /&gt;
create app/views/cars&lt;br /&gt;
exists app/views/layouts/&lt;br /&gt;
exists test/functional/&lt;br /&gt;
exists test/unit/&lt;br /&gt;
exists test/unit/helpers/&lt;br /&gt;
exists public/stylesheets/&lt;br /&gt;
create app/views/cars/index.html.erb&lt;br /&gt;
create app/views/cars/show.html.erb&lt;br /&gt;
create app/views/cars/new.html.erb&lt;br /&gt;
create app/views/cars/edit.html.erb&lt;br /&gt;
create app/views/layouts/cars.html.erb&lt;br /&gt;
create public/stylesheets/scaffold.css&lt;br /&gt;
create app/controllers/cars_controller.rb&lt;br /&gt;
create test/functional/cars_controller_test.rb&lt;br /&gt;
create app/helpers/cars_helper.rb&lt;br /&gt;
create test/unit/helpers/cars_helper_test.rb&lt;br /&gt;
route  map.resources :cars&lt;br /&gt;
dependency model&lt;br /&gt;
exists app/models/&lt;br /&gt;
exists test/unit/&lt;br /&gt;
exists test/fixtures/&lt;br /&gt;
create app/models/car.rb&lt;br /&gt;
create test/unit/car_test.rb&lt;br /&gt;
create test/fixtures/cars.yml&lt;br /&gt;
create db/migrate&lt;br /&gt;
create db/migrate/20100919144829_create_cars.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It creates the db migrate file for the given model.&lt;br /&gt;
This creates the schema in db/migrate/2002301293_create_cars.rb file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateCars &amp;lt; ActiveRecord::Migration&lt;br /&gt;
def self.up&lt;br /&gt;
create_table :cars do |t|&lt;br /&gt;
t.string :color&lt;br /&gt;
t.string :maker&lt;br /&gt;
t.number :model&lt;br /&gt;
t.date :year&lt;br /&gt;
t.timestamps&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def self.down&lt;br /&gt;
drop_table :cars&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Step -7	You then run a rake task to actually create the database tables using the migrate file.&lt;br /&gt;
&lt;br /&gt;
Step -8	Now go to Window-&amp;gt;Show View-&amp;gt;Rake&lt;br /&gt;
&lt;br /&gt;
Step -9	In the Rake window, select migrate task from the drop down box and run it.&lt;br /&gt;
&lt;br /&gt;
You can also right click the   &lt;br /&gt;
*	create_cars.rb file, &lt;br /&gt;
*	select the rake menu option and &lt;br /&gt;
*	then select migrate option.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 rake db:migrate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Step -10 	You can then go to your sqlite database and check that tables have been created.&lt;br /&gt;
&lt;br /&gt;
Scaffold will always generate the tables in the Development database.&lt;br /&gt;
With this you now have a functioning application. Start the web server and point your browser to http://localhost:3000/cars (unless you decided to override the defaults). You will be presented with a basic screen showing all the cars and their details. Links to web pages to add, edit and destroy a record are also provided. Using these, you can modify existing records or add new records.&lt;br /&gt;
Sample auto generated code for the above example is as below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller for car in cars_controller.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CarsController &amp;lt; ApplicationController&lt;br /&gt;
  # GET /cars&lt;br /&gt;
  # GET /cars.xml&lt;br /&gt;
  def index&lt;br /&gt;
    @cars = Car.all&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # index.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @cars }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /cars/1&lt;br /&gt;
  # GET /cars/1.xml&lt;br /&gt;
  def show&lt;br /&gt;
    @car = Car.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # show.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @car }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /cars/new&lt;br /&gt;
  # GET /cars/new.xml&lt;br /&gt;
  def new&lt;br /&gt;
    @car = Car.new&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html # new.html.erb&lt;br /&gt;
      format.xml  { render :xml =&amp;gt; @car }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # GET /cars/1/edit&lt;br /&gt;
  def edit&lt;br /&gt;
    @car = Car.find(params[:id])&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # POST /cars&lt;br /&gt;
  # POST /cars.xml&lt;br /&gt;
  def create&lt;br /&gt;
    @car = Car.new(params[:car])&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if @car.save&lt;br /&gt;
        format.html { redirect_to(@car, :notice =&amp;gt; 'Car was successfully created.') }&lt;br /&gt;
        format.xml  { render :xml =&amp;gt; @car, :status =&amp;gt; :created, :location =&amp;gt; @car }&lt;br /&gt;
      else&lt;br /&gt;
        format.html { render :action =&amp;gt; &amp;quot;new&amp;quot; }&lt;br /&gt;
        format.xml  { render :xml =&amp;gt; @car.errors, :status =&amp;gt; :unprocessable_entity }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # PUT /cars/1&lt;br /&gt;
  # PUT /cars/1.xml&lt;br /&gt;
  def update&lt;br /&gt;
    @car = Car.find(params[:id])&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      if @car.update_attributes(params[:car])&lt;br /&gt;
        format.html { redirect_to(@car, :notice =&amp;gt; 'Car was successfully updated.') }&lt;br /&gt;
        format.xml  { head :ok }&lt;br /&gt;
      else&lt;br /&gt;
        format.html { render :action =&amp;gt; &amp;quot;edit&amp;quot; }&lt;br /&gt;
        format.xml  { render :xml =&amp;gt; @car.errors, :status =&amp;gt; :unprocessable_entity }&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # DELETE /cars/1&lt;br /&gt;
  # DELETE /cars/1.xml&lt;br /&gt;
  def destroy&lt;br /&gt;
    @car = Car.find(params[:id])&lt;br /&gt;
    @car.destroy&lt;br /&gt;
&lt;br /&gt;
    respond_to do |format|&lt;br /&gt;
      format.html { redirect_to(cars_url) }&lt;br /&gt;
      format.xml  { head :ok }&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Sample view file for EDIT generated in views-&amp;gt;cars-&amp;gt;edit.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;Editing car&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;% form_for(@car) do |f| %&amp;gt;&lt;br /&gt;
  &amp;lt;%= f.error_messages %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.label :color %&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.text_field :color %&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.label :maker %&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.text_field :maker %&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.label :model %&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.text_field :model %&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.label :year %&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.date_select :year %&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;%= f.submit 'Update' %&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%= link_to 'Show', @car %&amp;gt; |&lt;br /&gt;
&amp;lt;%= link_to 'Back', cars_path %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Database migrate file generated in db-&amp;gt;migrate&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateCars &amp;lt; ActiveRecord::Migration&lt;br /&gt;
  def self.up&lt;br /&gt;
    create_table :cars do |t|&lt;br /&gt;
      t.string :color&lt;br /&gt;
      t.string :maker&lt;br /&gt;
      t.integer :model&lt;br /&gt;
      t.date :year&lt;br /&gt;
&lt;br /&gt;
      t.timestamps&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.down&lt;br /&gt;
    drop_table :cars&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Database schema generated in db-&amp;gt;schema.rb file&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ActiveRecord::Schema.define(:version =&amp;gt; 20100919144829) do&lt;br /&gt;
&lt;br /&gt;
  create_table &amp;quot;cars&amp;quot;, :force =&amp;gt; true do |t|&lt;br /&gt;
    t.string   &amp;quot;color&amp;quot;&lt;br /&gt;
    t.string   &amp;quot;maker&amp;quot;&lt;br /&gt;
    t.integer  &amp;quot;model&amp;quot;&lt;br /&gt;
    t.date     &amp;quot;year&amp;quot;&lt;br /&gt;
    t.datetime &amp;quot;created_at&amp;quot;&lt;br /&gt;
    t.datetime &amp;quot;updated_at&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Dynamic Scaffolding in CakePHP==&lt;br /&gt;
&lt;br /&gt;
Scaffolding in CakePHP is a little more limited than Rails. Unlike Rails, database tables and schema are created separately in CakePHP. It follows the dynamic scaffolding paradigm where you don't need to run an external command to generate the scaffolded code, what is needed is just to define the $scaffold variable and scaffolding is taken care of.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Steps for code generation in CakePHP&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Step -1	Create the database schema and the tables.&lt;br /&gt;
&lt;br /&gt;
Step -2	Each table that has to be scaffolded should have a corresponding controller.&lt;br /&gt;
&lt;br /&gt;
Step -3	That controller must define the variable $scaffold&lt;br /&gt;
For eg, considering our cars example, lets say we have a cars controller-&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
    class CarsController extends AppController&lt;br /&gt;
    {&lt;br /&gt;
        var $scaffold;&lt;br /&gt;
    }&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will go in CarsController.php in app/controllers directory.&lt;br /&gt;
That is all that is required. The framework will now auto-generate the basic functionality for create, update, delete.&lt;br /&gt;
&lt;br /&gt;
==Other Examples==&lt;br /&gt;
A more detailed listing of examples of scaffolding in various other web frameworks can be found in last year's treatment of the same topic here.&lt;br /&gt;
&lt;br /&gt;
http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_9_ss&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
You can go through some of the other frameworks to create scaffold web applications.&lt;br /&gt;
# [http://www.developer.com/lang/php/article.php/3636686/Scaffolding-with-CakePHP---Managing-Your-Fantasy-Football-Team.htm CakePHP Framework]&lt;br /&gt;
# [http://www.grails.org/Scaffolding Grails Framework]&lt;br /&gt;
#[http://msdn.microsoft.com/en-us/library/ee377606.aspx ASP.NET Framework]&lt;br /&gt;
#[http://www.ntchosting.com/php/frameworks/codeigniter/ Codeigniter]&lt;br /&gt;
#[http://www.myeclipseide.com/me4s/features/iphone-scaffolding.php iPhone]&lt;br /&gt;
#[http://wiki.netbeans.org/JsfCrudGenerator70 NetBeans CRUD Generator]&lt;br /&gt;
&lt;br /&gt;
=Bibiliography=&lt;br /&gt;
==References==&lt;br /&gt;
	&lt;br /&gt;
#Programming Ruby(2nd Edition): The Pragmatic Programmers' Guide (Pragmatic Programmers Series),  by Dave Thomas, Andy Hunt, Andrew Hunt, Chad Fowler, Chad Fowler: Publisher: Pragmatic Bookshelf&lt;br /&gt;
#Agile Web Development with Rails, 3rd ed. by Dave Thomas, David Heinemeier Hansson, David Hansson, Publisher: Pragmatic Bookshelf&lt;br /&gt;
#http://msdn.microsoft.com/en-us/library/cc488469.aspx&lt;br /&gt;
#http://guides.rubyonrails.org/getting_started.html&lt;br /&gt;
&lt;br /&gt;
==External Sites==&lt;br /&gt;
&lt;br /&gt;
#http://en.wikipedia.org/wiki/Scaffolding_Theory&lt;br /&gt;
#http://www.wisegeek.com/what-is-web-application-scaffolding.htm&lt;br /&gt;
#http://www.developer.com/lang/php/article.php/3636686/Scaffolding-with-CakePHP---Managing-Your-Fantasy-Football-Team.htm&lt;br /&gt;
#http://cpan.uwinnipeg.ca/htdocs/Scaffold/Scaffold.html&lt;br /&gt;
&lt;br /&gt;
==MediaSite==&lt;br /&gt;
&lt;br /&gt;
# http://www.asp.net/aspnet-in-net-35-sp1/videos/getting-started-with-dynamic-data&lt;br /&gt;
#http://www.youtube.com/watch?v=zV6aueUh8Bs&lt;br /&gt;
#http://www.youtube.com/watch?v=LWoCfTyWG_E&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch2_2d_dg&amp;diff=36151</id>
		<title>CSC/ECE 517 Fall 2010/ch2 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch2_2d_dg&amp;diff=36151"/>
		<updated>2010-09-22T21:29:11Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scaffolding&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=36149</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=36149"/>
		<updated>2010-09-22T21:25:02Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Gstungat&amp;diff=35750</id>
		<title>User:Gstungat</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Gstungat&amp;diff=35750"/>
		<updated>2010-09-20T23:45:26Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ftfgcvcv&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35748</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35748"/>
		<updated>2010-09-20T23:39:03Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contents:&lt;br /&gt;
1. What is Scaffolding&lt;br /&gt;
[[Introduction]]&lt;br /&gt;
== Introduction ==&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35747</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35747"/>
		<updated>2010-09-20T23:38:22Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Headline text ==&lt;br /&gt;
[[One]]&lt;br /&gt;
Contents:&lt;br /&gt;
1. What is Scaffolding&lt;br /&gt;
[[Introduction]]&lt;br /&gt;
== Introduction ==&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35746</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35746"/>
		<updated>2010-09-20T23:37:18Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contents:&lt;br /&gt;
1. What is Scaffolding&lt;br /&gt;
[[Introduction]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[User:Gstungat|Gstungat]] 19:37, 20 September 2010 (EDT)Introduction&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35745</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35745"/>
		<updated>2010-09-20T23:36:48Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contents:&lt;br /&gt;
1. What is Scaffolding&lt;br /&gt;
[[Introduction]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Introduction&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35744</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35744"/>
		<updated>2010-09-20T23:34:34Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contents:&lt;br /&gt;
1. What is Scaffolding&lt;br /&gt;
[[Media:Example.ogg]]&lt;br /&gt;
[[Introduction]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Introduction&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35742</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35742"/>
		<updated>2010-09-20T23:31:21Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contents:&lt;br /&gt;
1. What is Scaffolding&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35741</id>
		<title>CSC/ECE 517 Fall 2010/ch1 2d dg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2010/ch1_2d_dg&amp;diff=35741"/>
		<updated>2010-09-20T23:29:05Z</updated>

		<summary type="html">&lt;p&gt;Gstungat: Scaffolding in Web Application Frameworks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scaffolding basics&lt;/div&gt;</summary>
		<author><name>Gstungat</name></author>
	</entry>
</feed>