CSC/ECE 517 Fall 2007/wiki3 3 as
Topic
Take the principle of Separation of Responsibility and catalog the information on it available on the Web. Find good descriptions and good, concise, understandable examples. Tell which you consider the best to present to a class.
Separation of Responsibility
Separation of Responsibility states that a given problem involves different kinds of concerns, which should be identified and separated to cope with complexity, and to achieve the required engineering quality factors such as robustness, adaptability, maintainability, and reusability. The principle can be applied in various ways and it is an ubiquitous software engineering principle.
Separation of Responsibility has many similar terms or principles. All of them constitute similar ideas. These terms include Single Responsibility Principle, low coupling, Separation of Concerns, modularity, Grasp pattern and Aspect Oriented Programming.
In object-oriented methods the separated concerns are modeled as objects and classes, which are generally derived from the entities in the requirement specification and use cases. In structural methods, concerns are represented as procedures. In aspect-oriented programming, the term concern is extended with the so-called crosscutting properties such as synchronization, memory management and persistency.
Principle and Description
Separation at Class Level
We tried to present the best description in the part Separation of Responsibility. We also included some more knowledge using our own words. In the end it is hard to find information about Separation of Responsibilities by itself. In order to understand the concept one has to also read many similar ideas and principles. Now lets look to other descriptions found on the web, some including information about similar concepts to Separation of Responsibility:
http://129.10.116.80/home/lieber/courses/csu670/f06/coupling-blog/690.aspx.htm This site presents good ways on how to separate responsibility. This link is actually a web developers blog and he describes how to keep the coupling between classes low. He gives the key point to separation as 'identifying unstable areas of application'.
http://www.objectmentor.com/resources/articles/srp.pdf This is a good text about Single Responsibility Principle. The text includes a section on what responsibility is and how to determine a responsibility for a code. This site also gives nice class diagrams on how the responsibility is separated in a few applications including GUI and modem connection. This is a good link which explains the separation at the class level.
Wikipedia-Grasp Separation of Responsibility is one of the General Responsibility Assignment Software Patterns (Grasp) and this wiki describes all these principles in one page. Controller pattern, factory patter, high cohesion and low coupling are key concepts for separating responsibilities.
http://www.bookrags.com/Modularity_(programming) This site is about modularity in programming. It gives a very simple explanation of the concept with examples from the outside world. It gives a lot of advantages of separating responsibilities including 'ease to find errors', ' ease to built bigger projects' and code reuse in other projects.
http://www.objectsbydesign.com/books/larman_notes/6-DesignAndImplementationTechniques.html This site also gives some information on Grasp but also gives definitions on what the responsibilities of a class is.
http://www.ugolandini.net/AccoppiamentoCoesioneE.html Here you can find definitions of low coupling and high cohesion. The link also presents how to achieve these concepts in your program by giving some input output examples.
http://jayflowers.com/WordPress/?p=92 This site is also about Single Responsibility Principle and gives a good definition of what a 'responsibility' should have. The author summarizes the importance of separation with the sentence: 'Finding and separating those responsibilities from one another is much of what software design is really about'.
Separation at Structural Level
http://en.wikipedia.org/wiki/Model-view-controller One of the most important examples of Separation of Responsibility at the architecture level is the MVC pattern. Wikipedia is one of the best sources to read about MVC. Here MVC pattern is described in many different languages' context such as Java, Perl, Php and many more.
http://www.indiawebdevelopers.com/technology/java/mvcarchitecture.asp This last link contains a description of MVC and gives many advantages for it. The reason for MVC pattern is given as: 'separating the application object (model) from the way it is represented to the user (view) from the way in which the user controls it (controller)' in this site.
http://trese.cs.utwente.nl/taosad/separation_of_concerns.htm This link gives information about Separation of Responsibility in the architecture context. In order to separate responsibilities this site uses an abstraction problem solving approach.
http://www.acsac.org/waepssd/papers/02-piessens.pdf This paper describes the importance of Separation of Responsibilities in security applications. More specifically, this paper positions the separation-of-concerns principle as an essential means to build secure software.
Examples
Separation at Class Level
Below you can see many sites which include Separation of Responsibility example. We also present some information about the sites next to their links.
Javacoffeebreak This site contains an example using the concept of separation of responsibility for a GUI-based application. The example is easy to understand and comes with a detailed explanation of the code and how the principle is used. This is a good site to see the separation of responsibility applied Java.
http://designparadigm.wordpress.com/ This is a page on Separation of Responsibility. Proper explanation is provided on what the principle is along with a easy-to-understand example. Further information about naming conventions (naming classes and methods) and their relationship with the principle is also provided.
wikipedia This page describes aspect oriented programming (AOP) which is one of the well-known applications of Separation of Concerns. AOP cares more on separating cross cutting concerns. The code given here is an example to weak Separation of Responsibility while the improved code is not given. Hence this site is good for only observing where you need to apply separating of concerns.
http://weblogs.java.net/blog/tchangu/archive/2006/02/a_simple_utilit_1.html This page provides a more advanced example on how to use the principle in logins and password encryption. The implementation of this example contains 4 different classes for different tasks including: creating a database, logging, checking the password from database and encryption.
Separation at Structural Level
Eclipse Documentation This document teaches how to draw shapes using the MVC pattern. The separated responsibility components included are called View / EditPart / IFigure. Although there is not much information about the principle, the example is described in detail. This is a good link for observing the principle in graphical modeling framework.
Sun This page includes a description and analysis of a project. Though it does not provide any code, you can see how separation of responsibility is achieved in the design process. The project also uses the MVC pattern. One need not understand the entire project in order to visualize how the separation of concerns helps in the design process.Hence the long description of the project should not discourage you.
http://msdn2.microsoft.com/en-us/library/ms838356.aspx A more advanced site about component-based development for mobile devices. This site depicts how the separation-of-responsibility can be accomplished with multi-tiering. It gives a complex example, yet it is a good source to see how the principle is used in carious applications.
References
http://designparadigm.wordpress.com/
http://davidhayden.com/blog/dave/archive/2004/11/19/631.aspx