440 likes | 642 Views
Design Patterns Hamza Kindi Software Engineer Hamza.kindi@streebo.com humzahalkindi@hotmail.com 0343-3024273. Outline. Some information regarding Streebo Software Labs. Design Patterns. Streebo – An Overview. Established in 2008 by seasoned and trusted former IBM employees
E N D
Design Patterns Hamza Kindi Software Engineer Hamza.kindi@streebo.com humzahalkindi@hotmail.com 0343-3024273
Outline • Some information regarding Streebo Software Labs. • Design Patterns.
Streebo – An Overview • Established in 2008 by seasoned and trusted former IBM employees • Expertise in Portal Planning, Development and Governance • Rapid growth - experiencing 200% revenue increase year to year • 100% headcount growth in 2010 • A growing, reference ready client base • IBM Advance Business Partner • IBM Authorized Independent Training Provider (AITP)
Global footprint Headquartered in Houston, TX with Global Delivery offices in Manchester – NH, Chengdu – China, Karachi – Pakistan and Ahmedabad, India.
Areas of Expertise • Portals and Collaboration • Over 50 portal implementations for world’s leading organizations • Packaged and rapid development methodology • Well-trained and experienced workforce provides: Planning, Creative, Implementation, Integration, Governance and Education • Niche focus provides deep skills in Lotus Portal and collaboration products • “Upon starting a very difficult WebSphere Portal project Streebo worked with us the whole way until the solution was in production. This was truly a first in the industry solution. Transmontaigne was grateful to be working with a strong partner like Streebo." • - Bill Paris, Program Manager, Transmontaigne Group
Areas of Expertise • Information Management • Experience in complex business scenarios • A list of Fortune 1000 satisfied customers • Portal Training • “I would suggest Streebo to anyone who needs anything from basic to advanced Portlet Factory training.” – Corey Whitney, Honda • Authorized IBM Training Provider since 2009 • Trained over 50 professionals on Portal Development methodologies • Consistently ranked 5 star in reviews
Product Expertise • Experience in complex business scenarios • A list of Fortune 1000 satisfied customers
Management Team Usman Memon Managing Partner Mohammad Ovais Managing Partner Usman Memon is the co-founder and Managing Partner of Streebo Inc. Usman advises his customers on IT Strategy and Enterprise Architecture. He is an oft-requested technical speaker at seminars and conferences, co-author of a book (Programming Portlets ― IBM Press) and has contributed to several articles and white papers related to Portal, Portlets and Service-Oriented Architecture. Usman holds a Masters in Mathematics from Ohio University and a Bachelors in Engineering from NIT (REC) Trichy, India. Mohammad Ovais is the co-founder and Managing Partner of Streebo, Inc. He is a leading expert in designing Portal and Business Intelligence systems for large enterprises. He has consulted for over a decade with fortune 500 customers such as Procter & Gamble (P&G), British Petroleum (BP), Johnson & Johnson (J&J), Cisco Systems and TD Bank. Mohammad holds a Bachelor's in Computer Science from Rice University.
Management Team Salman Kasbati Director Software & Consulting Salman is the Director of Software and Consulting at Streebo Software Labs. • Salman has over ten years of experience in delivering practical and customer-friendly solutions to clients across the globe. Before coming to Streebo, Salman was VP Software Development for Avanza Solutions, Pakistan’s premier software company. • Salman has computer science degrees from SZABIST and the National University of Computer and Emerging Sciences.
Highlights 100% 50+ 55+ 80% 95% 200 Employees with relevant certifications Customer satisfaction rating for trainings % of revenue growth year on year professionals trained in 2 years Portals developed and implemented reference ready customers
Industries Served Streebo has served industry leaders in the following sectors Media Pharma Consulting Automobiles Retail Telecom Finance Distribution Insurance Materials Energy Life Sciences
Let’s look into Design Patterns … Shall we?
Design Patterns Design patterns are recurring solutions to software design problems you find again and again in real-world application development.
Benefits Promote design reuse in future systems Help to identify common pitfalls Help to design a system independent of the target programming language Shorten the design phase in software development process
Criticism The design patterns may just be a sign of some missing features of a given programming language (Java or C++ for instance). Peter Norvig demonstrates that 16 out of the 23 patterns in the Design Patterns book (which is primarily focused on C++) are simplified or eliminated (via direct language support) in Lisp or Dylan. Inappropriate use of patterns may unnecessarily increase complexity.
Types of Design Patterns Creational Pattern Structural Pattern Behavioral Pattern
Creational Pattern Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation Some examples of creational design patterns include: Abstract factory pattern: centralize decision of what factory to instantiate Factory method pattern: centralize creation of an object of a specific type choosing one of several implementations Singleton pattern: restrict instantiation of a class to one object
Factory Pattern Define an interface for creating an object, but let the subclasses decide which class to instantiate.
Uses of Factory You need to localize knowledge of which class get created. A class can’t anticipate which class get created. Class uses sub classes to specify which objects get created.
Singleton restricts the instantiation of a class to one object.
Uses of Singleton Singleton is used where we need to ensure that there is a single instance of a class eg, window manager.
Singleton Code Example public class Singleton { private static Singleton _instance; private Singleton() { System.out.println("this is singleton object constructor"); } public void helloWorld(){ System.out.println("Hello World this is Singleton"); } // synchronized keyword ensure that this method is accessed // one thread at a time public static synchronized Singleton getInstance() { if (null == _instance) { _instance = new Singleton(); } return _instance; } }
Singleton Contd .. public class SingletonDemo { public static void main(String[ ] args) { //Calling the singleton object getInsance Method Singleton first = Singleton.getInstance(); first.helloWorld(); //Note that in the second call to getInstance method //Singleton object constructor is not called. //The second object is referring to the object //created in the first call. Singleton second = Singleton.getInstance(); second.helloWorld(); } }
Structural Pattern Structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities. Examples of Structural Patterns include: Adapter pattern: 'adapts' one interface for a class into one that a client expects Facade pattern: create a simplified interface of an existing interface to ease usage for common tasks Proxy pattern: a class functioning as an interface to another thing
Adapter Adapter pattern (often referred to as the wrapper pattern or simply a wrapper) is a design pattern that translates one interface for a class into a compatible interface.
Uses of Adapter An adapter allows classes to work together that normally could not because of incompatible interfaces. The adapter translates calls to its interface into calls to the original interface. The adapter is also responsible for transforming data into appropriate forms.
Proxy Pattern A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate.
Uses of Proxy In situations where multiple copies of a complex object must exist, the proxy pattern can be adapted order to reduce the application's memory footprint. Typically, one instance of the complex object and multiple proxy objects are created, all of which contain a reference to the single original complex object. Any operations performed on the proxies are forwarded to the original object. Once all instances of the proxy are out of scope, the complex object's memory may be deallocated.
Behavioral Pattern Behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication. Examples of this type of design pattern include: Chain of responsibility pattern: Command objects are handled or passed on to other objects by logic-containing processing objects Interpreter pattern: Implement a specialized computer language to rapidly solve a specific set of problems Iterator pattern: Iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation Strategy pattern: Algorithms can be selected on the fly
Strategy Pattern • Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. • A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditions, move related conditional branches into their own Strategy class. • Define strategies for a performing a behavior and change them dynamically as per requirement.
Who is What? • Strategy - defines an interface common to all supported algorithms. Context uses this interface to call the algorithm defined by a ConcreteStrategy. • ConcreteStrategy- each concrete strategy implements an algorithm. • Context • Contains a reference to a strategy object. • Defines an interface that lets strategy accessing its data. • The Context objects contains a reference to the ConcreteStrategy that should be used. When an operation is required then the algorithm is run from the strategy object. • Context object receives requests from the client and delegates them to the strategy object. Usually the ConcreteStartegyis created by the client and passed to the context. From this point the clients interacts only with the context.
Example Robots Application
Resources http://javapapers.com/category/design-patterns/ The Design Patterns Java Companion By James W. Cooper Wikipedia Article “Software Design Patterns”