What is a design pattern?

Howdy,
I hear a lot of talk of deasign patterns in ABAP...
My question is what on earth is a design pattern and why/how would it be useful?
Any ideas anyone

Hi Steve.
The good point to start with design patterns is to read book "Design Patterns - Elements of Reusable Object-Oriented Software" by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. It gives strong, consistent understanding of patterns basis with real life examples.
Short introduction extract:
"Christopher Alexander says, "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice". Even though Alexander was talking about patterns in buildings and towns, what he says is true about object-oriented design patterns. Our solutions are expressed in terms of objects and interfaces instead of walls and doors, but at the core of both kinds of patterns is a solution to a problem in a context.
In general, a pattern has four essential elements:
The pattern name is a handle we can use to describe a design problem, its solutions, and consequences in a word or two. Naming a pattern immediately increases our design vocabulary. It lets us design at a higher level of abstraction. Having a vocabulary for patterns lets us talk about them with our colleagues, in our documentation, and even to ourselves. It makes it easier to think about designs and to communicate them and their trade-offs to others. Finding good names has been one of the hardest parts of developing our catalog.
The problem describes when to apply the pattern. It explains the problem and its context. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern.
The solution describes the elements that make up the design, their relationships, responsibilities, and collaborations. The solution doesn't describe a particular concrete design or implementation, because a pattern is like a template that can be applied in many different situations. Instead, the pattern provides an abstract description of a design problem and how a general arrangement of elements (classes and objects in our case) solves it.
The consequences are the results and trade-offs of applying the pattern. Though consequences are often unvoiced when we describe design decisions, they are critical for evaluating design alternatives and for understanding the costs and benefits of applying the pattern. The consequences for software often concern space and time trade-offs. They may address language and implementation issues as well. Since reuse is often a factor in object-oriented design, the consequences of a pattern include its impact on a system's flexibility, extensibility, or portability. Listing these consequences explicitly helps you understand and evaluate them."
Regards,
Maxim.

Similar Messages

  • What kind of design pattern is this?

    Hi ,
    I am just learning the designpattern. So when I went through different kinds of design pattern, I got some doubts as it looks same some design patterns. could anybody please tell what kind of design pattern is the following one?
    public interface IExporter{
         void export();
    public class ExcelExporter implements IExporter{
    public void export(){
    //TODO implementation
    public class CVSExporter implements IExporter{
    public void export(){
    //TODO implementation
    }thanks in advance..

    Well - in structure, it is nearest to the Command pattern as far as I can tellOr Strategy. Or Builder. Several design pattenrs may share the same class structure, the difference is in the context, forces, and the parts one want to be flexible. And if someone wants to make it explicit which pattern is applied, they should name things accordingly.
    As Saish said this example shows little more that inheritance at work. Not a pattern in itself, but a core element of the language. Trying to "identify" a pattern that is not obvious from the context is either:
    - a sign that the original coder completely missed the point of using a pattern (which is, as Saish said too, assentially about communication)
    - a sign that the maintenance coder is looking for patterns where there aren't
    - an exercise question
    but it differs in so much as its motivation is to polymorphically allow the use of different exporters rather than provide a set of action commands.That shouldn't count as a difference, merely as an "application" (it's perfectly valid to have a hierarchy of commands all devoted to exporting, although, as stated, if the original coder applied the Command pattern, he should have made it explicit, by renaming the interface, e.g. to ExportCommand).

  • What is singleton design pattern

    Hi All,
    Anybody please tell me what is Singleton Design Pattern ?
    What is the right definition of it and where can I get the right information about it.
    Please help and reply soon
    Thanks
    Amitindia

    Not meaning to be arrogant: check the topic "Public singleton". It explains what the singleton pattern tries to achieve and show various ways of creating singleton classes.

  • What is command design pattern? what is the problem that it solves?

    Hi i have been reading few articles on command design pattern but was unable to understand what it is and what problem does it solve. As far as my understanding goes if there is a pre specified method in an object that could execute and perform the necessary activities then it is called as command design pattern. Why is it named as command design pattern, it is because in a shell we use commands to retrieve output. For example when we type "dir" in dos command prompt it returns the list of files. so here we have to remember a preexisting exe file named "dir" which does something when used. So here like we call it command because when "dir" is passed to the computers it returns something that is expected. may be the computer obeys the command issued and return something back. So like wise if there is a method that is defined as as the command, for example in struts framework the action class must have a method "execute()" which is called by the framework to execute the necessary action mapped to it. So if there is a predefined method like "execute" in struts then the object is said to be followed command design pattern. So what actually does it solve?
    What ever i have written is my understanding from the articles i have read about the design pattern. So kindly correct me if i am wrong. Help me understanding what actual problem does this pattern solves. Thanking you in advance.

    This is really off-topic for these forums. You might do better on StackOverflow.com. I'll just say that although the first Design Patterns book came as a revelation to me, it was more for (a) the nomenclature (decorator, factory, facade, etc) which is still with us and (b) about five of the original patterns, which told me things I didn't already know. I've never used any of the others, including Command, and the whole design patterns thing quickly degenerated into farce with what seemed like a sustained attempt to reduce the whole of computer science to design patterns, which really isn't the point. As an example, there is one in another book called Type Object, which is nothing but 3rd normal form, which can be defined roughly in a couple of sentences. This pattern went on for dozens of pages with a very artificial example. I wrote to the mailing list about it: 'Type Object considered hilarious'. I got a rude reply from the original author, which I guess I expected, but also an incredible response from the list owner, saying I should recast my objections in the form of a design pattern. That lost it for me. True story. Moral: don't take this religion, or any IT religion, too seriously. They come around every 18 months or so with the regularity of the next bit of Moore's Law. I've seen dozens of them come and go since 1971, all with something to say, all 90% nonsense.
    See here for a longer version of this incident.

  • What is the design pattern for web application with struts & hibernate?

    Hi everyone,
    I am new to web application developement.I am using struts for MVC framework & Hibernate for ORM framework.I am little confused that struts used bean representation for collecting form fields(Bean 1),value objects(DTO) for passing value to the JSP(Bean 2) & hibernate use the bean like representation for persistent object(Bean 3).Whether we must use all the bean's which are similar to each other or any reusable bean recommended?

    I'm sure why it didn't work. That is how I bundle the JRE. The only disadvantage about bundling is the size of the installer file will be pretty large. In my opinion, relying on a public version is not a good idea if you have no control of the target box. The user might, for some reason, decide to uninstall java or upgrade to a new incompatible version and your app. may stop working. I'm sure many on here will disagree with this though.
    I always use the marner .exe wrapper:
    http://www.megaupload.com/?d=FYZAVM77
    and inno installer:
    http://www.jrsoftware.org/isinfo.php
    They're both free to use and I've had no problems with them. Another wrapper is Javaround:
    http://sourceforge.net/project/showfiles.php?group_id=234356

  • Design Pattern for multithreaded client server program

    I asked this question in another post, but with other stuff, so I'll distill this one.
    I am creating a multi-threaded client server program (just for learning - a chat program at this point). I built the server and client in swing, and I'm wondering what the best design pattern is for this setup. Right now all the swing stuff is in the MyServer class. In that class I have a loop accepting client connections to the serverSocket and creating a new MyServerThread (threaded client connection).
    The problem is that all the work of creating input streams, interacting with the server, all that stuff is done in the MyServerThread class, but I want that text to be written up to the Swing objects - which is in the MyServer class. So right now in the MyServerThread class I pass the MyServer object into it, but I'm not sure if that is really the most robust thing to do. Does anybody have any suggestions as to how this should be done. If somebody has an article they'd like to point to I'll check it out too. But if it's just the run-of-the-mill multithreaded client-server article, I've read alot and most don't specifically address my question.

    Thanks for the reply Kaj, and I think I'll keep my design for now, since it's just quick and dirty. I've read the MVC concept a while ago and I'll revisit it again when I get more serious. But I have a question, why should I be using a callback interface, why an interface at all? And then make MyServer implement that interface...why not just pass MyServer to the thread object? Or is there something down the line that I did not forsee?

  • What is the best design pattern for this problem?

    No code to go with the question. I am trying to settle on the best design pattern for the problem before I code. I want to use an Object Oriented approach.
    I have included a basic UML diagram of what I was thinking so far. 
    Stated simply, I have three devices; Module, Wired Modem, and Wireless Modem.
    In the Device Under Test parent class, I have put the attributes that are variable from device to device, but common to all of them.
    In the child classes, I have put the attributes that are not variable to each copy of that device. The attributes are common across device types. I was planning to use controls in the class definition that have the data set to a default value, since it doesn't change for each serial number of that device. For example, a Module will always have a Device Type ID of 1. These values are used to query the database.
    An example query would be [DHR].[GetDeviceActiveVersions] '39288', 1, '4/26/2012 12:18:52 PM'
    The '1' is the device type ID, the 39288 is the serial number, and the return would be "A000" or "S002", for example.
    So, I would be pulling the Serial Number and Device Type ID from the Device Under Test parent and child, and passing them to the Database using a SQL string stored in the control of the Active Versions child class of Database.
    The overall idea is that the same data is used to send multiple queries to the database and receiving back various data that I then evaluate for pass of fail, and for date order.
    What I can't settle on is the approach. Should it be a Strategy pattern, A Chain of Command pattern, a Decorator pattern or something else. 
    Ideas?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • What are the best practices in design patterns?

    What design patterns are likely popular?

    If you go to your local bookstore or online book store you will find at least 20 books that describe this.
    Some how I doubt you are going to get 20 books worth of an answer.

  • What are design patterns ?

    what are design patterns ?
    what is the difference between design patterns and frameword ?
    any help would be really appreciated !!

    A quick [url http://www.google.com/search?hl=en&q=what+are+design+patterns+%3F+&btnG=Google+Search&meta=] google  will bring more answers than you know what to do with.

  • What is mediator in Design pattern.

    hi what is mediator in Design pattern.
    How can i use it. any source code available ???

    you're exactly the target audience for the java desktop !!!
    http://java.sun.com/javase/technologies/desktop/
    cheers!

  • What is meant by session Facade design pattern

    please give me

    cripes
    http://www.google.com/search?q=what+is+meant+by+session+Facade+design+pattern
    Who'd have thought it? ;-)
    kind regards,
    Jos

  • What is recommended / preferred design pattern for Swing?

    I have been confused by the apparent variety of design patterns used when putting together a Swing GUI application. For example, one pattern does this:
    public class myclass extends JFrame {
    myclass() {
    // do all the stuff here
    public static void main(String args[]) {
    // instantiate class here
    while another pattern goes like this:
    public class myclass extends JFrame {
    myclass() {
    super("title");
    public static void main(String args[]) {
    // do all the stuff here
    Is there a preferred way to do this stuff, or is it a matter of personal preference?

    Hi
    I txnk there are no choice : the only valid aproach is (1)
    because :
    main is a "know" entry point just for instantiate some classes
    the event thread is alive after main is completed, so your app have a GUI elements who responds to some events via some classes (the listeners for these events).
    Of course you can add listeners at main level but, what hapen if
    you need these GUI in other app (the main func is only called when you invoke the JVM to an start class)
    Normally the JFrame have some member funct or some internals classes to respond some events (at this point there are some alternatives)
    Hope this help
    Bye

  • [BOOK] What's the best book about DESIGN PATTERN

    Hi Guys,
    by experience, what's the best book for you concerning the Design Pattern in Abap. I mean :
    Quality,
    Comprehensiveness,
    Clearness,
    Amount of chapter,
    etc.
    Thank for advices.
    Rachid.

    Dear Rachid,
    This is rank 1 book, but u have learn online also. So many websites are there. example search: OO Design patterns ZEVOLVING.
    Regards,
    Abbas.

  • Suggest what design pattern is applicable for my case

    I have an object called GrantAward , these awards I have to show to the user for selection
    1. I call a web service to get list of GrantAwards.
    2.for each GrantAward check if this is present in my database
    a. if not there insert
    3.for each GrantAward check some conditions
    a if satisfied add to the list to show to user
    b if not satisfied do not add to list .
    these are the steps involved before I can show the GrantAwards to user for selection , please suggest me what design pattern can I use ?

    I'm not sure you want to hunt for patterns when you already know what you are implementing. A lot of people have pattern fever. Patterns are useful constructs for communicating design ideas and enforcing best practices. But I rarely go out and hunt for a specific pattern (or name my objects after patterns). If you are doing a heavyweight methodology with RUP or something similar, I could see stereotyping your UML with patterns.
    That having been said, you already have a Facade with your service. You are undoubtedly using DataAccessObject to fetch your records. Your conditions could be implemented with a ChainOfResponsibility and/or Strategy pattern. What you return could be a Composite. Potentially the request and response are a Command. And your overall architecture could be MVC.
    But IMO that is overkill.
    - Saish

  • What is the best design pattern for top-down ws development..?

    Hi,
    What is the best design pattern for top-down development+ wsdl2service....?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

Maybe you are looking for

  • Burning CDs in Vista

    Hi, I have recently installed iTunes on a new Vista system i have built. After updating firmware for the cd drive I can write data discs with windows however i cant do any writing with iTunes. When i click on 'burn disc' in itunes a message appears s

  • Using PSA 3 SE with Photoshop CS2 or PSE2

    I have PSE2 and the full monty Photoshop CS2. As I want to create slideshows with my own background musice, transitions, etc I downloaded PSA 3SE hoping that this was the software I needed. However, in its Read Me First file it says that in order to

  • DIP causing Event ID 566 in AD

    Hi everyone, We've been seeing numerous Failure Audits of Event ID 566 in Active Directory. They are being generated by our OID bind account. We are using DIP Synchronization, but what is confusing us is that the AD Audit Logs are saying that the oid

  • ARCHIVELOG DELETION POLICY 10g?

    I know in 11g, we have this command. RMAN>CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 3 TIMES TO DEVICE TYPE sbt; is there a similar command in 10g as well for this feature?

  • Can you change Premiere Elements 13 timeline to act like Premiere Pro CS4?

    Hi there, I recently started using Premiere Elements 13 after previously having used Premiere Pro CS4 (both mac versions if that makes a difference). All is great but I have encountered one major difference which makes Elements 13 a bit of a pain and