<?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=Xfang2</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=Xfang2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Xfang2"/>
	<updated>2026-05-10T17:04:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53568</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53568"/>
		<updated>2011-10-21T00:45:27Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.[17] In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:[18]&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&amp;lt;br&amp;gt;&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&amp;lt;br&amp;gt;&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&amp;lt;br&amp;gt;&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&amp;lt;br&amp;gt;&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&amp;lt;br&amp;gt;&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&amp;lt;br&amp;gt;&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&amp;lt;br&amp;gt;&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&amp;lt;br&amp;gt;&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&amp;lt;br&amp;gt;&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&amp;lt;br&amp;gt;&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&amp;lt;br&amp;gt;&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53565</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53565"/>
		<updated>2011-10-21T00:44:40Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.[17] In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:[18]&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53534</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53534"/>
		<updated>2011-10-21T00:31:32Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Software design anti-patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.[17] In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:[18]&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53526</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53526"/>
		<updated>2011-10-21T00:29:41Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53523</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53523"/>
		<updated>2011-10-21T00:29:09Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53522</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53522"/>
		<updated>2011-10-21T00:28:55Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53520</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53520"/>
		<updated>2011-10-21T00:28:39Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53519</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53519"/>
		<updated>2011-10-21T00:28:14Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, [http://en.wikipedia.org/wiki/Polymorphism_(computer_science) polymorphism] manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53517</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53517"/>
		<updated>2011-10-21T00:27:38Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53516</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53516"/>
		<updated>2011-10-21T00:27:14Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstraction_(computer_science) Abstraction] is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)inheritance] way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53508</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53508"/>
		<updated>2011-10-21T00:25:07Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Programming Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53506</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53506"/>
		<updated>2011-10-21T00:24:57Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Language Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
&amp;lt;br&amp;gt;The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53504</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53504"/>
		<updated>2011-10-21T00:24:11Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Language Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53503</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53503"/>
		<updated>2011-10-21T00:23:36Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Programming Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;:The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;:This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;:The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53502</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53502"/>
		<updated>2011-10-21T00:22:48Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* What is software failure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5].&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53499</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53499"/>
		<updated>2011-10-21T00:22:30Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4.&amp;lt;br&amp;gt; &lt;br /&gt;
[17]http://sourcemaking.com/antipatterns &amp;lt;br&amp;gt;&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53496</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53496"/>
		<updated>2011-10-21T00:21:48Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&amp;lt;br&amp;gt;&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4. &lt;br /&gt;
&lt;br /&gt;
[17]http://sourcemaking.com/antipatterns&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53493</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53493"/>
		<updated>2011-10-21T00:21:25Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'&amp;quot;p. 225. ISBN 0-201-72219-4. &lt;br /&gt;
&lt;br /&gt;
[17]http://sourcemaking.com/antipatterns&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53489</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53489"/>
		<updated>2011-10-21T00:20:45Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. p. 225. ISBN 0-201-72219-4. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'.&amp;quot;&lt;br /&gt;
[17]http://sourcemaking.com/antipatterns&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53486</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53486"/>
		<updated>2011-10-21T00:20:09Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&lt;br /&gt;
[16]Budgen, D. (2003). Software design. Harlow, Eng.: Addison-Wesley. p. 225. ISBN 0-201-72219-4. &amp;quot;As described in Long (2001), design anti-patterns are 'obvious, but wrong, solutions to recurring problems'.&amp;quot;&lt;br /&gt;
[17]AntiPatterns http://sourcemaking.com/antipatterns&lt;br /&gt;
[18]http://en.wikipedia.org/wiki/Anti-pattern&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53482</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53482"/>
		<updated>2011-10-21T00:19:15Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Software design anti-patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice[16].Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53480</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53480"/>
		<updated>2011-10-21T00:18:48Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.［2］Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;br /&gt;
[15]http://stackoverflow.com/questions/345698/what-are-the-tell-tale-signs-of-bad-object-oriented-design&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53476</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53476"/>
		<updated>2011-10-21T00:18:14Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Factors may lead to Poor OOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones[15]:&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.［2］Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53469</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53469"/>
		<updated>2011-10-21T00:16:10Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Poor OOD Leads to Software Failures=&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD. In the figure 1, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component. &lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
==Factors may lead to Poor OOD== &lt;br /&gt;
&lt;br /&gt;
Bad practice in code will always lead to the poor OOD. Here are some common ones:［1］&lt;br /&gt;
*Classes that break the Single Responsibility Principle (SRP) and perform too many actions&lt;br /&gt;
*Favor Composition over Inheritance: too much inheritance instead of composition, i.e. Classes that derive from a sub-type purely so they get functionality for free&lt;br /&gt;
*Repeated use of switch/case statements on the same enumerated member (sign of sub-classes needing extraction)&lt;br /&gt;
*Lots of member variables that are used for processing, not to capture state (might indicate need to extract a method object)&lt;br /&gt;
*Long chains of member access &lt;br /&gt;
*Use of too many design patterns in a small space&lt;br /&gt;
*Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results&lt;br /&gt;
*A base class down-casting itself to a derived class. Like, excessive use of switch statements, or derived classes that override everything&lt;br /&gt;
*Duplicate code, code that does the same thing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software design anti-patterns==&lt;br /&gt;
In software engineering, an anti-pattern (or anti-pattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.［2］Many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. &lt;br /&gt;
&lt;br /&gt;
Anti-patterns, like their design pattern counterparts, define an industry vocabulary for the common defective processes and implementations within organizations.［3］ In OOP, the anti-patterns of software design and object-oriented design are dangerous. They will result in bugs and errors in practice, and then finally lead to the failures of software. Here are the examples:［4］&lt;br /&gt;
&lt;br /&gt;
*Abstraction inversion: Not exposing implemented functionality required by users, so that they re-implement it using higher level functions&lt;br /&gt;
*Ambiguous viewpoint: Presenting a model (usually Object-oriented analysis and design (OOAD)) without specifying its viewpoint&lt;br /&gt;
*Big ball of mud: A system with no recognizable structure&lt;br /&gt;
*Database-as-IPC: Using a database as the message queue for routine interprocess communication where a much more lightweight mechanism would be suitable&lt;br /&gt;
*Gold plating: Continuing to work on a task or project well past the point at which extra effort is adding value&lt;br /&gt;
*Inner-platform effect: A system so customizable as to become a poor replica of the software development platform&lt;br /&gt;
*Input kludge: Failing to specify and implement the handling of possibly invalid input&lt;br /&gt;
*Interface bloat: Making an interface so powerful that it is extremely difficult to implement&lt;br /&gt;
*Magic pushbutton: Coding implementation logic directly within interface code, without using abstraction&lt;br /&gt;
*Race hazard: Failing to see the consequence of different orders of events&lt;br /&gt;
*Stovepipe system: A barely maintainable assemblage of ill-related components&lt;br /&gt;
&lt;br /&gt;
== Object oriented design anti-patterns ==&lt;br /&gt;
*Anemic Domain Model: The use of domain model without any business logic. The domain model's objects cannot guarantee their correctness at any moment, because their validation and mutation logic is placed somewhere outside (most likely in multiple places).&lt;br /&gt;
*BaseBean: Inheriting functionality from a utility class rather than delegating to it&lt;br /&gt;
*Call super: Requiring subclasses to call a superclass's overridden method&lt;br /&gt;
*Circle-ellipse problem: Subtyping variable-types on the basis of value-subtypes&lt;br /&gt;
*Circular dependency: Introducing unnecessary direct or indirect mutual dependencies between objects or software modules&lt;br /&gt;
*Constant interface: Using interfaces to define constants&lt;br /&gt;
*God object: Concentrating too many functions in a single part of the design (class)&lt;br /&gt;
*Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use&lt;br /&gt;
*Object orgy: Failing to properly encapsulate objects permitting unrestricted access to their internals&lt;br /&gt;
*Poltergeists: Objects whose sole purpose is to pass information to another object&lt;br /&gt;
*Sequential coupling: A class that requires its methods to be called in a particular order&lt;br /&gt;
*Yo-yo problem: A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53431</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=53431"/>
		<updated>2011-10-20T23:59:30Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Language Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;:Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;:[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52949</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52949"/>
		<updated>2011-10-20T05:35:18Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
*[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
*[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
*[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
*[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
*[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
*[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[8] http://softwaredesign.com/objects.html&lt;br /&gt;
*[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
*[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
*[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
*[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
*[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
*[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52948</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52948"/>
		<updated>2011-10-20T05:34:47Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52946</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52946"/>
		<updated>2011-10-20T05:31:32Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Tips for a good OOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Lots of Objects&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Interfaces to Make APIs Predictable&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Use Dependency Injection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Create Loosely Coupled Classes&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52945</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52945"/>
		<updated>2011-10-20T05:30:59Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Tips for a good OOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&amp;lt;br&amp;gt;&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&amp;lt;br&amp;gt;&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&amp;lt;br&amp;gt;&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&amp;lt;br&amp;gt;&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52943</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52943"/>
		<updated>2011-10-20T05:30:03Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems.&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52942</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52942"/>
		<updated>2011-10-20T05:29:44Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Design principles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52940</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52940"/>
		<updated>2011-10-20T05:28:54Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* How to achieve a good OOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”--Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52939</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52939"/>
		<updated>2011-10-20T05:28:36Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* How to achieve a good OOD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
                                                                                                                            Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52938</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52938"/>
		<updated>2011-10-20T05:28:04Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Programming Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52937</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52937"/>
		<updated>2011-10-20T05:27:41Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Language Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52936</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52936"/>
		<updated>2011-10-20T05:27:01Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /*  Factors leading to software failure  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor user input&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Vague requirement&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor cost and schedule estimation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Skills that not match the job&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Communication breakdown&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Poor architecture&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52935</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52935"/>
		<updated>2011-10-20T05:26:18Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /*  Factors leading to software failure  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
Poor user input&amp;lt;br&amp;gt;&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
Vague requirement&amp;lt;br&amp;gt;&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
Poor cost and schedule estimation&amp;lt;br&amp;gt;&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
Skills that not match the job&amp;lt;br&amp;gt;&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
Communication breakdown&amp;lt;br&amp;gt;&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
Poor architecture&amp;lt;br&amp;gt;&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52934</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52934"/>
		<updated>2011-10-20T05:25:50Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Language Concepts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
Poor user input&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
Vague requirement&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
Poor cost and schedule estimation&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
Skills that not match the job&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
Communication breakdown&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
Poor architecture&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52932</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52932"/>
		<updated>2011-10-20T05:06:34Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /*  Factors leading to software failure  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
Poor user input&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
Vague requirement&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
Poor cost and schedule estimation&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
Skills that not match the job&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
Communication breakdown&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
Poor architecture&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52931</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52931"/>
		<updated>2011-10-20T05:05:20Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* What is software failure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
                                                             [[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
                                                                      Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
== Poor user input ==&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
== Vague requirement ==&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
== Poor cost and schedule estimation==&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
== Skills that not match the job ==&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Communication breakdown ==&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
== Poor architecture ==&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Failure.jpg&amp;diff=52930</id>
		<title>File:Failure.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Failure.jpg&amp;diff=52930"/>
		<updated>2011-10-20T05:03:55Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52929</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52929"/>
		<updated>2011-10-20T05:03:24Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* What is software failure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
&lt;br /&gt;
[[File:failure.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
== Poor user input ==&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
== Vague requirement ==&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
== Poor cost and schedule estimation==&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
== Skills that not match the job ==&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Communication breakdown ==&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
== Poor architecture ==&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52928</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52928"/>
		<updated>2011-10-20T05:01:26Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; &lt;br /&gt;
=&amp;lt;b&amp;gt;Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
 &lt;br /&gt;
Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
== Poor user input ==&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
== Vague requirement ==&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
== Poor cost and schedule estimation==&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
== Skills that not match the job ==&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Communication breakdown ==&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
== Poor architecture ==&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52924</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4j fw</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4j_fw&amp;diff=52924"/>
		<updated>2011-10-20T04:59:40Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: Created page with &amp;quot;Software failures due to poor OOD =&amp;lt;b&amp;gt; Introduction&amp;lt;/b&amp;gt; = In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Software failures due to poor OOD =&amp;lt;b&amp;gt; Introduction&amp;lt;/b&amp;gt; =&lt;br /&gt;
In this wiki page, we will introduce the factors that relevant to software project success and failure. And we will focus on analyzing how [http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] affects the success of software. In the later part of this wiki page, we will demonstrate and analysis some examples of software failures which due to poor OOD.&lt;br /&gt;
 &lt;br /&gt;
= &amp;lt;b&amp;gt;Software success and failure&amp;lt;/b&amp;gt; = &lt;br /&gt;
&lt;br /&gt;
== What is software success ==&lt;br /&gt;
The general definition of software project success is - projects delivered on time, in scope (software quality is satisfied) and within planned costs. [1] It is just a most simplistic definition of software project success because it merely relies on the schedule and budget. In fact, it is hard to tell whether software is a success or failure one, because business success, at sometime, is more essential than technical success. [2] This means that the software which is being implemented must create value that business needed, such as making profit, rather than simply achieve the software goal and requirement.&lt;br /&gt;
&lt;br /&gt;
In ''The Strategic Project Office'', written by J. Kent Crawford, [3] we can find some more specific success criteria mentioned to address alignment between project goals, business requirements, and outcomes:&lt;br /&gt;
&lt;br /&gt;
The organization’s strategies are executed according to plan.&lt;br /&gt;
The organization’s shareholders are satisfied.&lt;br /&gt;
The organization is financially successful.&lt;br /&gt;
Projects are completed on schedule and on budget.&lt;br /&gt;
Project customers are satisfied.&lt;br /&gt;
Project resources are allocated optimally.&lt;br /&gt;
Projects are aligned to the organization’s business strategy.&lt;br /&gt;
The organization works on the right projects.&lt;br /&gt;
&lt;br /&gt;
== What is software failure ==&lt;br /&gt;
Compared with software success, it is relative easier to define software failure. It can be definite as “(1) being over-scheduled by more than 30% and/or, (2) being over-budget by more than 30% and/or, (3) the end product did not meet user requirements. These three criteria cover the schedule, budget, and requirement, all surrounded by quality that should comprise all projects.”[5]. &lt;br /&gt;
&lt;br /&gt;
In technical term, software failure is possibly due to software bugs or the poor software design, such as bad OOD that will be discussed later. In the figure below, we can see the cyclic behavior of failure. A fault or bug will cause errors. And errors in the system lead to the subsequent failure. In most of the cases, the software system comprises multiple components in which one failure may result in bugs or errors in another component.  &lt;br /&gt;
 &lt;br /&gt;
Figure 1 cyclic Fault behavior&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt; Factors leading to software failure &amp;lt;/b&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
Most software project can be considered at least partial failures since few of the software can meet all the schedule, cost and requirement objective. According to many studies, failure rate of software projects is between 50% - 80%. [6] In most of the cases, the software projects fail because we do not recognize that good engineering principles should be applied to software projects just as they are to building office buildings. Below are some factors that may lead to the software failure with no particular order:&lt;br /&gt;
&lt;br /&gt;
== Poor user input ==&lt;br /&gt;
It is possible that a titanic project which meets all the requirements ultimately get fails because the system did not meet the user needs.&lt;br /&gt;
&lt;br /&gt;
== Vague requirement ==&lt;br /&gt;
People cannot design a process that assumes the requirement is stable. Projects could be headed for trouble if architectures and processes are not change-friendly, or if there are poorly established guidelines that determine how and when requirements can be added, removed, and implemented—and who will shoulder the cost of the changes.  &lt;br /&gt;
&lt;br /&gt;
== Poor cost and schedule estimation==&lt;br /&gt;
Although it is unfair to call software project a failure if it cannot meet the budget and schedule goals that were inherently unattainable, every software project has a minimum achievable cost and schedule. &lt;br /&gt;
&lt;br /&gt;
== Skills that not match the job ==&lt;br /&gt;
It is obvious reason, just like managers can perform poorly if they lead projects that do not match their strengths.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Communication breakdown ==&lt;br /&gt;
Communication breakdown may lead to low efficiency and even the project failure. Especially large software project which is done by different groups in various sites, same code may be tested two times because no one knows the other exist.&lt;br /&gt;
&lt;br /&gt;
== Poor architecture ==&lt;br /&gt;
This is because people never think ahead about what is likely to change. Once the software is developed in an inflexible way, it may be outdate quickly after it is released and may cause problems because it cannot deal with the continue change incomes. For this reason, we come to realize why OOD is so important in software development.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;b&amp;gt;What is Object Oriented Design (OOD) &amp;lt;/b&amp;gt; =&lt;br /&gt;
[http://en.wikipedia.org/wiki/OOD Object Oriented Design (OOD)] is the concept that forces programmers to plan out their code in order to have a better flowing program [7]. Simply speaking, OOD is all about [http://en.wikipedia.org/wiki/Object_(computer_science)  objects]. An object can be considered as a “[http://en.wikipedia.org/wiki/Black_box black box]” which receives and sends messages. Code (sequence of computer instructions) and data (information that instructions operates on) are included in this “black box”. [8] Interface is used in the object and everything an object can do is represented by its message interface. &lt;br /&gt;
&lt;br /&gt;
== Simple example of OOD==&lt;br /&gt;
Here we give a simple example of coding used in both non-object-oriented-design and object-oriented-design.&lt;br /&gt;
&lt;br /&gt;
If we want to add two names together in non-object-oriented language such C. We first define a data type as list which will be defined as structure in C:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
structure list {&lt;br /&gt;
&amp;lt;definition of list structure data here&amp;gt;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
list a, b, c;&lt;br /&gt;
&lt;br /&gt;
a = “Adam”;&lt;br /&gt;
b = “Eva”;&lt;br /&gt;
c = a + b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We expect to get the result as “Adam Eva” but it doesn’t work actually in C. C complier will generate error when adding a and b because it only know how to add number while “Adam” and “Eva” are not.&lt;br /&gt;
&lt;br /&gt;
Let try this example again in Object-oriented language such as Ruby, we write the code as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a = “Adam”&lt;br /&gt;
b =”Eva”&lt;br /&gt;
c = a + b&lt;br /&gt;
puts c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The object a is created with string “Adam” and object b is created with string “Eva”. After entering the code, we can get the result “AdamEva”. Ruby complier knows how to manipulate the message “+” and that’s why object c gets new value.&lt;br /&gt;
&lt;br /&gt;
== Tools help for OOD ==&lt;br /&gt;
Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid the programmer. These programs are often more readable than non-object oriented programs, and debugging becomes easier with locality.[9]&lt;br /&gt;
===Language Concepts===&lt;br /&gt;
The 5 Basic Concepts of Object Oriented Design are the implementation level features that are built into the programming language. These features are often referred to by these common names:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation] refers to a tight coupling or association of data structures with the methods or functions that act on the data. This is called a class, or object (an object is often the implementation of a class).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Data Protection&amp;lt;b&amp;gt;&lt;br /&gt;
Data Protection is the ability to protect some components of the object from external entities. This is realized by language keywords to enable a variable to be declared as private or protected to the owning class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) Inheritance] defines the ability for a class to extend or override functionality of another class. The so called child class has a whole section that is the parent class and then it has its own set of functions and data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Interface&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Interface_(Java) Interface] is a definition of functions or methods, and their signatures that are available for use to manipulate a given instance of an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_(computer_science) Polymorphism] refers to the ability to define different functions or classes as having the same name but taking different data types.&lt;br /&gt;
&lt;br /&gt;
===Programming Concepts===&lt;br /&gt;
There are several concepts that were derived from the new languages once they became popular. The new standards that came around pushed on three major things:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Re-usability&amp;lt;/b&amp;gt;&lt;br /&gt;
The ability to reuse code for multiple applications. If a programmer has already written a power function, then it should be written that any program can make a call to that function and it should work exactly the same.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Privacy&amp;lt;/b&amp;gt;&lt;br /&gt;
This is important for large programs and preventing loss of data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Documentation&amp;lt;/b&amp;gt;&lt;br /&gt;
The commenting of a program in mark up that will not be converted to machine code. This mark up can be as long as the programmer wants, and allows for comprehensive information to be passed on to new programmers. This is important for both the re-usability and the maintainability of programs.	&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;How to achieve a good OOD&amp;lt;/b&amp;gt;=&lt;br /&gt;
“Good design and programming is not learned by generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify human-engineered, efficient, and reliable, by the application of good and programming practices. Careful study and imitation of good designs and programs significantly improves development skills.”&lt;br /&gt;
----------------------------Kernighan &amp;amp; Plauger &lt;br /&gt;
&lt;br /&gt;
At the heart of great design are a set of principles and patterns. Design principles form the foundation of good object-oriented design and design patterns provide general repeatable solutions for common software problems. [10]&lt;br /&gt;
&lt;br /&gt;
==Design principles==&lt;br /&gt;
Design principles are guidelines and heuristics for a good object oriented designs. There are many different design principles of Object-Oriented Design. Here are 4 major principles of them: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Encapsulation&amp;lt;/b&amp;gt;&lt;br /&gt;
In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators. An accessor, usually in the form of properties in OOP, is a method that is used to ask an object about itself. Accessor has a get method, which is an accessor method. Mutator is used to modify the state of an object. It is a public method, and hides the implementation of exactly how the data gets modified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Abstraction&amp;lt;/b&amp;gt;&lt;br /&gt;
Abstraction is the development of a software object. It denotes a model, a view, or some other focused-representations for an object we can actually find in the real world. It can be used to decompose complex systems into smaller by software developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Inheritance&amp;lt;/b&amp;gt;&lt;br /&gt;
Objects can relate to each other with either a “has a”, “uses a” or an “is a” relationship.  “Is a” is the inheritance way of object relationship.[11]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Polymorphism&amp;lt;/b&amp;gt;&lt;br /&gt;
Meaning one name, many forms, polymorphism manifests itself by having multiple methods all with the same name, but slightly different functionality.  There are two basic types of polymorphism: overriding, also called run-time polymorphism, and overloading, which is referred to as compile-time polymorphism.&lt;br /&gt;
&lt;br /&gt;
==Design patterns==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Design_pattern_(computer_science) Design pattern] is a general reusable solution to a commonly occurring problem within a given context. It is a template describing how to solve a problem, which cannot be transformed directly into code. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such. [12]&lt;br /&gt;
&lt;br /&gt;
There are many types of design patterns, like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Creator&amp;lt;/b&amp;gt;&lt;br /&gt;
As one of the most common activities in an object-oriented system, creator pattern maintains a fundamental property of the relationship between objects of particular classes: class is responsible for creating objects. That is to say, creator pattern is responsible for creating an object of class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Controller&amp;lt;/b&amp;gt;&lt;br /&gt;
The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;High Cohesion&amp;lt;/b&amp;gt;&lt;br /&gt;
High cohesion means that the responsibilities of a given element are strongly related and highly focused. It is an evaluative pattern generally used in support of Low Coupling, which can keep objects appropriately focused, manageable and understandable. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Indirection&amp;lt;/b&amp;gt;&lt;br /&gt;
By assigning the responsibility of mediation between two elements to an intermediate object, the Indirection pattern supports low coupling and reuse potential between them. An example of this is the introduction of a controller component for mediation between data (model) and its representation (view) in the Model-view-controller pattern. [13]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Protected Variations&amp;lt;/b&amp;gt;&lt;br /&gt;
By wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface, the Protected Variations pattern protects elements from the variations on other elements, like objects, systems and subsystems. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips for a good OOD==&lt;br /&gt;
There are some tips that can be used in designing to enhance and improve the object-oriented projects.&lt;br /&gt;
&lt;br /&gt;
Use Lots of Objects&lt;br /&gt;
By adding lots of objects, it is easy to make each object has and only has one job. Once you understand the architecture, it helps to avoid changing massive amounts of code when we modify the code.&lt;br /&gt;
&lt;br /&gt;
Use Interfaces to Make APIs Predictable&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for strict type hinting, and by type hinting you can ensure that certain methods are always available for your use. [14]Each interface will provide the model to utilize. The utilization of a particular interface will cause the implementations of a few methods.&lt;br /&gt;
&lt;br /&gt;
Use Dependency Injection&lt;br /&gt;
Using dependency injection can make testing and feature addition easier. While, it makes testing impossible by instantiating objects directly in the code, or grabbing objects out of singletons. &lt;br /&gt;
&lt;br /&gt;
Create Loosely Coupled Classes&lt;br /&gt;
When a developer gives each object only one responsibility, they tightly couple objects together. Objects will often request information from other objects, and while this is not avoidable in all situations, these tightly coupled classes that rely on one another’s functionality makes pulling those objects apart impossible.[14]&lt;br /&gt;
What factors may lead to poor OOD &lt;br /&gt;
Example of software due to poor OOD (analysis) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[1]http://www.zdnet.com/blog/projectfailures/cio-analysis-defining-it-project-success-and-failure/12524&lt;br /&gt;
[2] http://www.42spikes.com/post/What-is-Software-Success.aspx&lt;br /&gt;
[3] http://www.crcpress.com/product/isbn/9781439838129&lt;br /&gt;
[4] J. C. Laprie (Ed.). Dependability: Basic Concepts and Terminology.  Springer-Verlag, Wein, New York, 1992.&lt;br /&gt;
[5] http://ac-support.europe.umuc.edu/~meinkej/inss690/wilson.htm&lt;br /&gt;
[6] http://www.it-cortex.com/Stat_Failure_Rate.htm&lt;br /&gt;
[7] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[8] http://softwaredesign.com/objects.html&lt;br /&gt;
[9] http://www.selectbs.com/process-maturity/what-is-object-oriented-design&lt;br /&gt;
[10] http://www.objectmentor.com/omSolutions/oops_what.html&lt;br /&gt;
[11]http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/&lt;br /&gt;
[12]http://webcache.googleusercontent.com/search?q=cache:TwYgDNxgxUMJ:en.wikipedia.org/wiki/Design_pattern_%28computer_science%29+object+oriented+design+patterns&amp;amp;cd=3&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&lt;br /&gt;
[13] http://en.wikipedia.org/wiki/GRASP_%28object-oriented_design%29&lt;br /&gt;
[14] http://www.brandonsavage.net/five-tips-to-make-good-object-oriented-code-better/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011&amp;diff=52923</id>
		<title>CSC/ECE 517 Fall 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011&amp;diff=52923"/>
		<updated>2011-10-20T04:58:29Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Link title]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a ms]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a cs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a ri]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a lj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b tj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c cm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c sj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c ka]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d sr]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e vs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e aa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a sc]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e dm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e an]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e lm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g vn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1f rs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1f sv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g jn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1h ps]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e sm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i zf]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g rn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i cl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i lj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1h hs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d gs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b ns]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b jp]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2a av]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2f jm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e ad]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e kt]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e gp]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b qu]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2c bs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2c rs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2a ca]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b rv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2c ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2b sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2f vh]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e ps]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3a oe]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3h rr]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3h ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 4b js]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 4b ms]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4b ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i aa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i sd]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d mt]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d ls]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d ch]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4c ap]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4h sv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4e cl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4a ga]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4f sl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i js]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4f ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4c dm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4g nv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4j fw]]&lt;br /&gt;
&lt;br /&gt;
*[[trial]]&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=49201</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1i zf</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=49201"/>
		<updated>2011-09-18T03:05:57Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Fall 2010/ch1 1i zf&lt;br /&gt;
----&lt;br /&gt;
= Introduction =&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented languages], method is a subroutine which associates with the instances of the class to define the specific behavior of this class. In the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] of these languages, methods reimplementation is essential because descendant class inherited from the ancestor class in which properties and method have been defined to some extent. In fact, method reimplementation not only simplify the coding (become more readable) but also make the relationship tight between ancestor class and descendant class.  However, in different OO languages, the ways of acquiring or allowing method reimplementation are significantly different. In this article, we are going to introduce these differences and provide code for better understanding.&lt;br /&gt;
&lt;br /&gt;
= Principle of method reimplementation in descendant class =&lt;br /&gt;
Method reimplementation is various in different OO languages according to their own programming rules and complier environments. And it also associated with inheritance between ancestor class and descendant class. Several terms of method are listed below.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Abstract method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_method Abstract method] is a method only has name but little or no implementation in the ancestor class, which must be also an abstract class. In most of the case, codes in abstract method are considered dummy but it does not mean useless. In fact, it provides a place for descendant class which inherited from the ancestor class to define specific behaviors and actions. &lt;br /&gt;
&lt;br /&gt;
For example, a toy company develops an ancestor class called “animal” which contains “dog”, “bird” and “fish” as its descendant classes. These subclasses have same characteristic such as color, size, price and behavior like move, speak. Here we use the abstract methods for move and speak so that the subclasses can define their own behaviors which act differently.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Virtual method&amp;lt;/b&amp;gt;==&lt;br /&gt;
Virtual method, or [http://en.wikipedia.org/wiki/Virtual_method virtual function], is the method that first declared or defined in the ancestor class and then completed defined in the descendant class. Based on the functionality in the subclasses, virtual method can be simply defined or overridden with details. In a virtual method in which only has the name but no implementation, we call this as pure virtual method, as known as abstract method introduced above.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overridden method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overridden method], as mentioned in virtual method, is used in OO language involving inheritance hierarchy.  It allows descendant classes to redefine the method in their ancestor class with more details and particular purposes. “Override” means the implementation in subclasses rewrites or redefines the original implementation of the method in their super class without changing the name, parameter and return type. To better demonstrate how overridden method work, we take the toy company example again. In the behavior aspect of “animal”, we have the method call “move”. In this method, we know it define the same of movement for all the animals. However, the way of movement among “dog”, “bird” and “fish” are different. Thus, in “dog” class, we may redefine the detail in move method as “I use leg”; in “bird” class, the detail of move method is “I use wings”; and in “fish” class, the detail of move method is “I use fin”.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overloaded method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overload Overloaded method] means that method share the same name with other method but may be different in other aspects such as parameter, number of parameter and data type.&lt;br /&gt;
And the correct method will be executed automatically during the runtime depends on how it is called.&lt;br /&gt;
&lt;br /&gt;
= Method reimplementation in different languages =&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] language, we can use the inheritance to reimplementation the methods. Inheritance is very useful in Smalltalk which makes the Smalltalk language reusability and extensibility.&lt;br /&gt;
There are two ways to modify the behavior of the methods in Smalltalk by inheritance. One is adding new methods and the other is overriding the inherited method.&lt;br /&gt;
&lt;br /&gt;
===Adding Methods===&lt;br /&gt;
Adding new method is very simple; we can add either instance or class methods, to the class definition. The following diagrams show how the adding method works:&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|+&amp;lt;b&amp;gt;ClassRoom’s Methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;Room instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Room_Number&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Room_Size&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Open_Window&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Open_Door&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;ClassRoom instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Turn_On_Computer&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Clean_Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ClassRoom class is specific types of Room. The ClassRoom class is inheriting from Room Class, so the new methods Turn_On_Computer and Clean_Blackboard will add to the ClassRoom class. Now ClassRoom class definition can now support all of the messages or methods in Room and the two new messages.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
Overriding an inherited method is very important way to provide unique behaviors to a class. If an object receives a message which we have a method in the class definition for that massage, the object will work its way up the hierarchy until it finds a method with that name. We cannot delete the inherited methods, if we do not need the method in the superclass, we can provide a method by the same name with the superclass in the subclass with no code in the method. In this way, we can simply replace the behavior of the superclass behavior by no behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
We can use the inheritance to make the method reimplementation in [http://en.wikipedia.org/wiki/Java Java]. They are similar with the ways we do in Smalltalk, like the overriding and overloading. But in Java, we can define abstract method and virtual method in Java, and it provides a @override tag that prevents the programmer from thinking another method is being overridden when really it is not.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
If we want to override a method in subclass that inherited from the superclass, we should invoke the superclass method by using the keyword super.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Say {&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd!”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Class Say represents the superclass and implements a method call express (). The subclass called Shout will inherit all the methods which in the Say class. But the class Shout will override the method express in Shout class, and replace it with new action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Say hello_say = new Say();&lt;br /&gt;
hello_say.express();     // Prints “Hello wolrd!”&lt;br /&gt;
&lt;br /&gt;
Say hello_shout = new Shout();   //Polymorphism&lt;br /&gt;
hello_shout.express();   //Prints “Hello wolrd, loudly!”&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The super can be used to call the superclass's method; we can modify the class in class Shout to make the method express call another express method which in superclass Say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
		Super.express();  //will call the express method in class Say&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But some of the methods cannot be overridden. For example, in Java, a method that is declared final in the super class cannot be overridden, and the method declared private or static cannot be overridden too. We cannot make a class that that is declared final to become a super class too.&lt;br /&gt;
&lt;br /&gt;
===Overloaded method===&lt;br /&gt;
&lt;br /&gt;
Java supports method overloading which allows the creation of several methods with the same method name, but different in their types of input and output of the function.&lt;br /&gt;
We can define two methods with the same name in Java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int Add(int a, int b) {	&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&lt;br /&gt;
float Add(float a, float b) {&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods have the same method name in define. To call the methods, we should pass the parameters to the methods above. When we call Add(1,1) it will call the first method Add(int a, int b), because we pass two int types of the parameters to the method Add. And if we call Add(1.0,1.0) it will call the second method Add(float a, float b) because we pass the float types of the parameters to the method Add. But if we give these two methods parameters a, b with default value, it will cause an error, which would result in an ambiguous call error, as the compiler wouldn’t know which of the two methods to use.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method===&lt;br /&gt;
Abstract method: When a class contains an abstract method, that class must be declared as abstract. The abstract method has no implementation and thus, classes that derive from that abstract class, must provide an implementation for this abstract method.&lt;br /&gt;
&lt;br /&gt;
Abstract method are the method that with no body specification. Subclasses must provide the method statements to fulfill the abstract method. Especially, if the method was one provided by the superclass, we should override them in each subclass. If we forgot to override that will cause some problem like that the applied method statement may be inappropriate. &lt;br /&gt;
Below is the abstract method example, we need to define the abstract method in subclass to reimplementation the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Vehicle  // class is abstract&lt;br /&gt;
{&lt;br /&gt;
  private String name;&lt;br /&gt;
  public Vehicle (String nm)      // constructor method&lt;br /&gt;
  { name=nm; }&lt;br /&gt;
  public String getName()       // regular method&lt;br /&gt;
  { return (name); }&lt;br /&gt;
  public abstract void run(); // abstract method - note no {}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method===&lt;br /&gt;
&lt;br /&gt;
Virtual method: A class can have a virtual method. The virtual method has an implementation. When you inherit from a class that has a virtual method, you can override the virtual method and provide additional logic, or replace the logic with your own implementation.&lt;br /&gt;
A virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.&lt;br /&gt;
In java, all the non-static methods with the default type “virtual function”. But if the methods marked with the keyword final, which cannot be overridden. The private methods are non-virtual which cannot be inherited.&lt;br /&gt;
Below is the example for Virtual Method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class toy&lt;br /&gt;
{&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
     System.out.println(“I am toy.”);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
     List&amp;lt;toy&amp;gt; toys = new LinkedList&amp;lt;toy&amp;gt;();&lt;br /&gt;
	&lt;br /&gt;
     toys.add(new toy());&lt;br /&gt;
     toys.add(new toy_man());&lt;br /&gt;
     toys.add(new toy_car());&lt;br /&gt;
&lt;br /&gt;
     for(toy current_toy : toys)&lt;br /&gt;
     {&lt;br /&gt;
	current_toy.say();&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_man extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_man.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_car extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_car.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am toy.&lt;br /&gt;
I am toy_man.&lt;br /&gt;
I am toy_car.&lt;br /&gt;
&lt;br /&gt;
===Interfaces===&lt;br /&gt;
In java interfaces are very similar with the abstract classes but all the methods in interfaces are abstract and all properties are static final. As the abstract classes, interfaces also can be inherited. And we also use the extends keywords too. Different from C++, in Java we cannot use the multiple inheritances for class, which means that a subclass extends from more than one superclass. An interface can tie elements of several classes together, and it also can separate design from coding as class method headers are specified but not their body.&lt;br /&gt;
For example we build a running interface for the subclasses of Vehicle. Because there is a method called stop(), we should define the method in any class which using the running interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface running&lt;br /&gt;
{&lt;br /&gt;
  public void stop();&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When we create a class that will use the interface, we should use the keywords implements which will follow one or more interface list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Vehicle_Run extends Vehicle implements running&lt;br /&gt;
{&lt;br /&gt;
    public Vehicle_Run (String nm)&lt;br /&gt;
    {&lt;br /&gt;
       super(nm);    // builds ala parent&lt;br /&gt;
    }&lt;br /&gt;
    public void run ()&lt;br /&gt;
    {&lt;br /&gt;
       System.out.println(&amp;quot;I am running.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public void stop ()  // this method specific to Vehicle_Run&lt;br /&gt;
   {&lt;br /&gt;
       System.out.println(&amp;quot;I stop.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is very similar with Java in method overriding and method overloading. The method overloading of C++ we can refer the method overloading in Java. But they have difference in method overriding between C++ and Java.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
C++ does not provide the keyword super that a subclass can use in Java to invoke a superclass version of a method that it wants to override. But in C++ we can use the base class follow with the scope resolution operator to override the superclass method.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy(char* nm, int s):name(name),size(s){}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
private:&lt;br /&gt;
	char* name;&lt;br /&gt;
	int size;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy::print() const{  // print() method of base class&lt;br /&gt;
	std::cout&amp;lt;&amp;lt;”Name = ” &amp;lt;&amp;lt; this-&amp;gt;name &amp;lt;&amp;lt; “; Size = ” &amp;lt;&amp;lt; this-&amp;gt;size;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Toy_car: public Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy_car(char * nm, int s, int t) : Toy(nm,s), type(t) {}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
	int type;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy_car::print() const{&lt;br /&gt;
	Toy::print();&lt;br /&gt;
	Std::cout&amp;lt;&amp;lt;”; Type = ” &amp;lt;&amp;lt; this-&amp;gt; type;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main method will call the print method in class Toy and class Toy_car separately.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Int main(int argc, char** argv) {&lt;br /&gt;
	Toy toy_test(“Jack”, 9);&lt;br /&gt;
        Toy_test.print();&lt;br /&gt;
        //outputs:&lt;br /&gt;
        //Name = Jack; Size = 9&lt;br /&gt;
&lt;br /&gt;
        Toy_car toy_car_test(“Ann”,”7”,”1”);&lt;br /&gt;
        //the pointer to the most overridden method in the vtable in on Toy_car::print&lt;br /&gt;
        toy_car_test.print();// but this call does not illustrate overriding&lt;br /&gt;
        static_cast&amp;lt;Toy&amp;amp;&amp;gt;(toy_car_test).print(); // this one does&lt;br /&gt;
        //output&lt;br /&gt;
        // Name = Jack; Size = 9;Type = 1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method=== &lt;br /&gt;
&lt;br /&gt;
In C++ we declare the virtual method by add the virtual keyword before the function’s declaration. The concept of the virtual method is nearly the same with that in Java, but the function in C++ is not default by “virtual function”.&lt;br /&gt;
Below is the example of virtual method in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
	public:&lt;br /&gt;
		virtual void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_car : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_car.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_man : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_man.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	std::vector&amp;lt;Toy*&amp;gt;  toys;&lt;br /&gt;
	toys.push_back(new Toy()) ;&lt;br /&gt;
        toys.push_back(new Toy_car()) ;&lt;br /&gt;
        toys.push_back(new Toy_man()) ;&lt;br /&gt;
	&lt;br /&gt;
        for(std::vector&amp;lt;Toy*&amp;gt;::const_iterator  it = toys.begin() ;  it != toys.end(); ++it){&lt;br /&gt;
	   (*it)-&amp;gt;say();&lt;br /&gt;
	   delete *it;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy_car.&lt;br /&gt;
I am Toy_man.&lt;br /&gt;
&lt;br /&gt;
If we do not declare Toy::say() as virtual, the result will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method=== &lt;br /&gt;
&lt;br /&gt;
Quite similar with abstract method used in JAVA, the abstract method applied in C only generate a new virtual method without providing an implementation of that method. In fact, the derived classes have to overload the method and therefore to specify the implementation in that method. That's because abstract method provide no actual implementation in the body in which only exist a semicolon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Toy&lt;br /&gt;
{&lt;br /&gt;
   public abstract void action(speed s, direction d);&lt;br /&gt;
}&lt;br /&gt;
public class dog: Toy&lt;br /&gt;
{&lt;br /&gt;
   public override void action(speed s, direction d) {&lt;br /&gt;
      d.moveasDog(s);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
public class bird: Toy&lt;br /&gt;
{&lt;br /&gt;
   public override void action(speed s, direction d) {&lt;br /&gt;
      d.moveasBird(s);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we can see above, the Toy class defines a abstract method which allow dog and bird to move.  Obviously the action method is abstract since no default implementation included. And in classes of dog and bird, we can see detail implementations in action method, so that specific action method has been defined according to individual behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
Different with Java and C, [http://en.wikipedia.org/wiki/Ruby Ruby] is a dynamic Object-orientated Language. It allows default parameter and variable parameter used in the method. Therefore, there is no strict classification of overridden method and overloaded method. &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method with default parameter&amp;lt;/b&amp;gt;===&lt;br /&gt;
With the code below, we can better understand this concept:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( x, y, z=1 )&lt;br /&gt;
  x+y+z&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(10,20,30)&lt;br /&gt;
puts sum(5.0,10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
60&lt;br /&gt;
16.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( *num )&lt;br /&gt;
  totalSum =0 &lt;br /&gt;
  num.each { |i| totalSum+=i }&lt;br /&gt;
  return totalSum&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(1,10,100) &lt;br /&gt;
puts sum(2.2,3.3,4.4) &lt;br /&gt;
puts sum()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
111&lt;br /&gt;
9.9&lt;br /&gt;
0&lt;br /&gt;
&lt;br /&gt;
From the output we can see Ruby allow default parameter regardless the number and the type of parameter. Unlike the limitation in other static OO language, Ruby can dynamically execute codes in runtime. Therefore, the reimplementation in Ruby become less important compared with other static languages. Several ways can be used for method reimplementation in Ruby. For example, just simply extend classes. Or re-declare an existing class with new methods. To better demonstrate how these two approaches work, we use the code example as below:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method extended from class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Animal&lt;br /&gt;
attr_accessor:voice&lt;br /&gt;
  def initialize(v)&lt;br /&gt;
    puts &amp;quot;This is an animal.&amp;quot;&lt;br /&gt;
    self.voice=v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;This animal can speak&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new(&amp;quot; bow-wow!!&amp;quot;)&lt;br /&gt;
d.speak &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is an animal.&lt;br /&gt;
This animal can speak bow-wow!!&lt;br /&gt;
&lt;br /&gt;
As we can see, we just simply create a descendant class Dog and use the default method in the ancestor class Animal. The dog can bark as “bow-wow”, so we use the voice parameter to make it particular for dog.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; New method in the descendant class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Also, we can change the code of descendant class Dog since every dog can bark. Code shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new&lt;br /&gt;
d.speak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
&lt;br /&gt;
As we can see, the first line of the result is changed since we change the initialize in Dog class. And we do not need to define how the dog bark in the follow code since it has been defined in the Dog class. To further improve the code of this example, we can rewrite the Dog class again to make the speak method more specific. Codes shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
As we can found in the result, the speak method is revised. This result is exclusive for describing dog.&lt;br /&gt;
&lt;br /&gt;
If we just want to improve the functionality of the method in an ancestor class instead of rewriting it, we can use the keyword super in the code. Code for example is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    super&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
&lt;br /&gt;
From the result, we can see that both the speak methods in Animal class and Dog class are used.&lt;br /&gt;
&lt;br /&gt;
=Advantages and disadvantages of each languages applying method reimplementation=&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
It is a very flexible program language. It allows any method to be overridden, so we can be very convenient to get the method we want by overridden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Sometimes we do not require some methods in Smalltalk, but we still can override the methods which no longer need them. &lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java support the overriding methods, overloading methods, abstract methods, virtual methods, interfaces which make java be one of the top popular programming language today. We can reimplementation the methods by use the overriding and overloading methods. Abstract methods and virtual methods make the hierarchy structure colorful and clear. The interfaces of Java help to make some design patterns implementation easily. For example when we use the Strategy pattern, which clearly indicates a place in the design that will change, we should define the strategy as an interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java does not support the multiple inheritances. Compared with C++ which supports the multiple inheritances, C++ can provide more flexible way and more clear structure in class inheritance, which makes C++ sometimes a better choice for reimplementation methods in descendant classes.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
C++ provide the multiple inheritance which makes C++ much more flexible in reimplementation the methods. With the multiple inheritances, it makes some of the design patterns work better. One benefit from it is Adapter pattern: it uses multiple inheritances to adapt one interface to another. This pattern usually used to provide implementation for an abstract class (when you want to use an existing class and its interface is not appropriate, so you need to glue another interface with that class).&lt;br /&gt;
&lt;br /&gt;
The scope resolution operator in C++ is powerful enough. We can put the definition of the class in one file and use the scope resolution operator to implement the method in another file, which will make the whole structure more clear and it will help to add new method, overriding method, overloading method much easier.&lt;br /&gt;
&lt;br /&gt;
With the keywords “virtual” we can make the virtual method in C++ much more flexible. From the above examples you can see that the “virtual” keywords it helps us easy to fulfill the polymorphism, makes the program much more efficiently. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The multiple inheritances help us easy to reimplementation the method in subclass. But sometimes it causes some problems. With multiple inheritances, it makes the hierarchy of the program very complex. The programmers need to more time know the details of each base class. It will cause problem when using multiple inheritance is the diamond problem, which occurs when two classes are derived from a base class and another class is obtained by joining the derived classes together. If the derived classes override the same method from the base class when calling the method from the merged class and the joining class does also override that method, an ambiguity will rise. Another problem is that if two classes derived from the same base class. When we use these two classes to make multiple inheritance, it would make some base members duplicated.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java and C++, both as static OO languages, use overload and overridden methods in polymorphism to extend the flexibility of programming, since the property and method of class cannot be changed during the runtime. Compared with Java and C++, Ruby, as a dynamic OO language, allows change of property and method in the class in the runtime. For this reason, the method reimplementation becomes less essential as that in Java and C++. Ruby does not require using complicated mechanism to define the methods for disambiguation. Thus, Ruby is considered has better performance in reducing code and providing concise program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The disadvantage of Rudy, to some extent, also results from its dynamic characteristic. It become unsafe and unreliable compared with static typing OO language. For example, method in Ruby does not care about the type of parameter. It may cause problem when the type of parameter is essential for some application. Ruby cannot identify this wrong type error made by programmer.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt;=&lt;br /&gt;
Reimplementation of methods is one of the most essential features in Object-Oriented language. It expands the flexibility of polymorphism in which descendant class can define their own behaviors and functions more efficiently. There are different ways for various languages to define how to reuse methods. In details, we use codes of Smalltalk, Java, C++ and Ruby to demonstrate and analysis how methods are reused, following with the discussion of advantages and disadvantages of method reuse in these four languages. &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]:http://en.wikipedia.org/wiki/Method_(computer_programming)&lt;br /&gt;
*[2]:http://www.wisegeek.com/what-is-an-abstract-method.htm&lt;br /&gt;
*[3]:http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap6.html&lt;br /&gt;
*[4]:http://en.wikipedia.org/wiki/Function_overloading&lt;br /&gt;
*[5]:http://home.cogeco.ca/~ve3ll/jatutor5.htm&lt;br /&gt;
*[6]:http://en.wikipedia.org/wiki/Virtual_function#Java&lt;br /&gt;
*[7]:http://rubylearning.com/satishtalim/ruby_overloading_methods.html&lt;br /&gt;
*[8]:http://rubylearning.com/satishtalim/writing_own_ruby_methods.html&lt;br /&gt;
*[9]:http://learnruby.com/about-ruby.html&lt;br /&gt;
*[10]:http://www.pluitsolutions.com/2006/10/05/overriding-methods-in-ruby/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=49177</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1i zf</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=49177"/>
		<updated>2011-09-18T02:20:08Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Fall 2010/ch1 1i zf&lt;br /&gt;
----&lt;br /&gt;
= Introduction =&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented languages], method is a subroutine which associates with the instances of the class to define the specific behavior of this class. In the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] of these languages, methods reimplementation is essential because descendant class inherited from the ancestor class in which properties and method have been defined to some extent. In fact, method reimplementation not only simplify the coding (become more readable) but also make the relationship tight between ancestor class and descendant class.  However, in different OO languages, the ways of acquiring or allowing method reimplementation are significantly different. In this article, we are going to introduce these differences and provide code for better understanding.&lt;br /&gt;
&lt;br /&gt;
= Principle of method reimplementation in descendant class =&lt;br /&gt;
Method reimplementation is various in different OO languages according to their own programming rules and complier environments. And it also associated with inheritance between ancestor class and descendant class. Several terms of method are listed below.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Abstract method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_method Abstract method] is a method only has name but little or no implementation in the ancestor class, which must be also an abstract class. In most of the case, codes in abstract method are considered dummy but it does not mean useless. In fact, it provides a place for descendant class which inherited from the ancestor class to define specific behaviors and actions. &lt;br /&gt;
&lt;br /&gt;
For example, a toy company develops an ancestor class called “animal” which contains “dog”, “bird” and “fish” as its descendant classes. These subclasses have same characteristic such as color, size, price and behavior like move, speak. Here we use the abstract methods for move and speak so that the subclasses can define their own behaviors which act differently.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Virtual method&amp;lt;/b&amp;gt;==&lt;br /&gt;
Virtual method, or [http://en.wikipedia.org/wiki/Virtual_method virtual function], is the method that first declared or defined in the ancestor class and then completed defined in the descendant class. Based on the functionality in the subclasses, virtual method can be simply defined or overridden with details. In a virtual method in which only has the name but no implementation, we call this as pure virtual method, as known as abstract method introduced above.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overridden method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overridden method], as mentioned in virtual method, is used in OO language involving inheritance hierarchy.  It allows descendant classes to redefine the method in their ancestor class with more details and particular purposes. “Override” means the implementation in subclasses rewrites or redefines the original implementation of the method in their super class without changing the name, parameter and return type. To better demonstrate how overridden method work, we take the toy company example again. In the behavior aspect of “animal”, we have the method call “move”. In this method, we know it define the same of movement for all the animals. However, the way of movement among “dog”, “bird” and “fish” are different. Thus, in “dog” class, we may redefine the detail in move method as “I use leg”; in “bird” class, the detail of move method is “I use wings”; and in “fish” class, the detail of move method is “I use fin”.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overloaded method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overload Overloaded method] means that method share the same name with other method but may be different in other aspects such as parameter, number of parameter and data type.&lt;br /&gt;
And the correct method will be executed automatically during the runtime depends on how it is called.&lt;br /&gt;
&lt;br /&gt;
= Method reimplementation in different languages =&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] language, we can use the inheritance to reimplementation the methods. Inheritance is very useful in Smalltalk which makes the Smalltalk language reusability and extensibility.&lt;br /&gt;
There are two ways to modify the behavior of the methods in Smalltalk by inheritance. One is adding new methods and the other is overriding the inherited method.&lt;br /&gt;
&lt;br /&gt;
===Adding Methods===&lt;br /&gt;
Adding new method is very simple; we can add either instance or class methods, to the class definition. The following diagrams show how the adding method works:&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|+&amp;lt;b&amp;gt;ClassRoom’s Methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;Room instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Room_Number&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Room_Size&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Open_Window&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Open_Door&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;ClassRoom instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Turn_On_Computer&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Clean_Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ClassRoom class is specific types of Room. The ClassRoom class is inheriting from Room Class, so the new methods Turn_On_Computer and Clean_Blackboard will add to the ClassRoom class. Now ClassRoom class definition can now support all of the messages or methods in Room and the two new messages.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
Overriding an inherited method is very important way to provide unique behaviors to a class. If an object receives a message which we have a method in the class definition for that massage, the object will work its way up the hierarchy until it finds a method with that name. We cannot delete the inherited methods, if we do not need the method in the superclass, we can provide a method by the same name with the superclass in the subclass with no code in the method. In this way, we can simply replace the behavior of the superclass behavior by no behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
We can use the inheritance to make the method reimplementation in [http://en.wikipedia.org/wiki/Java Java]. They are similar with the ways we do in Smalltalk, like the overriding and overloading. But in Java, we can define abstract method and virtual method in Java, and it provides a @override tag that prevents the programmer from thinking another method is being overridden when really it is not.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
If we want to override a method in subclass that inherited from the superclass, we should invoke the superclass method by using the keyword super.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Say {&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd!”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Class Say represents the superclass and implements a method call express (). The subclass called Shout will inherit all the methods which in the Say class. But the class Shout will override the method express in Shout class, and replace it with new action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Say hello_say = new Say();&lt;br /&gt;
hello_say.express();     // Prints “Hello wolrd!”&lt;br /&gt;
&lt;br /&gt;
Say hello_shout = new Shout();   //Polymorphism&lt;br /&gt;
hello_shout.express();   //Prints “Hello wolrd, loudly!”&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The super can be used to call the superclass's method; we can modify the class in class Shout to make the method express call another express method which in superclass Say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
		Super.express();  //will call the express method in class Say&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But some of the methods cannot be overridden. For example, in Java, a method that is declared final in the super class cannot be overridden, and the method declared private or static cannot be overridden too. We cannot make a class that that is declared final to become a super class too.&lt;br /&gt;
&lt;br /&gt;
===Overloaded method===&lt;br /&gt;
&lt;br /&gt;
Java supports method overloading which allows the creation of several methods with the same method name, but different in their types of input and output of the function.&lt;br /&gt;
We can define two methods with the same name in Java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int Add(int a, int b) {	&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&lt;br /&gt;
float Add(float a, float b) {&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods have the same method name in define. To call the methods, we should pass the parameters to the methods above. When we call Add(1,1) it will call the first method Add(int a, int b), because we pass two int types of the parameters to the method Add. And if we call Add(1.0,1.0) it will call the second method Add(float a, float b) because we pass the float types of the parameters to the method Add. But if we give these two methods parameters a, b with default value, it will cause an error, which would result in an ambiguous call error, as the compiler wouldn’t know which of the two methods to use.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method===&lt;br /&gt;
Abstract method: When a class contains an abstract method, that class must be declared as abstract. The abstract method has no implementation and thus, classes that derive from that abstract class, must provide an implementation for this abstract method.&lt;br /&gt;
&lt;br /&gt;
Abstract method are the method that with no body specification. Subclasses must provide the method statements to fulfill the abstract method. Especially, if the method was one provided by the superclass, we should override them in each subclass. If we forgot to override that will cause some problem like that the applied method statement may be inappropriate. &lt;br /&gt;
Below is the abstract method example, we need to define the abstract method in subclass to reimplementation the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Vehicle  // class is abstract&lt;br /&gt;
{&lt;br /&gt;
  private String name;&lt;br /&gt;
  public Vehicle (String nm)      // constructor method&lt;br /&gt;
  { name=nm; }&lt;br /&gt;
  public String getName()       // regular method&lt;br /&gt;
  { return (name); }&lt;br /&gt;
  public abstract void run(); // abstract method - note no {}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method===&lt;br /&gt;
&lt;br /&gt;
Virtual method: A class can have a virtual method. The virtual method has an implementation. When you inherit from a class that has a virtual method, you can override the virtual method and provide additional logic, or replace the logic with your own implementation.&lt;br /&gt;
A virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.&lt;br /&gt;
In java, all the non-static methods with the default type “virtual function”. But if the methods marked with the keyword final, which cannot be overridden. The private methods are non-virtual which cannot be inherited.&lt;br /&gt;
Below is the example for Virtual Method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class toy&lt;br /&gt;
{&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
     System.out.println(“I am toy.”);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
     List&amp;lt;toy&amp;gt; toys = new LinkedList&amp;lt;toy&amp;gt;();&lt;br /&gt;
	&lt;br /&gt;
     toys.add(new toy());&lt;br /&gt;
     toys.add(new toy_man());&lt;br /&gt;
     toys.add(new toy_car());&lt;br /&gt;
&lt;br /&gt;
     for(toy current_toy : toys)&lt;br /&gt;
     {&lt;br /&gt;
	current_toy.say();&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_man extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_man.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_car extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_car.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am toy.&lt;br /&gt;
I am toy_man.&lt;br /&gt;
I am toy_car.&lt;br /&gt;
&lt;br /&gt;
===Interfaces===&lt;br /&gt;
In java interfaces are very similar with the abstract classes but all the methods in interfaces are abstract and all properties are static final. As the abstract classes, interfaces also can be inherited. And we also use the extends keywords too. Different from C++, in Java we cannot use the multiple inheritances for class, which means that a subclass extends from more than one superclass. An interface can tie elements of several classes together, and it also can separate design from coding as class method headers are specified but not their body.&lt;br /&gt;
For example we build a running interface for the subclasses of Vehicle. Because there is a method called stop(), we should define the method in any class which using the running interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface running&lt;br /&gt;
{&lt;br /&gt;
  public void stop();&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When we create a class that will use the interface, we should use the keywords implements which will follow one or more interface list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Vehicle_Run extends Vehicle implements running&lt;br /&gt;
{&lt;br /&gt;
    public Vehicle_Run (String nm)&lt;br /&gt;
    {&lt;br /&gt;
       super(nm);    // builds ala parent&lt;br /&gt;
    }&lt;br /&gt;
    public void run ()&lt;br /&gt;
    {&lt;br /&gt;
       System.out.println(&amp;quot;I am running.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public void stop ()  // this method specific to Vehicle_Run&lt;br /&gt;
   {&lt;br /&gt;
       System.out.println(&amp;quot;I stop.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is very similar with Java in method overriding and method overloading. The method overloading of C++ we can refer the method overloading in Java. But they have difference in method overriding between C++ and Java.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
C++ does not provide the keyword super that a subclass can use in Java to invoke a superclass version of a method that it wants to override. But in C++ we can use the base class follow with the scope resolution operator to override the superclass method.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy(char* nm, int s):name(name),size(s){}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
private:&lt;br /&gt;
	char* name;&lt;br /&gt;
	int size;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy::print() const{  // print() method of base class&lt;br /&gt;
	std::cout&amp;lt;&amp;lt;”Name = ” &amp;lt;&amp;lt; this-&amp;gt;name &amp;lt;&amp;lt; “; Size = ” &amp;lt;&amp;lt; this-&amp;gt;size;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Toy_car: public Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy_car(char * nm, int s, int t) : Toy(nm,s), type(t) {}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
	int type;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy_car::print() const{&lt;br /&gt;
	Toy::print();&lt;br /&gt;
	Std::cout&amp;lt;&amp;lt;”; Type = ” &amp;lt;&amp;lt; this-&amp;gt; type;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main method will call the print method in class Toy and class Toy_car separately.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Int main(int argc, char** argv) {&lt;br /&gt;
	Toy toy_test(“Jack”, 9);&lt;br /&gt;
        Toy_test.print();&lt;br /&gt;
        //outputs:&lt;br /&gt;
        //Name = Jack; Size = 9&lt;br /&gt;
&lt;br /&gt;
        Toy_car toy_car_test(“Ann”,”7”,”1”);&lt;br /&gt;
        //the pointer to the most overridden method in the vtable in on Toy_car::print&lt;br /&gt;
        toy_car_test.print();// but this call does not illustrate overriding&lt;br /&gt;
        static_cast&amp;lt;Toy&amp;amp;&amp;gt;(toy_car_test).print(); // this one does&lt;br /&gt;
        //output&lt;br /&gt;
        // Name = Jack; Size = 9;Type = 1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method=== &lt;br /&gt;
&lt;br /&gt;
In C++ we declare the virtual method by add the virtual keyword before the function’s declaration. The concept of the virtual method is nearly the same with that in Java, but the function in C++ is not default by “virtual function”.&lt;br /&gt;
Below is the example of virtual method in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
	public:&lt;br /&gt;
		virtual void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_car : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_car.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_man : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_man.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	std::vector&amp;lt;Toy*&amp;gt;  toys;&lt;br /&gt;
	toys.push_back(new Toy()) ;&lt;br /&gt;
        toys.push_back(new Toy_car()) ;&lt;br /&gt;
        toys.push_back(new Toy_man()) ;&lt;br /&gt;
	&lt;br /&gt;
        for(std::vector&amp;lt;Toy*&amp;gt;::const_iterator  it = toys.begin() ;  it != toys.end(); ++it){&lt;br /&gt;
	   (*it)-&amp;gt;say();&lt;br /&gt;
	   delete *it;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy_car.&lt;br /&gt;
I am Toy_man.&lt;br /&gt;
&lt;br /&gt;
If we do not declare Toy::say() as virtual, the result will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
Different with Java and C, [http://en.wikipedia.org/wiki/Ruby Ruby] is a dynamic Object-orientated Language. It allows default parameter and variable parameter used in the method. Therefore, there is no strict classification of overridden method and overloaded method. &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method with default parameter&amp;lt;/b&amp;gt;===&lt;br /&gt;
With the code below, we can better understand this concept:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( x, y, z=1 )&lt;br /&gt;
  x+y+z&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(10,20,30)&lt;br /&gt;
puts sum(5.0,10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
60&lt;br /&gt;
16.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( *num )&lt;br /&gt;
  totalSum =0 &lt;br /&gt;
  num.each { |i| totalSum+=i }&lt;br /&gt;
  return totalSum&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(1,10,100) &lt;br /&gt;
puts sum(2.2,3.3,4.4) &lt;br /&gt;
puts sum()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
111&lt;br /&gt;
9.9&lt;br /&gt;
0&lt;br /&gt;
&lt;br /&gt;
From the output we can see Ruby allow default parameter regardless the number and the type of parameter. Unlike the limitation in other static OO language, Ruby can dynamically execute codes in runtime. Therefore, the reimplementation in Ruby become less important compared with other static languages. Several ways can be used for method reimplementation in Ruby. For example, just simply extend classes. Or re-declare an existing class with new methods. To better demonstrate how these two approaches work, we use the code example as below:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method extended from class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Animal&lt;br /&gt;
attr_accessor:voice&lt;br /&gt;
  def initialize(v)&lt;br /&gt;
    puts &amp;quot;This is an animal.&amp;quot;&lt;br /&gt;
    self.voice=v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;This animal can speak&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new(&amp;quot; bow-wow!!&amp;quot;)&lt;br /&gt;
d.speak &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is an animal.&lt;br /&gt;
This animal can speak bow-wow!!&lt;br /&gt;
&lt;br /&gt;
As we can see, we just simply create a descendant class Dog and use the default method in the ancestor class Animal. The dog can bark as “bow-wow”, so we use the voice parameter to make it particular for dog.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; New method in the descendant class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Also, we can change the code of descendant class Dog since every dog can bark. Code shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new&lt;br /&gt;
d.speak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
&lt;br /&gt;
As we can see, the first line of the result is changed since we change the initialize in Dog class. And we do not need to define how the dog bark in the follow code since it has been defined in the Dog class. To further improve the code of this example, we can rewrite the Dog class again to make the speak method more specific. Codes shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
As we can found in the result, the speak method is revised. This result is exclusive for describing dog.&lt;br /&gt;
&lt;br /&gt;
If we just want to improve the functionality of the method in an ancestor class instead of rewriting it, we can use the keyword super in the code. Code for example is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    super&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
&lt;br /&gt;
From the result, we can see that both the speak methods in Animal class and Dog class are used.&lt;br /&gt;
&lt;br /&gt;
=Advantages and disadvantages of each languages applying method reimplementation=&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
It is a very flexible program language. It allows any method to be overridden, so we can be very convenient to get the method we want by overridden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Sometimes we do not require some methods in Smalltalk, but we still can override the methods which no longer need them. &lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java support the overriding methods, overloading methods, abstract methods, virtual methods, interfaces which make java be one of the top popular programming language today. We can reimplementation the methods by use the overriding and overloading methods. Abstract methods and virtual methods make the hierarchy structure colorful and clear. The interfaces of Java help to make some design patterns implementation easily. For example when we use the Strategy pattern, which clearly indicates a place in the design that will change, we should define the strategy as an interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java does not support the multiple inheritances. Compared with C++ which supports the multiple inheritances, C++ can provide more flexible way and more clear structure in class inheritance, which makes C++ sometimes a better choice for reimplementation methods in descendant classes.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
C++ provide the multiple inheritance which makes C++ much more flexible in reimplementation the methods. With the multiple inheritances, it makes some of the design patterns work better. One benefit from it is Adapter pattern: it uses multiple inheritances to adapt one interface to another. This pattern usually used to provide implementation for an abstract class (when you want to use an existing class and its interface is not appropriate, so you need to glue another interface with that class).&lt;br /&gt;
&lt;br /&gt;
The scope resolution operator in C++ is powerful enough. We can put the definition of the class in one file and use the scope resolution operator to implement the method in another file, which will make the whole structure more clear and it will help to add new method, overriding method, overloading method much easier.&lt;br /&gt;
&lt;br /&gt;
With the keywords “virtual” we can make the virtual method in C++ much more flexible. From the above examples you can see that the “virtual” keywords it helps us easy to fulfill the polymorphism, makes the program much more efficiently. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The multiple inheritances help us easy to reimplementation the method in subclass. But sometimes it causes some problems. With multiple inheritances, it makes the hierarchy of the program very complex. The programmers need to more time know the details of each base class. It will cause problem when using multiple inheritance is the diamond problem, which occurs when two classes are derived from a base class and another class is obtained by joining the derived classes together. If the derived classes override the same method from the base class when calling the method from the merged class and the joining class does also override that method, an ambiguity will rise. Another problem is that if two classes derived from the same base class. When we use these two classes to make multiple inheritance, it would make some base members duplicated.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java and C++, both as static OO languages, use overload and overridden methods in polymorphism to extend the flexibility of programming, since the property and method of class cannot be changed during the runtime. Compared with Java and C++, Ruby, as a dynamic OO language, allows change of property and method in the class in the runtime. For this reason, the method reimplementation becomes less essential as that in Java and C++. Ruby does not require using complicated mechanism to define the methods for disambiguation. Thus, Ruby is considered has better performance in reducing code and providing concise program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The disadvantage of Rudy, to some extent, also results from its dynamic characteristic. It become unsafe and unreliable compared with static typing OO language. For example, method in Ruby does not care about the type of parameter. It may cause problem when the type of parameter is essential for some application. Ruby cannot identify this wrong type error made by programmer.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt;=&lt;br /&gt;
Reimplementation of methods is one of the most essential features in Object-Oriented language. It expands the flexibility of polymorphism in which descendant class can define their own behaviors and functions more efficiently. There are different ways for various languages to define how to reuse methods. In details, we use codes of Smalltalk, Java, C++ and Ruby to demonstrate and analysis how methods are reused, following with the discussion of advantages and disadvantages of method reuse in these four languages. &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]:http://en.wikipedia.org/wiki/Method_(computer_programming)&lt;br /&gt;
*[2]:http://www.wisegeek.com/what-is-an-abstract-method.htm&lt;br /&gt;
*[3]:http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap6.html&lt;br /&gt;
*[4]:http://en.wikipedia.org/wiki/Function_overloading&lt;br /&gt;
*[5]:http://home.cogeco.ca/~ve3ll/jatutor5.htm&lt;br /&gt;
*[6]:http://en.wikipedia.org/wiki/Virtual_function#Java&lt;br /&gt;
*[7]:http://rubylearning.com/satishtalim/ruby_overloading_methods.html&lt;br /&gt;
*[8]:http://rubylearning.com/satishtalim/writing_own_ruby_methods.html&lt;br /&gt;
*[9]:http://learnruby.com/about-ruby.html&lt;br /&gt;
*[10]:http://www.pluitsolutions.com/2006/10/05/overriding-methods-in-ruby/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46535</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1i zf</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46535"/>
		<updated>2011-09-07T03:59:49Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Fall 2010/ch1 1i zf&lt;br /&gt;
----&lt;br /&gt;
= Introduction =&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented languages], method is a subroutine which associates with the instances of the class to define the specific behavior of this class. In the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] of these languages, methods reimplementation is essential because descendant class inherited from the ancestor class in which properties and method have been defined to some extent. With the method reimplementation, coding can be more efficient and simple without rewriting the same code again and agian. However, in different OO languages, the ways of acquiring or allowing method reimplementation are significantly different. In this article, we are going to introduce these differences and provide code for better understanding.&lt;br /&gt;
&lt;br /&gt;
= Principle of method reimplementation in descendant class =&lt;br /&gt;
Method reimplementation is various in different OO languages according to their own programming rules and complier environments. And it also associated with inheritance between ancestor class and descendant class. Several terms of method are listed below.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Abstract method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_method Abstract method] is a method only has name but little or no implementation in the ancestor class, which must be also an abstract class. In most of the case, codes in abstract method are considered dummy but it does not mean useless. In fact, it provides a place for descendant class which inherited from the ancestor class to define specific behaviors and actions. &lt;br /&gt;
&lt;br /&gt;
For example, a toy company develops an ancestor class called “animal” which contains “dog”, “bird” and “fish” as its descendant classes. These subclasses have same characteristic such as color, size, price and behavior like move, speak. Here we use the abstract methods for move and speak so that the subclasses can define their own behaviors which act differently.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Virtual method&amp;lt;/b&amp;gt;==&lt;br /&gt;
Virtual method, or [http://en.wikipedia.org/wiki/Virtual_method virtual function], is the method that first declared or defined in the ancestor class and then completed defined in the descendant class. Based on the functionality in the subclasses, virtual method can be simply defined or overridden with details. In a virtual method in which only has the name but no implementation, we call this as pure virtual method, as known as abstract method introduced above.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overridden method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overridden method], as mentioned in virtual method, is used in OO language involving inheritance hierarchy.  It allows descendant classes to redefine the method in their ancestor class with more details and particular purposes. “Override” means the implementation in subclasses rewrites or redefines the original implementation of the method in their super class without changing the name, parameter and return type. To better demonstrate how overridden method work, we take the toy company example again. In the behavior aspect of “animal”, we have the method call “move”. In this method, we know it define the same of movement for all the animals. However, the way of movement among “dog”, “bird” and “fish” are different. Thus, in “dog” class, we may redefine the detail in move method as “I use leg”; in “bird” class, the detail of move method is “I use wings”; and in “fish” class, the detail of move method is “I use fin”.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overloaded method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overload Overloaded method] means that method share the same name with other method but may be different in other aspects such as parameter, number of parameter and data type.&lt;br /&gt;
And the correct method will be executed automatically during the runtime depends on how it is called.&lt;br /&gt;
&lt;br /&gt;
= Method reimplementation in different languages =&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] language, we can use the inheritance to reimplementation the methods. Inheritance is very useful in Smalltalk which makes the Smalltalk language reusability and extensibility.&lt;br /&gt;
There are two ways to modify the behavior of the methods in Smalltalk by inheritance. One is adding new methods and the other is overriding the inherited method.&lt;br /&gt;
&lt;br /&gt;
===Adding Methods===&lt;br /&gt;
Adding new method is very simple; we can add either instance or class methods, to the class definition. The following diagrams show how the adding method works:&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|+&amp;lt;b&amp;gt;ClassRoom’s Methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;Room instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Room_Number&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Room_Size&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Open_Window&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Open_Door&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;ClassRoom instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Turn_On_Computer&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Clean_Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ClassRoom class is specific types of Room. The ClassRoom class is inheriting from Room Class, so the new methods Turn_On_Computer and Clean_Blackboard will add to the ClassRoom class. Now ClassRoom class definition can now support all of the messages or methods in Room and the two new messages.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
Overriding an inherited method is very important way to provide unique behaviors to a class. If an object receives a message which we have a method in the class definition for that massage, the object will work its way up the hierarchy until it finds a method with that name. We cannot delete the inherited methods, if we do not need the method in the superclass, we can provide a method by the same name with the superclass in the subclass with no code in the method. In this way, we can simply replace the behavior of the superclass behavior by no behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
We can use the inheritance to make the method reimplementation in [http://en.wikipedia.org/wiki/Java Java]. They are similar with the ways we do in Smalltalk, like the overriding and overloading. But in Java, we can define abstract method and virtual method in Java, and it provides a @override tag that prevents the programmer from thinking another method is being overridden when really it is not.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
If we want to override a method in subclass that inherited from the superclass, we should invoke the superclass method by using the keyword super.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Say {&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd!”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Class Say represents the superclass and implements a method call express (). The subclass called Shout will inherit all the methods which in the Say class. But the class Shout will override the method express in Shout class, and replace it with new action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Say hello_say = new Say();&lt;br /&gt;
hello_say.express();     // Prints “Hello wolrd!”&lt;br /&gt;
&lt;br /&gt;
Say hello_shout = new Shout();   //Polymorphism&lt;br /&gt;
hello_shout.express();   //Prints “Hello wolrd, loudly!”&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The super can be used to call the superclass's method; we can modify the class in class Shout to make the method express call another express method which in superclass Say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
		Super.express();  //will call the express method in class Say&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But some of the methods cannot be overridden. For example, in Java, a method that is declared final in the super class cannot be overridden, and the method declared private or static cannot be overridden too. We cannot make a class that that is declared final to become a super class too.&lt;br /&gt;
&lt;br /&gt;
===Overloaded method===&lt;br /&gt;
&lt;br /&gt;
Java supports method overloading which allows the creation of several methods with the same method name, but different in their types of input and output of the function.&lt;br /&gt;
We can define two methods with the same name in Java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int Add(int a, int b) {	&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&lt;br /&gt;
float Add(float a, float b) {&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods have the same method name in define. To call the methods, we should pass the parameters to the methods above. When we call Add(1,1) it will call the first method Add(int a, int b), because we pass two int types of the parameters to the method Add. And if we call Add(1.0,1.0) it will call the second method Add(float a, float b) because we pass the float types of the parameters to the method Add. But if we give these two methods parameters a, b with default value, it will cause an error, which would result in an ambiguous call error, as the compiler wouldn’t know which of the two methods to use.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method===&lt;br /&gt;
Abstract method: When a class contains an abstract method, that class must be declared as abstract. The abstract method has no implementation and thus, classes that derive from that abstract class, must provide an implementation for this abstract method.&lt;br /&gt;
&lt;br /&gt;
Abstract method are the method that with no body specification. Subclasses must provide the method statements to fulfill the abstract method. Especially, if the method was one provided by the superclass, we should override them in each subclass. If we forgot to override that will cause some problem like that the applied method statement may be inappropriate. &lt;br /&gt;
Below is the abstract method example, we need to define the abstract method in subclass to reimplementation the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Vehicle  // class is abstract&lt;br /&gt;
{&lt;br /&gt;
  private String name;&lt;br /&gt;
  public Vehicle (String nm)      // constructor method&lt;br /&gt;
  { name=nm; }&lt;br /&gt;
  public String getName()       // regular method&lt;br /&gt;
  { return (name); }&lt;br /&gt;
  public abstract void run(); // abstract method - note no {}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method===&lt;br /&gt;
&lt;br /&gt;
Virtual method: A class can have a virtual method. The virtual method has an implementation. When you inherit from a class that has a virtual method, you can override the virtual method and provide additional logic, or replace the logic with your own implementation.&lt;br /&gt;
A virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.&lt;br /&gt;
In java, all the non-static methods with the default type “virtual function”. But if the methods marked with the keyword final, which cannot be overridden. The private methods are non-virtual which cannot be inherited.&lt;br /&gt;
Below is the example for Virtual Method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class toy&lt;br /&gt;
{&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
     System.out.println(“I am toy.”);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
     List&amp;lt;toy&amp;gt; toys = new LinkedList&amp;lt;toy&amp;gt;();&lt;br /&gt;
	&lt;br /&gt;
     toys.add(new toy());&lt;br /&gt;
     toys.add(new toy_man());&lt;br /&gt;
     toys.add(new toy_car());&lt;br /&gt;
&lt;br /&gt;
     for(toy current_toy : toys)&lt;br /&gt;
     {&lt;br /&gt;
	current_toy.say();&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_man extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_man.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_car extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_car.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am toy.&lt;br /&gt;
I am toy_man.&lt;br /&gt;
I am toy_car.&lt;br /&gt;
&lt;br /&gt;
===Interfaces===&lt;br /&gt;
In java interfaces are very similar with the abstract classes but all the methods in interfaces are abstract and all properties are static final. As the abstract classes, interfaces also can be inherited. And we also use the extends keywords too. Different from C++, in Java we cannot use the multiple inheritances for class, which means that a subclass extends from more than one superclass. An interface can tie elements of several classes together, and it also can separate design from coding as class method headers are specified but not their body.&lt;br /&gt;
For example we build a running interface for the subclasses of Vehicle. Because there is a method called stop(), we should define the method in any class which using the running interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface running&lt;br /&gt;
{&lt;br /&gt;
  public void stop();&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When we create a class that will use the interface, we should use the keywords implements which will follow one or more interface list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Vehicle_Run extends Vehicle implements running&lt;br /&gt;
{&lt;br /&gt;
    public Vehicle_Run (String nm)&lt;br /&gt;
    {&lt;br /&gt;
       super(nm);    // builds ala parent&lt;br /&gt;
    }&lt;br /&gt;
    public void run ()&lt;br /&gt;
    {&lt;br /&gt;
       System.out.println(&amp;quot;I am running.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public void stop ()  // this method specific to Vehicle_Run&lt;br /&gt;
   {&lt;br /&gt;
       System.out.println(&amp;quot;I stop.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is very similar with Java in method overriding and method overloading. The method overloading of C++ we can refer the method overloading in Java. But they have difference in method overriding between C++ and Java.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
C++ does not provide the keyword super that a subclass can use in Java to invoke a superclass version of a method that it wants to override. But in C++ we can use the base class follow with the scope resolution operator to override the superclass method.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy(char* nm, int s):name(name),size(s){}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
private:&lt;br /&gt;
	char* name;&lt;br /&gt;
	int size;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy::print() const{  // print() method of base class&lt;br /&gt;
	std::cout&amp;lt;&amp;lt;”Name = ” &amp;lt;&amp;lt; this-&amp;gt;name &amp;lt;&amp;lt; “; Size = ” &amp;lt;&amp;lt; this-&amp;gt;size;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Toy_car: public Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy_car(char * nm, int s, int t) : Toy(nm,s), type(t) {}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
	int type;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy_car::print() const{&lt;br /&gt;
	Toy::print();&lt;br /&gt;
	Std::cout&amp;lt;&amp;lt;”; Type = ” &amp;lt;&amp;lt; this-&amp;gt; type;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main method will call the print method in class Toy and class Toy_car separately.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Int main(int argc, char** argv) {&lt;br /&gt;
	Toy toy_test(“Jack”, 9);&lt;br /&gt;
        Toy_test.print();&lt;br /&gt;
        //outputs:&lt;br /&gt;
        //Name = Jack; Size = 9&lt;br /&gt;
&lt;br /&gt;
        Toy_car toy_car_test(“Ann”,”7”,”1”);&lt;br /&gt;
        //the pointer to the most overridden method in the vtable in on Toy_car::print&lt;br /&gt;
        toy_car_test.print();// but this call does not illustrate overriding&lt;br /&gt;
        static_cast&amp;lt;Toy&amp;amp;&amp;gt;(toy_car_test).print(); // this one does&lt;br /&gt;
        //output&lt;br /&gt;
        // Name = Jack; Size = 9;Type = 1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method=== &lt;br /&gt;
&lt;br /&gt;
In C++ we declare the virtual method by add the virtual keyword before the function’s declaration. The concept of the virtual method is nearly the same with that in Java, but the function in C++ is not default by “virtual function”.&lt;br /&gt;
Below is the example of virtual method in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
	public:&lt;br /&gt;
		virtual void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_car : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_car.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_man : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_man.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	std::vector&amp;lt;Toy*&amp;gt;  toys;&lt;br /&gt;
	toys.push_back(new Toy()) ;&lt;br /&gt;
        toys.push_back(new Toy_car()) ;&lt;br /&gt;
        toys.push_back(new Toy_man()) ;&lt;br /&gt;
	&lt;br /&gt;
        for(std::vector&amp;lt;Toy*&amp;gt;::const_iterator  it = toys.begin() ;  it != toys.end(); ++it){&lt;br /&gt;
	   (*it)-&amp;gt;say();&lt;br /&gt;
	   delete *it;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy_car.&lt;br /&gt;
I am Toy_man.&lt;br /&gt;
&lt;br /&gt;
If we do not declare Toy::say() as virtual, the result will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
Different with Java and C, [http://en.wikipedia.org/wiki/Ruby Ruby] is a dynamic Object-orientated Language. It allows default parameter and variable parameter used in the method. Therefore, there is no strict classification of overridden method and overloaded method. &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method with default parameter&amp;lt;/b&amp;gt;===&lt;br /&gt;
With the code below, we can better understand this concept:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( x, y, z=1 )&lt;br /&gt;
  x+y+z&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(10,20,30)&lt;br /&gt;
puts sum(5.0,10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
60&lt;br /&gt;
16.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( *num )&lt;br /&gt;
  totalSum =0 &lt;br /&gt;
  num.each { |i| totalSum+=i }&lt;br /&gt;
  return totalSum&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
puts sum(1,10,100) &lt;br /&gt;
puts sum(2.2,3.3,4.4) &lt;br /&gt;
puts sum()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
111&lt;br /&gt;
9.9&lt;br /&gt;
0&lt;br /&gt;
&lt;br /&gt;
From the output we can see Ruby allow default parameter regardless the number and the type of parameter. Unlike the limitation in other static OO language, Ruby can dynamically execute codes in runtime. Therefore, the reimplementation in Ruby become less important compared with other static languages. Several ways can be used for method reimplementation in Ruby. For example, just simply extend classes. Or re-declare an existing class with new methods. To better demonstrate how these two approaches work, we use the code example as below:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method extended from class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Animal&lt;br /&gt;
attr_accessor:voice&lt;br /&gt;
  def initialize(v)&lt;br /&gt;
    puts &amp;quot;This is an animal.&amp;quot;&lt;br /&gt;
    self.voice=v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;This animal can speak&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new(&amp;quot; bow-wow!!&amp;quot;)&lt;br /&gt;
d.speak &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is an animal.&lt;br /&gt;
This animal can speak bow-wow!!&lt;br /&gt;
&lt;br /&gt;
As we can see, we just simply create a descendant class Dog and use the default method in the ancestor class Animal. The dog can bark as “bow-wow”, so we use the voice parameter to make it particular for dog.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; New method in the descendant class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Also, we can change the code of descendant class Dog since every dog can bark. Code shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new&lt;br /&gt;
d.speak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
&lt;br /&gt;
As we can see, the first line of the result is changed since we change the initialize in Dog class. And we do not need to define how the dog bark in the follow code since it has been defined in the Dog class. To further improve the code of this example, we can rewrite the Dog class again to make the speak method more specific. Codes shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
As we can found in the result, the speak method is revised. This result is exclusive for describing dog.&lt;br /&gt;
&lt;br /&gt;
If we just want to improve the functionality of the method in an ancestor class instead of rewriting it, we can use the keyword super in the code. Code for example is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    super&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
&lt;br /&gt;
From the result, we can see that both the speak methods in Animal class and Dog class are used.&lt;br /&gt;
&lt;br /&gt;
=Advantages and disadvantages of each languages applying method reimplementation=&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
It is a very flexible program language. It allows any method to be overridden, so we can be very convenient to get the method we want by overridden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Sometimes we do not require some methods in Smalltalk, but we still can override the methods which no longer need them. &lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java support the overriding methods, overloading methods, abstract methods, virtual methods, interfaces which make java be one of the top popular programming language today. We can reimplementation the methods by use the overriding and overloading methods. Abstract methods and virtual methods make the hierarchy structure colorful and clear. The interfaces of Java help to make some design patterns implementation easily. For example when we use the Strategy pattern, which clearly indicates a place in the design that will change, we should define the strategy as an interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java does not support the multiple inheritances. Compared with C++ which supports the multiple inheritances, C++ can provide more flexible way and more clear structure in class inheritance, which makes C++ sometimes a better choice for reimplementation methods in descendant classes.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
C++ provide the multiple inheritance which makes C++ much more flexible in reimplementation the methods. With the multiple inheritances, it makes some of the design patterns work better. One benefit from it is Adapter pattern: it uses multiple inheritances to adapt one interface to another. This pattern usually used to provide implementation for an abstract class (when you want to use an existing class and its interface is not appropriate, so you need to glue another interface with that class).&lt;br /&gt;
&lt;br /&gt;
The scope resolution operator in C++ is powerful enough. We can put the definition of the class in one file and use the scope resolution operator to implement the method in another file, which will make the whole structure more clear and it will help to add new method, overriding method, overloading method much easier.&lt;br /&gt;
&lt;br /&gt;
With the keywords “virtual” we can make the virtual method in C++ much more flexible. From the above examples you can see that the “virtual” keywords it helps us easy to fulfill the polymorphism, makes the program much more efficiently. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The multiple inheritances help us easy to reimplementation the method in subclass. But sometimes it causes some problems. With multiple inheritances, it makes the hierarchy of the program very complex. The programmers need to more time know the details of each base class. It will cause problem when using multiple inheritance is the diamond problem, which occurs when two classes are derived from a base class and another class is obtained by joining the derived classes together. If the derived classes override the same method from the base class when calling the method from the merged class and the joining class does also override that method, an ambiguity will rise. Another problem is that if two classes derived from the same base class. When we use these two classes to make multiple inheritance, it would make some base members duplicated.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java and C++, both as static OO languages, use overload and overridden methods in polymorphism to extend the flexibility of programming, since the property and method of class cannot be changed during the runtime. Compared with Java and C++, Ruby, as a dynamic OO language, allows change of property and method in the class in the runtime. For this reason, the method reimplementation becomes less essential as that in Java and C++. Ruby does not require using complicated mechanism to define the methods for disambiguation. Thus, Ruby is considered has better performance in reducing code and providing concise program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The disadvantage of Rudy, to some extent, also results from its dynamic characteristic. It become unsafe and unreliable compared with static typing OO language. For example, method in Ruby does not care about the type of parameter. It may cause problem when the type of parameter is essential for some application. Ruby cannot identify this wrong type error made by programmer.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt;=&lt;br /&gt;
Reimplementation of methods is one of the most essential features in Object-Oriented language. It expands the flexibility of polymorphism in which descendant class can define their own behaviors and functions more efficiently. There are different ways for various languages to define how to reuse methods. In details, we use codes of Smalltalk, Java, C++ and Ruby to demonstrate and analysis how methods are reused, following with the discussion of advantages and disadvantages of method reuse in these four languages. &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]:http://en.wikipedia.org/wiki/Method_(computer_programming)&lt;br /&gt;
*[2]:http://www.wisegeek.com/what-is-an-abstract-method.htm&lt;br /&gt;
*[3]:http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap6.html&lt;br /&gt;
*[4]:http://en.wikipedia.org/wiki/Function_overloading&lt;br /&gt;
*[5]:http://home.cogeco.ca/~ve3ll/jatutor5.htm&lt;br /&gt;
*[6]:http://en.wikipedia.org/wiki/Virtual_function#Java&lt;br /&gt;
*[7]:http://rubylearning.com/satishtalim/ruby_overloading_methods.html&lt;br /&gt;
*[8]:http://rubylearning.com/satishtalim/writing_own_ruby_methods.html&lt;br /&gt;
*[9]:http://learnruby.com/about-ruby.html&lt;br /&gt;
*[10]:http://www.pluitsolutions.com/2006/10/05/overriding-methods-in-ruby/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46532</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1i zf</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46532"/>
		<updated>2011-09-07T03:58:32Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* Ruby */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Fall 2010/ch1 1i zf&lt;br /&gt;
----&lt;br /&gt;
= Introduction =&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented languages], method is a subroutine which associates with the instances of the class to define the specific behavior of this class. In the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] of these languages, methods reimplementation is essential because descendant class inherited from the ancestor class in which properties and method have been defined to some extent. With the method reimplementation, coding can be more efficient and simple without rewriting the same code again and agian. However, in different OO languages, the ways of acquiring or allowing method reimplementation are significantly different. In this article, we are going to introduce these differences and provide code for better understanding.&lt;br /&gt;
&lt;br /&gt;
= Principle of method reimplementation in descendant class =&lt;br /&gt;
Method reimplementation is various in different OO languages according to their own programming rules and complier environments. And it also associated with inheritance between ancestor class and descendant class. Several terms of method are listed below.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Abstract method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_method Abstract method] is a method only has name but little or no implementation in the ancestor class, which must be also an abstract class. In most of the case, codes in abstract method are considered dummy but it does not mean useless. In fact, it provides a place for descendant class which inherited from the ancestor class to define specific behaviors and actions. &lt;br /&gt;
&lt;br /&gt;
For example, a toy company develops an ancestor class called “animal” which contains “dog”, “bird” and “fish” as its descendant classes. These subclasses have same characteristic such as color, size, price and behavior like move, speak. Here we use the abstract methods for move and speak so that the subclasses can define their own behaviors which act differently.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Virtual method&amp;lt;/b&amp;gt;==&lt;br /&gt;
Virtual method, or [http://en.wikipedia.org/wiki/Virtual_method virtual function], is the method that first declared or defined in the ancestor class and then completed defined in the descendant class. Based on the functionality in the subclasses, virtual method can be simply defined or overridden with details. In a virtual method in which only has the name but no implementation, we call this as pure virtual method, as known as abstract method introduced above.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overridden method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overridden method], as mentioned in virtual method, is used in OO language involving inheritance hierarchy.  It allows descendant classes to redefine the method in their ancestor class with more details and particular purposes. “Override” means the implementation in subclasses rewrites or redefines the original implementation of the method in their super class without changing the name, parameter and return type. To better demonstrate how overridden method work, we take the toy company example again. In the behavior aspect of “animal”, we have the method call “move”. In this method, we know it define the same of movement for all the animals. However, the way of movement among “dog”, “bird” and “fish” are different. Thus, in “dog” class, we may redefine the detail in move method as “I use leg”; in “bird” class, the detail of move method is “I use wings”; and in “fish” class, the detail of move method is “I use fin”.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overloaded method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overload Overloaded method] means that method share the same name with other method but may be different in other aspects such as parameter, number of parameter and data type.&lt;br /&gt;
And the correct method will be executed automatically during the runtime depends on how it is called.&lt;br /&gt;
&lt;br /&gt;
= Method reimplementation in different languages =&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] language, we can use the inheritance to reimplementation the methods. Inheritance is very useful in Smalltalk which makes the Smalltalk language reusability and extensibility.&lt;br /&gt;
There are two ways to modify the behavior of the methods in Smalltalk by inheritance. One is adding new methods and the other is overriding the inherited method.&lt;br /&gt;
&lt;br /&gt;
===Adding Methods===&lt;br /&gt;
Adding new method is very simple; we can add either instance or class methods, to the class definition. The following diagrams show how the adding method works:&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|+&amp;lt;b&amp;gt;ClassRoom’s Methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;Room instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Room_Number&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Room_Size&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Open_Window&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Open_Door&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;ClassRoom instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Turn_On_Computer&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Clean_Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ClassRoom class is specific types of Room. The ClassRoom class is inheriting from Room Class, so the new methods Turn_On_Computer and Clean_Blackboard will add to the ClassRoom class. Now ClassRoom class definition can now support all of the messages or methods in Room and the two new messages.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
Overriding an inherited method is very important way to provide unique behaviors to a class. If an object receives a message which we have a method in the class definition for that massage, the object will work its way up the hierarchy until it finds a method with that name. We cannot delete the inherited methods, if we do not need the method in the superclass, we can provide a method by the same name with the superclass in the subclass with no code in the method. In this way, we can simply replace the behavior of the superclass behavior by no behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
We can use the inheritance to make the method reimplementation in [http://en.wikipedia.org/wiki/Java Java]. They are similar with the ways we do in Smalltalk, like the overriding and overloading. But in Java, we can define abstract method and virtual method in Java, and it provides a @override tag that prevents the programmer from thinking another method is being overridden when really it is not.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
If we want to override a method in subclass that inherited from the superclass, we should invoke the superclass method by using the keyword super.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Say {&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd!”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Class Say represents the superclass and implements a method call express (). The subclass called Shout will inherit all the methods which in the Say class. But the class Shout will override the method express in Shout class, and replace it with new action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Say hello_say = new Say();&lt;br /&gt;
hello_say.express();     // Prints “Hello wolrd!”&lt;br /&gt;
&lt;br /&gt;
Say hello_shout = new Shout();   //Polymorphism&lt;br /&gt;
hello_shout.express();   //Prints “Hello wolrd, loudly!”&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The super can be used to call the superclass's method; we can modify the class in class Shout to make the method express call another express method which in superclass Say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
		Super.express();  //will call the express method in class Say&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But some of the methods cannot be overridden. For example, in Java, a method that is declared final in the super class cannot be overridden, and the method declared private or static cannot be overridden too. We cannot make a class that that is declared final to become a super class too.&lt;br /&gt;
&lt;br /&gt;
===Overloaded method===&lt;br /&gt;
&lt;br /&gt;
Java supports method overloading which allows the creation of several methods with the same method name, but different in their types of input and output of the function.&lt;br /&gt;
We can define two methods with the same name in Java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int Add(int a, int b) {	&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&lt;br /&gt;
float Add(float a, float b) {&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods have the same method name in define. To call the methods, we should pass the parameters to the methods above. When we call Add(1,1) it will call the first method Add(int a, int b), because we pass two int types of the parameters to the method Add. And if we call Add(1.0,1.0) it will call the second method Add(float a, float b) because we pass the float types of the parameters to the method Add. But if we give these two methods parameters a, b with default value, it will cause an error, which would result in an ambiguous call error, as the compiler wouldn’t know which of the two methods to use.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method===&lt;br /&gt;
Abstract method: When a class contains an abstract method, that class must be declared as abstract. The abstract method has no implementation and thus, classes that derive from that abstract class, must provide an implementation for this abstract method.&lt;br /&gt;
&lt;br /&gt;
Abstract method are the method that with no body specification. Subclasses must provide the method statements to fulfill the abstract method. Especially, if the method was one provided by the superclass, we should override them in each subclass. If we forgot to override that will cause some problem like that the applied method statement may be inappropriate. &lt;br /&gt;
Below is the abstract method example, we need to define the abstract method in subclass to reimplementation the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Vehicle  // class is abstract&lt;br /&gt;
{&lt;br /&gt;
  private String name;&lt;br /&gt;
  public Vehicle (String nm)      // constructor method&lt;br /&gt;
  { name=nm; }&lt;br /&gt;
  public String getName()       // regular method&lt;br /&gt;
  { return (name); }&lt;br /&gt;
  public abstract void run(); // abstract method - note no {}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method===&lt;br /&gt;
&lt;br /&gt;
Virtual method: A class can have a virtual method. The virtual method has an implementation. When you inherit from a class that has a virtual method, you can override the virtual method and provide additional logic, or replace the logic with your own implementation.&lt;br /&gt;
A virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.&lt;br /&gt;
In java, all the non-static methods with the default type “virtual function”. But if the methods marked with the keyword final, which cannot be overridden. The private methods are non-virtual which cannot be inherited.&lt;br /&gt;
Below is the example for Virtual Method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class toy&lt;br /&gt;
{&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
     System.out.println(“I am toy.”);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
     List&amp;lt;toy&amp;gt; toys = new LinkedList&amp;lt;toy&amp;gt;();&lt;br /&gt;
	&lt;br /&gt;
     toys.add(new toy());&lt;br /&gt;
     toys.add(new toy_man());&lt;br /&gt;
     toys.add(new toy_car());&lt;br /&gt;
&lt;br /&gt;
     for(toy current_toy : toys)&lt;br /&gt;
     {&lt;br /&gt;
	current_toy.say();&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_man extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_man.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_car extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_car.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am toy.&lt;br /&gt;
I am toy_man.&lt;br /&gt;
I am toy_car.&lt;br /&gt;
&lt;br /&gt;
===Interfaces===&lt;br /&gt;
In java interfaces are very similar with the abstract classes but all the methods in interfaces are abstract and all properties are static final. As the abstract classes, interfaces also can be inherited. And we also use the extends keywords too. Different from C++, in Java we cannot use the multiple inheritances for class, which means that a subclass extends from more than one superclass. An interface can tie elements of several classes together, and it also can separate design from coding as class method headers are specified but not their body.&lt;br /&gt;
For example we build a running interface for the subclasses of Vehicle. Because there is a method called stop(), we should define the method in any class which using the running interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface running&lt;br /&gt;
{&lt;br /&gt;
  public void stop();&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When we create a class that will use the interface, we should use the keywords implements which will follow one or more interface list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Vehicle_Run extends Vehicle implements running&lt;br /&gt;
{&lt;br /&gt;
    public Vehicle_Run (String nm)&lt;br /&gt;
    {&lt;br /&gt;
       super(nm);    // builds ala parent&lt;br /&gt;
    }&lt;br /&gt;
    public void run ()&lt;br /&gt;
    {&lt;br /&gt;
       System.out.println(&amp;quot;I am running.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public void stop ()  // this method specific to Vehicle_Run&lt;br /&gt;
   {&lt;br /&gt;
       System.out.println(&amp;quot;I stop.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is very similar with Java in method overriding and method overloading. The method overloading of C++ we can refer the method overloading in Java. But they have difference in method overriding between C++ and Java.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
C++ does not provide the keyword super that a subclass can use in Java to invoke a superclass version of a method that it wants to override. But in C++ we can use the base class follow with the scope resolution operator to override the superclass method.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy(char* nm, int s):name(name),size(s){}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
private:&lt;br /&gt;
	char* name;&lt;br /&gt;
	int size;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy::print() const{  // print() method of base class&lt;br /&gt;
	std::cout&amp;lt;&amp;lt;”Name = ” &amp;lt;&amp;lt; this-&amp;gt;name &amp;lt;&amp;lt; “; Size = ” &amp;lt;&amp;lt; this-&amp;gt;size;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Toy_car: public Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy_car(char * nm, int s, int t) : Toy(nm,s), type(t) {}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
	int type;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy_car::print() const{&lt;br /&gt;
	Toy::print();&lt;br /&gt;
	Std::cout&amp;lt;&amp;lt;”; Type = ” &amp;lt;&amp;lt; this-&amp;gt; type;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main method will call the print method in class Toy and class Toy_car separately.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Int main(int argc, char** argv) {&lt;br /&gt;
	Toy toy_test(“Jack”, 9);&lt;br /&gt;
        Toy_test.print();&lt;br /&gt;
        //outputs:&lt;br /&gt;
        //Name = Jack; Size = 9&lt;br /&gt;
&lt;br /&gt;
        Toy_car toy_car_test(“Ann”,”7”,”1”);&lt;br /&gt;
        //the pointer to the most overridden method in the vtable in on Toy_car::print&lt;br /&gt;
        toy_car_test.print();// but this call does not illustrate overriding&lt;br /&gt;
        static_cast&amp;lt;Toy&amp;amp;&amp;gt;(toy_car_test).print(); // this one does&lt;br /&gt;
        //output&lt;br /&gt;
        // Name = Jack; Size = 9;Type = 1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method=== &lt;br /&gt;
&lt;br /&gt;
In C++ we declare the virtual method by add the virtual keyword before the function’s declaration. The concept of the virtual method is nearly the same with that in Java, but the function in C++ is not default by “virtual function”.&lt;br /&gt;
Below is the example of virtual method in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
	public:&lt;br /&gt;
		virtual void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_car : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_car.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_man : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_man.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	std::vector&amp;lt;Toy*&amp;gt;  toys;&lt;br /&gt;
	toys.push_back(new Toy()) ;&lt;br /&gt;
        toys.push_back(new Toy_car()) ;&lt;br /&gt;
        toys.push_back(new Toy_man()) ;&lt;br /&gt;
	&lt;br /&gt;
        for(std::vector&amp;lt;Toy*&amp;gt;::const_iterator  it = toys.begin() ;  it != toys.end(); ++it){&lt;br /&gt;
	   (*it)-&amp;gt;say();&lt;br /&gt;
	   delete *it;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy_car.&lt;br /&gt;
I am Toy_man.&lt;br /&gt;
&lt;br /&gt;
If we do not declare Toy::say() as virtual, the result will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
Different with Java and C, [http://en.wikipedia.org/wiki/Ruby Ruby] is a dynamic Object-orientated Language. It allows default parameter and variable parameter used in the method. Therefore, there is no strict classification of overridden method and overloaded method. &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method with default parameter&amp;lt;/b&amp;gt;===&lt;br /&gt;
With the code below, we can better understand this concept:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( x, y, z=1 )&lt;br /&gt;
 x+y+z&lt;br /&gt;
end&lt;br /&gt;
puts sum(10,20,30)&lt;br /&gt;
puts sum(5.0,10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
60&lt;br /&gt;
16.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( *num )&lt;br /&gt;
totalSum = 0&lt;br /&gt;
num.each { |i| totalSum+=i }&lt;br /&gt;
return totalSum&lt;br /&gt;
end&lt;br /&gt;
puts sum(1,10,100) &lt;br /&gt;
puts sum(2.2,3.3,4.4) &lt;br /&gt;
puts sum()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
111&lt;br /&gt;
9.9&lt;br /&gt;
0&lt;br /&gt;
&lt;br /&gt;
From the output we can see Ruby allow default parameter regardless the number and the type of parameter. Unlike the limitation in other static OO language, Ruby can dynamically execute codes in runtime. Therefore, the reimplementation in Ruby become less important compared with other static languages. Several ways can be used for method reimplementation in Ruby. For example, just simply extend classes. Or re-declare an existing class with new methods. To better demonstrate how these two approaches work, we use the code example as below:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method extended from class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Animal&lt;br /&gt;
attr_accessor:voice&lt;br /&gt;
  def initialize(v)&lt;br /&gt;
    puts &amp;quot;This is an animal.&amp;quot;&lt;br /&gt;
    self.voice=v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;This animal can speak&amp;quot;+self.voice&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new(&amp;quot; bow-wow!!&amp;quot;)&lt;br /&gt;
d.speak &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is an animal.&lt;br /&gt;
This animal can speak bow-wow!!&lt;br /&gt;
&lt;br /&gt;
As we can see, we just simply create a descendant class Dog and use the default method in the ancestor class Animal. The dog can bark as “bow-wow”, so we use the voice parameter to make it particular for dog.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; New method in the descendant class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Also, we can change the code of descendant class Dog since every dog can bark. Code shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new&lt;br /&gt;
d.speak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
&lt;br /&gt;
As we can see, the first line of the result is changed since we change the initialize in Dog class. And we do not need to define how the dog bark in the follow code since it has been defined in the Dog class. To further improve the code of this example, we can rewrite the Dog class again to make the speak method more specific. Codes shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
As we can found in the result, the speak method is revised. This result is exclusive for describing dog.&lt;br /&gt;
&lt;br /&gt;
If we just want to improve the functionality of the method in an ancestor class instead of rewriting it, we can use the keyword super in the code. Code for example is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    super&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
&lt;br /&gt;
From the result, we can see that both the speak methods in Animal class and Dog class are used.&lt;br /&gt;
&lt;br /&gt;
=Advantages and disadvantages of each languages applying method reimplementation=&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
It is a very flexible program language. It allows any method to be overridden, so we can be very convenient to get the method we want by overridden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Sometimes we do not require some methods in Smalltalk, but we still can override the methods which no longer need them. &lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java support the overriding methods, overloading methods, abstract methods, virtual methods, interfaces which make java be one of the top popular programming language today. We can reimplementation the methods by use the overriding and overloading methods. Abstract methods and virtual methods make the hierarchy structure colorful and clear. The interfaces of Java help to make some design patterns implementation easily. For example when we use the Strategy pattern, which clearly indicates a place in the design that will change, we should define the strategy as an interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java does not support the multiple inheritances. Compared with C++ which supports the multiple inheritances, C++ can provide more flexible way and more clear structure in class inheritance, which makes C++ sometimes a better choice for reimplementation methods in descendant classes.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
C++ provide the multiple inheritance which makes C++ much more flexible in reimplementation the methods. With the multiple inheritances, it makes some of the design patterns work better. One benefit from it is Adapter pattern: it uses multiple inheritances to adapt one interface to another. This pattern usually used to provide implementation for an abstract class (when you want to use an existing class and its interface is not appropriate, so you need to glue another interface with that class).&lt;br /&gt;
&lt;br /&gt;
The scope resolution operator in C++ is powerful enough. We can put the definition of the class in one file and use the scope resolution operator to implement the method in another file, which will make the whole structure more clear and it will help to add new method, overriding method, overloading method much easier.&lt;br /&gt;
&lt;br /&gt;
With the keywords “virtual” we can make the virtual method in C++ much more flexible. From the above examples you can see that the “virtual” keywords it helps us easy to fulfill the polymorphism, makes the program much more efficiently. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The multiple inheritances help us easy to reimplementation the method in subclass. But sometimes it causes some problems. With multiple inheritances, it makes the hierarchy of the program very complex. The programmers need to more time know the details of each base class. It will cause problem when using multiple inheritance is the diamond problem, which occurs when two classes are derived from a base class and another class is obtained by joining the derived classes together. If the derived classes override the same method from the base class when calling the method from the merged class and the joining class does also override that method, an ambiguity will rise. Another problem is that if two classes derived from the same base class. When we use these two classes to make multiple inheritance, it would make some base members duplicated.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java and C++, both as static OO languages, use overload and overridden methods in polymorphism to extend the flexibility of programming, since the property and method of class cannot be changed during the runtime. Compared with Java and C++, Ruby, as a dynamic OO language, allows change of property and method in the class in the runtime. For this reason, the method reimplementation becomes less essential as that in Java and C++. Ruby does not require using complicated mechanism to define the methods for disambiguation. Thus, Ruby is considered has better performance in reducing code and providing concise program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The disadvantage of Rudy, to some extent, also results from its dynamic characteristic. It become unsafe and unreliable compared with static typing OO language. For example, method in Ruby does not care about the type of parameter. It may cause problem when the type of parameter is essential for some application. Ruby cannot identify this wrong type error made by programmer.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt;=&lt;br /&gt;
Reimplementation of methods is one of the most essential features in Object-Oriented language. It expands the flexibility of polymorphism in which descendant class can define their own behaviors and functions more efficiently. There are different ways for various languages to define how to reuse methods. In details, we use codes of Smalltalk, Java, C++ and Ruby to demonstrate and analysis how methods are reused, following with the discussion of advantages and disadvantages of method reuse in these four languages. &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]:http://en.wikipedia.org/wiki/Method_(computer_programming)&lt;br /&gt;
*[2]:http://www.wisegeek.com/what-is-an-abstract-method.htm&lt;br /&gt;
*[3]:http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap6.html&lt;br /&gt;
*[4]:http://en.wikipedia.org/wiki/Function_overloading&lt;br /&gt;
*[5]:http://home.cogeco.ca/~ve3ll/jatutor5.htm&lt;br /&gt;
*[6]:http://en.wikipedia.org/wiki/Virtual_function#Java&lt;br /&gt;
*[7]:http://rubylearning.com/satishtalim/ruby_overloading_methods.html&lt;br /&gt;
*[8]:http://rubylearning.com/satishtalim/writing_own_ruby_methods.html&lt;br /&gt;
*[9]:http://learnruby.com/about-ruby.html&lt;br /&gt;
*[10]:http://www.pluitsolutions.com/2006/10/05/overriding-methods-in-ruby/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46531</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1i zf</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1i_zf&amp;diff=46531"/>
		<updated>2011-09-07T03:57:49Z</updated>

		<summary type="html">&lt;p&gt;Xfang2: /* C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Fall 2010/ch1 1i zf&lt;br /&gt;
----&lt;br /&gt;
= Introduction =&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented languages], method is a subroutine which associates with the instances of the class to define the specific behavior of this class. In the [http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming) inheritance] of these languages, methods reimplementation is essential because descendant class inherited from the ancestor class in which properties and method have been defined to some extent. With the method reimplementation, coding can be more efficient and simple without rewriting the same code again and agian. However, in different OO languages, the ways of acquiring or allowing method reimplementation are significantly different. In this article, we are going to introduce these differences and provide code for better understanding.&lt;br /&gt;
&lt;br /&gt;
= Principle of method reimplementation in descendant class =&lt;br /&gt;
Method reimplementation is various in different OO languages according to their own programming rules and complier environments. And it also associated with inheritance between ancestor class and descendant class. Several terms of method are listed below.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Abstract method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Abstract_method Abstract method] is a method only has name but little or no implementation in the ancestor class, which must be also an abstract class. In most of the case, codes in abstract method are considered dummy but it does not mean useless. In fact, it provides a place for descendant class which inherited from the ancestor class to define specific behaviors and actions. &lt;br /&gt;
&lt;br /&gt;
For example, a toy company develops an ancestor class called “animal” which contains “dog”, “bird” and “fish” as its descendant classes. These subclasses have same characteristic such as color, size, price and behavior like move, speak. Here we use the abstract methods for move and speak so that the subclasses can define their own behaviors which act differently.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Virtual method&amp;lt;/b&amp;gt;==&lt;br /&gt;
Virtual method, or [http://en.wikipedia.org/wiki/Virtual_method virtual function], is the method that first declared or defined in the ancestor class and then completed defined in the descendant class. Based on the functionality in the subclasses, virtual method can be simply defined or overridden with details. In a virtual method in which only has the name but no implementation, we call this as pure virtual method, as known as abstract method introduced above.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overridden method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overridden method], as mentioned in virtual method, is used in OO language involving inheritance hierarchy.  It allows descendant classes to redefine the method in their ancestor class with more details and particular purposes. “Override” means the implementation in subclasses rewrites or redefines the original implementation of the method in their super class without changing the name, parameter and return type. To better demonstrate how overridden method work, we take the toy company example again. In the behavior aspect of “animal”, we have the method call “move”. In this method, we know it define the same of movement for all the animals. However, the way of movement among “dog”, “bird” and “fish” are different. Thus, in “dog” class, we may redefine the detail in move method as “I use leg”; in “bird” class, the detail of move method is “I use wings”; and in “fish” class, the detail of move method is “I use fin”.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Overloaded method&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overload Overloaded method] means that method share the same name with other method but may be different in other aspects such as parameter, number of parameter and data type.&lt;br /&gt;
And the correct method will be executed automatically during the runtime depends on how it is called.&lt;br /&gt;
&lt;br /&gt;
= Method reimplementation in different languages =&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
In [http://en.wikipedia.org/wiki/Smalltalk Smalltalk] language, we can use the inheritance to reimplementation the methods. Inheritance is very useful in Smalltalk which makes the Smalltalk language reusability and extensibility.&lt;br /&gt;
There are two ways to modify the behavior of the methods in Smalltalk by inheritance. One is adding new methods and the other is overriding the inherited method.&lt;br /&gt;
&lt;br /&gt;
===Adding Methods===&lt;br /&gt;
Adding new method is very simple; we can add either instance or class methods, to the class definition. The following diagrams show how the adding method works:&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|+&amp;lt;b&amp;gt;ClassRoom’s Methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;Room instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Room_Number&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Room_Size&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Open_Window&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |    Open_Door&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=1 align = center&lt;br /&gt;
|-&lt;br /&gt;
|  &amp;lt;b&amp;gt;ClassRoom instance methods&amp;lt;/b&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Turn_On_Computer&lt;br /&gt;
|-&lt;br /&gt;
|  align = center       |     Clean_Blackboard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The ClassRoom class is specific types of Room. The ClassRoom class is inheriting from Room Class, so the new methods Turn_On_Computer and Clean_Blackboard will add to the ClassRoom class. Now ClassRoom class definition can now support all of the messages or methods in Room and the two new messages.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
Overriding an inherited method is very important way to provide unique behaviors to a class. If an object receives a message which we have a method in the class definition for that massage, the object will work its way up the hierarchy until it finds a method with that name. We cannot delete the inherited methods, if we do not need the method in the superclass, we can provide a method by the same name with the superclass in the subclass with no code in the method. In this way, we can simply replace the behavior of the superclass behavior by no behavior.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
We can use the inheritance to make the method reimplementation in [http://en.wikipedia.org/wiki/Java Java]. They are similar with the ways we do in Smalltalk, like the overriding and overloading. But in Java, we can define abstract method and virtual method in Java, and it provides a @override tag that prevents the programmer from thinking another method is being overridden when really it is not.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
If we want to override a method in subclass that inherited from the superclass, we should invoke the superclass method by using the keyword super.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Say {&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd!”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Class Say represents the superclass and implements a method call express (). The subclass called Shout will inherit all the methods which in the Say class. But the class Shout will override the method express in Shout class, and replace it with new action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Say hello_say = new Say();&lt;br /&gt;
hello_say.express();     // Prints “Hello wolrd!”&lt;br /&gt;
&lt;br /&gt;
Say hello_shout = new Shout();   //Polymorphism&lt;br /&gt;
hello_shout.express();   //Prints “Hello wolrd, loudly!”&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The super can be used to call the superclass's method; we can modify the class in class Shout to make the method express call another express method which in superclass Say.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Shout extends Say {&lt;br /&gt;
	@Override // @Override annotation in Java 5 is optional but helpful.&lt;br /&gt;
	public void express() {&lt;br /&gt;
		System.out.println(“Hello wolrd, loudly! ”);&lt;br /&gt;
		Super.express();  //will call the express method in class Say&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But some of the methods cannot be overridden. For example, in Java, a method that is declared final in the super class cannot be overridden, and the method declared private or static cannot be overridden too. We cannot make a class that that is declared final to become a super class too.&lt;br /&gt;
&lt;br /&gt;
===Overloaded method===&lt;br /&gt;
&lt;br /&gt;
Java supports method overloading which allows the creation of several methods with the same method name, but different in their types of input and output of the function.&lt;br /&gt;
We can define two methods with the same name in Java:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int Add(int a, int b) {	&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&lt;br /&gt;
float Add(float a, float b) {&lt;br /&gt;
	return a + b;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two methods have the same method name in define. To call the methods, we should pass the parameters to the methods above. When we call Add(1,1) it will call the first method Add(int a, int b), because we pass two int types of the parameters to the method Add. And if we call Add(1.0,1.0) it will call the second method Add(float a, float b) because we pass the float types of the parameters to the method Add. But if we give these two methods parameters a, b with default value, it will cause an error, which would result in an ambiguous call error, as the compiler wouldn’t know which of the two methods to use.&lt;br /&gt;
&lt;br /&gt;
===Abstract Method===&lt;br /&gt;
Abstract method: When a class contains an abstract method, that class must be declared as abstract. The abstract method has no implementation and thus, classes that derive from that abstract class, must provide an implementation for this abstract method.&lt;br /&gt;
&lt;br /&gt;
Abstract method are the method that with no body specification. Subclasses must provide the method statements to fulfill the abstract method. Especially, if the method was one provided by the superclass, we should override them in each subclass. If we forgot to override that will cause some problem like that the applied method statement may be inappropriate. &lt;br /&gt;
Below is the abstract method example, we need to define the abstract method in subclass to reimplementation the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public abstract class Vehicle  // class is abstract&lt;br /&gt;
{&lt;br /&gt;
  private String name;&lt;br /&gt;
  public Vehicle (String nm)      // constructor method&lt;br /&gt;
  { name=nm; }&lt;br /&gt;
  public String getName()       // regular method&lt;br /&gt;
  { return (name); }&lt;br /&gt;
  public abstract void run(); // abstract method - note no {}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method===&lt;br /&gt;
&lt;br /&gt;
Virtual method: A class can have a virtual method. The virtual method has an implementation. When you inherit from a class that has a virtual method, you can override the virtual method and provide additional logic, or replace the logic with your own implementation.&lt;br /&gt;
A virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature.&lt;br /&gt;
In java, all the non-static methods with the default type “virtual function”. But if the methods marked with the keyword final, which cannot be overridden. The private methods are non-virtual which cannot be inherited.&lt;br /&gt;
Below is the example for Virtual Method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class toy&lt;br /&gt;
{&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
     System.out.println(“I am toy.”);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
     List&amp;lt;toy&amp;gt; toys = new LinkedList&amp;lt;toy&amp;gt;();&lt;br /&gt;
	&lt;br /&gt;
     toys.add(new toy());&lt;br /&gt;
     toys.add(new toy_man());&lt;br /&gt;
     toys.add(new toy_car());&lt;br /&gt;
&lt;br /&gt;
     for(toy current_toy : toys)&lt;br /&gt;
     {&lt;br /&gt;
	current_toy.say();&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_man extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_man.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public class toy_car extends toy&lt;br /&gt;
{&lt;br /&gt;
   @Override&lt;br /&gt;
   public void say()&lt;br /&gt;
   {&lt;br /&gt;
      System.out.println(“I am toy_car.”);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am toy.&lt;br /&gt;
I am toy_man.&lt;br /&gt;
I am toy_car.&lt;br /&gt;
&lt;br /&gt;
===Interfaces===&lt;br /&gt;
In java interfaces are very similar with the abstract classes but all the methods in interfaces are abstract and all properties are static final. As the abstract classes, interfaces also can be inherited. And we also use the extends keywords too. Different from C++, in Java we cannot use the multiple inheritances for class, which means that a subclass extends from more than one superclass. An interface can tie elements of several classes together, and it also can separate design from coding as class method headers are specified but not their body.&lt;br /&gt;
For example we build a running interface for the subclasses of Vehicle. Because there is a method called stop(), we should define the method in any class which using the running interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public interface running&lt;br /&gt;
{&lt;br /&gt;
  public void stop();&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When we create a class that will use the interface, we should use the keywords implements which will follow one or more interface list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public class Vehicle_Run extends Vehicle implements running&lt;br /&gt;
{&lt;br /&gt;
    public Vehicle_Run (String nm)&lt;br /&gt;
    {&lt;br /&gt;
       super(nm);    // builds ala parent&lt;br /&gt;
    }&lt;br /&gt;
    public void run ()&lt;br /&gt;
    {&lt;br /&gt;
       System.out.println(&amp;quot;I am running.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    public void stop ()  // this method specific to Vehicle_Run&lt;br /&gt;
   {&lt;br /&gt;
       System.out.println(&amp;quot;I stop.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
[http://en.wikipedia.org/wiki/C%2B%2B C++] is very similar with Java in method overriding and method overloading. The method overloading of C++ we can refer the method overloading in Java. But they have difference in method overriding between C++ and Java.&lt;br /&gt;
&lt;br /&gt;
===Overridden method===&lt;br /&gt;
C++ does not provide the keyword super that a subclass can use in Java to invoke a superclass version of a method that it wants to override. But in C++ we can use the base class follow with the scope resolution operator to override the superclass method.&lt;br /&gt;
Below is the example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy(char* nm, int s):name(name),size(s){}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
private:&lt;br /&gt;
	char* name;&lt;br /&gt;
	int size;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy::print() const{  // print() method of base class&lt;br /&gt;
	std::cout&amp;lt;&amp;lt;”Name = ” &amp;lt;&amp;lt; this-&amp;gt;name &amp;lt;&amp;lt; “; Size = ” &amp;lt;&amp;lt; this-&amp;gt;size;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Toy_car: public Toy {&lt;br /&gt;
public:&lt;br /&gt;
	Toy_car(char * nm, int s, int t) : Toy(nm,s), type(t) {}&lt;br /&gt;
	virtual void print() const;&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
	int type;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
void Toy_car::print() const{&lt;br /&gt;
	Toy::print();&lt;br /&gt;
	Std::cout&amp;lt;&amp;lt;”; Type = ” &amp;lt;&amp;lt; this-&amp;gt; type;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main method will call the print method in class Toy and class Toy_car separately.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Int main(int argc, char** argv) {&lt;br /&gt;
	Toy toy_test(“Jack”, 9);&lt;br /&gt;
        Toy_test.print();&lt;br /&gt;
        //outputs:&lt;br /&gt;
        //Name = Jack; Size = 9&lt;br /&gt;
&lt;br /&gt;
        Toy_car toy_car_test(“Ann”,”7”,”1”);&lt;br /&gt;
        //the pointer to the most overridden method in the vtable in on Toy_car::print&lt;br /&gt;
        toy_car_test.print();// but this call does not illustrate overriding&lt;br /&gt;
        static_cast&amp;lt;Toy&amp;amp;&amp;gt;(toy_car_test).print(); // this one does&lt;br /&gt;
        //output&lt;br /&gt;
        // Name = Jack; Size = 9;Type = 1&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Virtual Method=== &lt;br /&gt;
&lt;br /&gt;
In C++ we declare the virtual method by add the virtual keyword before the function’s declaration. The concept of the virtual method is nearly the same with that in Java, but the function in C++ is not default by “virtual function”.&lt;br /&gt;
Below is the example of virtual method in C++.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Toy {&lt;br /&gt;
	public:&lt;br /&gt;
		virtual void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_car : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_car.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class Toy_man : public Toy{&lt;br /&gt;
	public:&lt;br /&gt;
		void say() const {&lt;br /&gt;
			std::cout &amp;lt;&amp;lt; “I am Toy_man.” &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
	std::vector&amp;lt;Toy*&amp;gt;  toys;&lt;br /&gt;
	toys.push_back(new Toy()) ;&lt;br /&gt;
        toys.push_back(new Toy_car()) ;&lt;br /&gt;
        toys.push_back(new Toy_man()) ;&lt;br /&gt;
	&lt;br /&gt;
        for(std::vector&amp;lt;Toy*&amp;gt;::const_iterator  it = toys.begin() ;  it != toys.end(); ++it){&lt;br /&gt;
	   (*it)-&amp;gt;say();&lt;br /&gt;
	   delete *it;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy_car.&lt;br /&gt;
I am Toy_man.&lt;br /&gt;
&lt;br /&gt;
If we do not declare Toy::say() as virtual, the result will be:&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
I am Toy.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
Different with Java and C, Ruby is a dynamic Object-orientated Language. It allows default parameter and variable parameter used in the method. Therefore, there is no strict classification of overridden method and overloaded method. &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method with default parameter&amp;lt;/b&amp;gt;===&lt;br /&gt;
With the code below, we can better understand this concept:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( x, y, z=1 )&lt;br /&gt;
 x+y+z&lt;br /&gt;
end&lt;br /&gt;
puts sum(10,20,30)&lt;br /&gt;
puts sum(5.0,10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
60&lt;br /&gt;
16.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def sum( *num )&lt;br /&gt;
totalSum = 0&lt;br /&gt;
num.each { |i| totalSum+=i }&lt;br /&gt;
return totalSum&lt;br /&gt;
end&lt;br /&gt;
puts sum(1,10,100) &lt;br /&gt;
puts sum(2.2,3.3,4.4) &lt;br /&gt;
puts sum()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
111&lt;br /&gt;
9.9&lt;br /&gt;
0&lt;br /&gt;
&lt;br /&gt;
From the output we can see Ruby allow default parameter regardless the number and the type of parameter. Unlike the limitation in other static OO language, Ruby can dynamically execute codes in runtime. Therefore, the reimplementation in Ruby become less important compared with other static languages. Several ways can be used for method reimplementation in Ruby. For example, just simply extend classes. Or re-declare an existing class with new methods. To better demonstrate how these two approaches work, we use the code example as below:&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; Method extended from class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Animal&lt;br /&gt;
attr_accessor:voice&lt;br /&gt;
  def initialize(v)&lt;br /&gt;
    puts &amp;quot;This is an animal.&amp;quot;&lt;br /&gt;
    self.voice=v&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;This animal can speak&amp;quot;+self.voice&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new(&amp;quot; bow-wow!!&amp;quot;)&lt;br /&gt;
d.speak &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is an animal.&lt;br /&gt;
This animal can speak bow-wow!!&lt;br /&gt;
&lt;br /&gt;
As we can see, we just simply create a descendant class Dog and use the default method in the ancestor class Animal. The dog can bark as “bow-wow”, so we use the voice parameter to make it particular for dog.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;b&amp;gt; New method in the descendant class&amp;lt;/b&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Also, we can change the code of descendant class Dog since every dog can bark. Code shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
d=Dog.new&lt;br /&gt;
d.speak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
&lt;br /&gt;
As we can see, the first line of the result is changed since we change the initialize in Dog class. And we do not need to define how the dog bark in the follow code since it has been defined in the Dog class. To further improve the code of this example, we can rewrite the Dog class again to make the speak method more specific. Codes shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
As we can found in the result, the speak method is revised. This result is exclusive for describing dog.&lt;br /&gt;
&lt;br /&gt;
If we just want to improve the functionality of the method in an ancestor class instead of rewriting it, we can use the keyword super in the code. Code for example is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Dog&amp;lt;Animal&lt;br /&gt;
  def initialize&lt;br /&gt;
    puts &amp;quot;This is a dog.&amp;quot;&lt;br /&gt;
    self.voice=&amp;quot; bow-wow&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
  def speak&lt;br /&gt;
    super&lt;br /&gt;
    puts &amp;quot;i am a dog and i can speak like this:&amp;quot;+self.voice&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output of this code is &lt;br /&gt;
This is a dog.&lt;br /&gt;
This animal can speak bow-wow&lt;br /&gt;
i am a dog and i can speak like this: bow-wow &lt;br /&gt;
&lt;br /&gt;
From the result, we can see that both the speak methods in Animal class and Dog class are used.&lt;br /&gt;
&lt;br /&gt;
=Advantages and disadvantages of each languages applying method reimplementation=&lt;br /&gt;
==&amp;lt;b&amp;gt;Smalltalk&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
It is a very flexible program language. It allows any method to be overridden, so we can be very convenient to get the method we want by overridden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Sometimes we do not require some methods in Smalltalk, but we still can override the methods which no longer need them. &lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Java&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java support the overriding methods, overloading methods, abstract methods, virtual methods, interfaces which make java be one of the top popular programming language today. We can reimplementation the methods by use the overriding and overloading methods. Abstract methods and virtual methods make the hierarchy structure colorful and clear. The interfaces of Java help to make some design patterns implementation easily. For example when we use the Strategy pattern, which clearly indicates a place in the design that will change, we should define the strategy as an interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java does not support the multiple inheritances. Compared with C++ which supports the multiple inheritances, C++ can provide more flexible way and more clear structure in class inheritance, which makes C++ sometimes a better choice for reimplementation methods in descendant classes.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;C++&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
C++ provide the multiple inheritance which makes C++ much more flexible in reimplementation the methods. With the multiple inheritances, it makes some of the design patterns work better. One benefit from it is Adapter pattern: it uses multiple inheritances to adapt one interface to another. This pattern usually used to provide implementation for an abstract class (when you want to use an existing class and its interface is not appropriate, so you need to glue another interface with that class).&lt;br /&gt;
&lt;br /&gt;
The scope resolution operator in C++ is powerful enough. We can put the definition of the class in one file and use the scope resolution operator to implement the method in another file, which will make the whole structure more clear and it will help to add new method, overriding method, overloading method much easier.&lt;br /&gt;
&lt;br /&gt;
With the keywords “virtual” we can make the virtual method in C++ much more flexible. From the above examples you can see that the “virtual” keywords it helps us easy to fulfill the polymorphism, makes the program much more efficiently. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The multiple inheritances help us easy to reimplementation the method in subclass. But sometimes it causes some problems. With multiple inheritances, it makes the hierarchy of the program very complex. The programmers need to more time know the details of each base class. It will cause problem when using multiple inheritance is the diamond problem, which occurs when two classes are derived from a base class and another class is obtained by joining the derived classes together. If the derived classes override the same method from the base class when calling the method from the merged class and the joining class does also override that method, an ambiguity will rise. Another problem is that if two classes derived from the same base class. When we use these two classes to make multiple inheritance, it would make some base members duplicated.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;b&amp;gt;Ruby&amp;lt;/b&amp;gt;==&lt;br /&gt;
&amp;lt;b&amp;gt;Advantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
Java and C++, both as static OO languages, use overload and overridden methods in polymorphism to extend the flexibility of programming, since the property and method of class cannot be changed during the runtime. Compared with Java and C++, Ruby, as a dynamic OO language, allows change of property and method in the class in the runtime. For this reason, the method reimplementation becomes less essential as that in Java and C++. Ruby does not require using complicated mechanism to define the methods for disambiguation. Thus, Ruby is considered has better performance in reducing code and providing concise program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Disadvantages:&amp;lt;/b&amp;gt;&lt;br /&gt;
The disadvantage of Rudy, to some extent, also results from its dynamic characteristic. It become unsafe and unreliable compared with static typing OO language. For example, method in Ruby does not care about the type of parameter. It may cause problem when the type of parameter is essential for some application. Ruby cannot identify this wrong type error made by programmer.&lt;br /&gt;
&lt;br /&gt;
=&amp;lt;b&amp;gt;Conclusion&amp;lt;/b&amp;gt;=&lt;br /&gt;
Reimplementation of methods is one of the most essential features in Object-Oriented language. It expands the flexibility of polymorphism in which descendant class can define their own behaviors and functions more efficiently. There are different ways for various languages to define how to reuse methods. In details, we use codes of Smalltalk, Java, C++ and Ruby to demonstrate and analysis how methods are reused, following with the discussion of advantages and disadvantages of method reuse in these four languages. &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
*[1]:http://en.wikipedia.org/wiki/Method_(computer_programming)&lt;br /&gt;
*[2]:http://www.wisegeek.com/what-is-an-abstract-method.htm&lt;br /&gt;
*[3]:http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/chap6.html&lt;br /&gt;
*[4]:http://en.wikipedia.org/wiki/Function_overloading&lt;br /&gt;
*[5]:http://home.cogeco.ca/~ve3ll/jatutor5.htm&lt;br /&gt;
*[6]:http://en.wikipedia.org/wiki/Virtual_function#Java&lt;br /&gt;
*[7]:http://rubylearning.com/satishtalim/ruby_overloading_methods.html&lt;br /&gt;
*[8]:http://rubylearning.com/satishtalim/writing_own_ruby_methods.html&lt;br /&gt;
*[9]:http://learnruby.com/about-ruby.html&lt;br /&gt;
*[10]:http://www.pluitsolutions.com/2006/10/05/overriding-methods-in-ruby/&lt;/div&gt;</summary>
		<author><name>Xfang2</name></author>
	</entry>
</feed>