Thursday 3 May 2007

Anti-Patterns

In layman term, anti-patterns are pitfalls. Solutions which are needed to be created again and again to overcome a problem.

I would be going into detail of anti-patterns in my course work as to how anti-patterns have evolved and how they have benefited the software industry.


Goodday.

Decorator Design Pattern

A decorator pattern allows additional responsibilities added to the object without subclassing. Subclassing means a class that inherits some properties from the superclass and decorator pattern is alternative to subclassing.[1]

Why is decorator design pattern alternative to subclassing or inheritance?
  1. Because subclassing adds behaviour during compilation and decorator pattern adds new responsibility or behaviour during run time.
  2. It's done without modifying the interface of the original object.
  3. Decorator pattern allows to add or remove functionality as and when required. [2]

Advantages of using Decorator Design Pattern over Subclassing are:

  1. Because adding functionalities are done during run time therefore it gives more flexibility than just straight inheritance.
  2. It saves time and simplifies coding because you need not write coding from the start and just code the behaviour into the object.
  3. Unnessary functionalites need not be added. It can be done upon request.
  4. In any case when you do not have access to the source code but you need to add the functionalities to the product, then you can wrap this object into the decorator object to provide the missing or new functionalities.[3]

---------------------------------------------------------------------------------------------------

REFERENCE

[1], [2] & [3] http://en.wikipedia.org/wiki/Decorator_pattern

Strategy Design Pattern

I missed this lecture as I was attending hospital appoinment. Information which I have gathered from lecturer's notes and a bit of self stuyding did however allow me to outline my understanding as below:-

Strategy Pattern is basically used to achieve different behaviours. In simple terms, an object and its behaviour are separated into two different classes. Each behaviour encapsulated into its own class and it's called Strategy.[1]

What is the advantage of using Strategy Pattern?

  1. It is much simpler to keep track of different behaviours required from an object as separate classes will be created.
  2. Any amendements need to be made on the behaviour of an object can be achieved quickly as you will keep track of those classes.
  3. In some cases, you will come across of several objects that are similar but different in behaviour. Therefore, using Strategy Pattern becomes very useful.
  4. It is much easier to make an extension on the object with new behaviours without recoding the application.
  5. Using this patterns also means eliminating the need of many conditional statements.

Besides the advantages, I think one must know also know the different strategies available in order to reduce creating of unnessary startegies. If the knowledge is lacking than one might end up creating too many classes which can create problems of maintaining them.

Is Strategy Design Pattern the best to be used?

Well, I think that every pattern has it own uniqueness and is designed to address a specific issue.

---------------------------------------------------------------------------------------------------

Reference - Web Link

[1] http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/StrategyPattern.htm

Tuesday 3 April 2007

Lecture 06.03.07 Part B - Critiquing Course Work

There are 5 tasks given in the course work and only 4 tasks are to be completed. Each Task is woth 25%. Those task are as follows:

Task 1 - Designing with Patterns
Task 2 - Coding with Patterns
Task 3 - Patterns and Software Development
Task 4 - Critiquing Patterns
Task 5 - Patterns Blog

We are suppose to critize each Task.

TASK 1
In order to complete this task, we have to know UML diagrams. This task imposes force to have good understanding of the fundamental concepts used in object-oriented programming, mainly class diagrams, use case diagrams and sequence diagrams. The 25% marks are allocated according to the understanding and evaluating those patterns.

TASK 2
In this section we are to explore a particular programming language and coding. In order to achieve a working prototype a good knowledge of object oriented programmng language is essiential.

TASK 3
In this task we are exposed to incomplete Pattern designed by someone else and its an oppurtunity toinvestigate and provide a solution to the problem. In order to be in a position to give a solution it is essiential to have suffiecient understanding of the 23 design pattern by GOF.

TASK 4
By critiquing, we are actually given a platform to understand the rationale of a particular topic in more depth, which gives us a chance to explore further and contribute a easier way of putting forward an idea or concept.

TASK 5
In this task we asked to post at least 12 blogs and the 8 best blogs will be choosen for marking pupose. All this blogs created are related to the subject we are learning. Why are we asked do so? Simply, because creating blogs gives an oppurtunity to confidently post their understanding and bring out doubts. Therefore, this learning curve gives one to have an open mind to new ideas and accepting the rejections positively. This is essiential for any evolving area.

The course work is designed for one to understand in overall. Having basic knowledge of object oriented programming language and to further understand the design patterns one will have to further understand the principles of each every pattern as they all have uniqueness of its own. Besides that, confidence, critizing and evaluation is the essential bit of the course work.



Monday 2 April 2007

Lecture 06.03.07 - Definition of Abstract Factory

Definition of Abstract Factory Pattern

A software design pattern, the Abstract Factory Pattern provides a way to encapsulate a group of individual factories that have a common theme. In normal usage, the client software would create a concrete implementation of the abstract factory and then use the generic interfaces to create the concrete objects that are part of the theme. The client does not know (nor care) about which concrete objects it gets from each of these internal factories since it uses only the generic interfaces of their products. This pattern separates the details of implementation of a set of objects from its general usage.[1]

OR

In short it is defined as, providing an interface for creating families of related or dpendent objects without specifying their concrete classes. [2]


Below, I am going to illustrate an example which was used by my lecturer:-

In the STUDENT class, there is data and methods. The data is student names which comprises methods such as enrolment, add, create, edit, delete and print.
Its the same with the class named COURSE, there is data and methods. The data will be types of courses available and the methods will be registration, add, create , edit, delete and print.

Now, abstract class will create a common interface which will perform all the functions such as add, create, edit, delete and print in new abstract class named may be FUNCTION class. This proves that the concrete class is isolated and its easy as the concrete class produces different product family configuration.

---------------------------------------------------------------------------------------------------
Reference Link

[1] http://en.wikipedia.org/wiki/Abstract_factory

[2] http://www.c-sharpcorner.com/uploadfile/mosessaur/abstractfactoryadonet202152006053643am/abstractfactoryadonet2.aspx?articleid=4468e7cc-57cl-4738-8e83-a8db48fd1d9f



Lecture 27.02.07 (B) - Critiquing one of the GOF Design Pattern, Adapter Pattern

In this lecture we all were introduced to the 23 GoF Catalogue Patterns. Brief knowledge was obtained and I am taking the ADAPTER PATTERN a little futher by critizing the 11 elements in this catalog pattern.

Name
Adapter pattern makes one interface match to another. It acts as a plug in.

Intent
Converts the interface of a class into another interface a cliets expects.

Also Known Uses
Its also known as Wrapper.

Motivation
This section elaborates about how existing and unrelated classes come into one application and from there on how there are made compatiable to work on a same interface. It also emphasises on a problematic area and from there on it vastly builds into addressing those issues by introducing different approaches. Besides that, having a diagrammatic viw in adapter pattern illusrates the fullfilling of responsibility of each class.

Applicability
In this section it clearly states where and when it should be used to adopt the interface.

Structure
This element overlaps with the MOTIVATION element because this class adapter uses multiple inheritance concept to adpt one interface to another and this information can be incorporated into MOTIVATION element as mentioned in the begining.

Participants
The advantage here ist that it clearly devides the domain interface use by the client, works together with objects conforming the target interface, defines the interface need ofadpating, and adapting the target interface. In short it can briefly demontrates and identify the obtainability of relationship.

Collaborations
In this section, the association here emphasises on the UML diagrams.

Consequenses
Information such as the do's and don'ts, characteristics of the adapter pattern, rules of the adapter pattern. In short, this element provides all the principles of adapter pattern when come to implementing them.

Implementation
Here the implementation is applied on C++ to display hierarchical structure. Three(3) types of implementation approach is used and they are abstract approach, usage of delegate objects and parameterized adapters. All this three approaches are used together which is much easier to be introduced rather than implementing them separately using TREE display.

Sample Code
In my opinion, sample code element need not be given great emphasise as it can be illustrated in any language. Creating the source code can be time consuming and lenghty process.

Known Uses
This pattern has been used on the following systems: InterViews 2.6 defines an Interactor abstract class and a Graphic abstract class. Both have graphical appearances but they have different interfaces and implementations (they share no common parent) [1]

----------------------------------------------------------------------------------------------------------------
Reference Link:http://www.vico.org/pages/PatronsDisseny/Pattern%20Adapter%20Object/index.html [1]









Thursday 15 March 2007

Lecture - 27.02.07 Research of a New Pattern

Just a quick re-cap to What is Pattern?
Basically, Pattern is a solution to problems which keeps occuring over and over again within a particular context.

I am enclosing one of the PATTERNS released by YAHOO and this Pattern is used by Web Designers, find the details of the Pattern below:

NAME : EXPAND TRANSITION

INVENTED BY : YAHOO

KNOWN USES : YAHOO BETA MAPS


PROBLEM
Designer needs to show the detail of an object in its context or reveal a previously collapsed object.

IT IS USED WHEN:

- This pattern is used to manage large contents and modules.
- Shrink feature to create a way to manage real estate on the screen.
- As part of rollover system (with Shrink) to emphasize the currently hovered on object.( e.g; photos in a photo album).
- Need to see more detail (Y! Local maps).
- The need to interact with the content that was previously represented in a thumbnail version.
- Wanting to see the detail of an item in a list (e.g., movie details in a movie list).
- Making content available for editing.

SOLUTION

It increase the size of an object while animating the in-between sizes (tweening). This communicates similar meaning, as does the brighten transition and good rule of thumb is complete an expand in less than 0.5 seconds.

RATIONALE
There are 2 logics behind this pattern designed and those are:

- To expand visually more eye-catching than a brighten, especially when combined with the move transition.

- Be careful to not overuse expand. For example, in a photo application, if you provide a rollover to expand photos from thumbnail to a larger size the transitions will become annoying as the user will see them back-to-back. Either remove the transition altogether or make it extremely fast.

REFERENCE LINK
http://developer.yahoo.com/ypatterns/pattern.php?pattern=expand

Tuesday 6 March 2007

Design Patterns

"A design pattern names, abstract, and identifies the key aspectsof a common design structure that make it useful for creating a reusable object design. The design pattern identifies the participating classes and instances, their roles and collaborations, and the distribution of responsibilities." [1]

FAQ's

1. What is a Pattern?
Pattern is a solution to re-occurring real life problems within a context. For example, if you are decorating your kitchen to overcome space problem you will therefore acquire consultation from Kitchen Decoraters who will have surely have various types of designs available to accomodate individual needs.

2. Why is Patterns becoming so famous and encouraged to be used?
Simply because Patterns addresses every little aspect of the context and than solution is either ready to be used or invented.

3. What is the advantage of using Pattern?
Patterns encourage reusability. They are used over and over again which means the solutions provided has been tested and proven to be successful. It saves alot of time from re-inventing new designs.

4. How would one be able to identify that if it is a Pattern or not?
A structured way of solving problem is when you identify a Pattern.


REFERENCE

[1] - (Design Pattern - Elements of reusable object oriented software, GOF, (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, p. 4-5)

Thursday 1 March 2007

High Turn Over of Staff in Retail Industry

NAME : HIGH TURN OVER of STAFF in RETAIL INDUSTRY

PROBLEM : Why is there a high turn over of staff in Retail Industry?

CONTEXT : In most of the retail outlets you will find students(between 18 to 24 years) or individuals who have
retired early( 55+ of age and above) are being employed. Employees from the students category do
not take their jobs seriously. Firstly, because the younger people are not satisfied with wages they get paid and secondly, the employers do not put much effort into employees career
development.

SOLUTION : Employers should have career paths designed for employees who would like to make their
careers with the company by having trainning & development session and this can be done by
PERSONAL DEVELOPMENT REVIEW (PDR) every half yearly. This PDR should give
a general view of where the employees is being groomed on and this will build the relationship
between the managers and the employees which plays a part in creating sence of taking
responsibility and commitment.

Thursday 22 February 2007

Beat Bullying in Primary Schools

What are Patterns?
Patterns are solutions to solve reoccurring real life problems within a context. Patterns come into effect when a problem is addressed or identified in our daily lifes. The advantage of having Patterns is overcoming the reinvention of the wheel and reducing reoccurring problems . Beside that it also saves time.

Name
Beat Bullying in Primary Schools

Problem
Why does an average bright child becomes target of bullying?

Context
Bullying starts off very early these days in schools. Because a particular child's exam results are good(which are above 75%) and or if the child is active in school curriculum it will automatically highlight the child for being outstanding performer in the classroom. Therefore, the child will either be isolated or picked by his or her classmates who tend to gang up. This is bullying.

Solution
The class teacher should promote group studying and activities which encompasses of table points so that every child will take part effectively. This will promote building of confidence and communication and finally reviewing students progress report to understand & compare the study patterns which has been effective to fill the gaps.