What is a Framework

  • Upload
    talhas

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

  • 8/12/2019 What is a Framework

    1/11

  • 8/12/2019 What is a Framework

    2/11

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

    2 of 11 5/19/2009 11:57 AM

    If I look at this list of vague framework requirements, I come up with a set of specific classifications that define aframework:

    wrappers. A wrapper:simplifies an interface to a technology

    reduces/eliminates repetitive tasksincreases application flexibility through abstractionare often re-usable regardless of high level design considerations

    architectures. An architecture:manages a collection of discrete objectsimplements a set of specific design elements

    methodologies: A methodology:enforces the adherence to a consistent design approachdecouples object dependencies

    are often re-usable regardless application requirements

    So, before talking about frameworks, we need to talk about wrappers, architectures, and methodologies. After that, I'm notsure what will be left to say about frameworks!

    A Framework Is...

    A Wrapper

    A wrapper is way of repackaging a function or set of functions (related or not) to achieve one or more of the following goals(probably incomplete):

    Simplification of useConsistency in interfaceEnhancement of core functionality

    Collecting discrete processes into a logical association (an object)

    It's easy to fall into the idea that everything is a wrapper, just like saying "everything is relative" (which is untrue, because

  • 8/12/2019 What is a Framework

    3/11

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

    3 of 11 5/19/2009 11:57 AM

    that statement itself is an absolute), but if you think about it, not everything is a wrapper. Most of MFC and .NET arewrappers are the core API's. Some are laughably so, providing classes that merely wrap messages into inline methods.Other wrappers are more complex. For example, I've written a wrapper for the Visio COM object that takes all the gruntwork out of using Visio's primitive functions (primitive in the sense of "fundamental", as opposed to "poorly implemented")to do basic things like drop shapes, connect shapes, and read a shape collection.

    But then, you get into implementation that truly provides new functionality. Yes, it utilizes other objects, other API's, evenother wrappers, but it isn't a wrapper in itself because it does something totally new, rather than just adding to, subtractingfrom, or managing a collection of existing work. A wrapper modifies existing behavior. There's a lot of code out there thatcreates new behavior (thus becoming subject to

    An Architecture

    An architecture is a style that incorporates specific design elements. Obviously, a framework needs to have a design. Itsarchitecture is separate from the collection of wrappers that it implements and from the enforcement of a specificimplementation methodology. MFC's document-view classes are an architecture. Essentially, an architecture implementsassociations between objects--inheritance, container, proxy, collection, etc. Architectures have the interesting attributethat, if you don't like them, you can usually ignore them or replace them (at least at the beginning of a project).Architectures can and are useful because they create a re-usable structure (a collection of objects) that provide someenhanced functionality, but once you start using them, you're pretty much stuck with them unless you do some major

    refactoring.

    A Methodology

  • 8/12/2019 What is a Framework

    4/11

  • 8/12/2019 What is a Framework

    5/11

  • 8/12/2019 What is a Framework

    6/11

    CodeProject: What Is A Framework? Free source code and programming help http://www codeproject com/KB/architecture/WhatIsAFramework aspx

  • 8/12/2019 What is a Framework

    7/11

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

    7 of 11 5/19/2009 11:57 AM

    What Does The Rest Of The World Say?

    A framework is a set of common and prefabricated software building blocks that programmers can use, extend or customizefor specific computing solutions. With frameworks developers do not have to start from scratch each time they write anapplication. Frameworks are built from collection of objects so both the design and code of the framework may be reused. -

    JavaFramework.

    That sounds like an architecture and a collection of wrappers. OK, 2 out of 3.

    A skeleton of an application into which developers plug in their code and provides most of the common functionality. -- E.Gamma, et al., "Design Patterns", Addison-Wesley, 1995

    Well, now that's a radically different definition, and in my thinking certainly incorporates the idea of a methodology, if for noother reason than because the "skeleton" has to define how developers plug in their code and how they interface with the

    common functionality provided by the "skeleton". Implied here (but not necessarily) may also be how the codeintercommunicates.

    A set of classes which defines a model of interaction among objects-- Moduleco(of course, they totally blow it in the

    additional definitions)

    OK, this falls into the category of a methodology because it clearly enforces the interaction style between objects, but itleaves out the wrapper and architectural aspects.

    A comprehensive, integrated class libraryAn entire architecture is the unit of reuseDefines the control logic and class interactions of the application's architectureReduces "dog work" at the cost of some flexibility

    -- Software Engineering Associates, Inc

    Hmm. OK, that encompasses the three things I'm talking about--wrappers (integrated class library), architecture (an entirearchitecture), and methodology (defines the control logic and class interactions). Although, this may not exactly be what

    the authors had in mind, especially when reading what they think a design patternis, but you never know.

    So far, we've seen:

    building blocksskeletoninteraction modelall of the above (sort of).

    Frankly, I'm not sure that there really is a good definition out there. But really, the one I like best is from the authors ofDesign Patterns:

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

  • 8/12/2019 What is a Framework

    8/11

    Code ojec : W a s a ewo ?. ee sou ce code a d p og a g e p p://www.codep ojec .co / /a c ec u e/W a s a ewo .asp

    8 of 11 5/19/2009 11:57 AM

    "When you use a toolkit, you write the main body of the application and call the code you want to reuse. When you use aframework, you reuse the main body and write the code it calls."

    "Not only can you build applications faster as a result, but the applications have similar structures. They are easier tomaintain, and they seem more consistent o their users. On the other hand, you lose some creative freedom, since many

    design decisions have been made for you."

    "If applications are hard to design, and toolkits are harder, then frameworks are hardest of all. ...Any substantive change tothe framework's design would reduce its benefits considerably, since the framework's main contribution to an application isthe architecture it defines. Therefore it's imperative to design the framework to be as flexible and extensible as possible."

    This doesn't formally spell out the idea of a framework consisting of wrappers, architecture, and methodology, but it'scertainly all there, between the lines. And it provides a different definition for what most of MFC and .NET reallyare--toolkits, not frameworks. Which is the answer to the other question--what are MFC and .NET if not frameworks?

    Conclusion

    By thinking about what a framework is, I think I've come up with a fairly good analysis of the subject as an introductorytopic. Maybe what I'm talking about is something different from a framework, but in my mind, this is what a frameworkshould be and do. There are a lot of different ideas out there as to what a framework is, so now you have mine as well.

    License

    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    About the Author

    Marc Clifton

    Member

    Marc is the creator of two open source projets, MyXaml, a declarative (XML) instantiation engineand the Advanced Unit Testing framework, and Interacx, a commercial n-tier RAD applicationsuite. Visit his website, www.marcclifton.com, where you will find many of his articles.

    Marc lives in Hudson, NY with his son Ian, who attends the Hawthorne Valley School. To contactMarc, email him at [email protected].

    Occupation: Architect

    Company: Interacx

    Location: United States

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

  • 8/12/2019 What is a Framework

    9/11

    j p g g p p p j p

    9 of 11 5/19/2009 11:57 AM

    Other popular Design and Architecture articles:

    NHibernate Best Practices with ASP.NET, 1.2nd Ed.This article describes best practices for leveraging the benefits of NHibernate 1.2, ASP.NET,generics and unit testing together.

    Exception Handling Best Practices in .NETDesign guidelines for exception handling in .NET which will help you to create more robustsoftware

    Applying Robustness Analysis on the ModelViewController (MVC)Architecture in ASP.NET Framework, using UMLThis article will enhance your vision on the usage of Robustness Analysis in conjunction with

    Model View Controller, using UML with application in ASP.NET. This article is a sequel to myarticles on Architecture and Design with ASP.NET.

    Design Patterns Implementation in a Storage Explorer Application

    A design patterns approach for designing and explaining a Storage Explorer application. Theapplication is used to explore file composition in a computer storage.

    Model View Presenter with ASP.NETThis article describes using the Model-View-Presenter pattern within ASP.NET 2.0 to

    encourage proper separation of concerns between presentation and business logic

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

  • 8/12/2019 What is a Framework

    10/1110 of 11 5/19/2009 11:57 AM

    Article Top Sign Upto vote for this article

    You must Sign Into use this message board.

    FAQ SearchNoise Tolerance Medium 6Medium Layout Normal 6Normal Per page 25 625 Update

    Msgs 1 to 25 of 35 (Total in Forum: 35) (Refresh) First Prev Next

    One more layman's definition of Framework.... NewtonVer2 17:45 3 Jan '09

    Framework vs model Nxasana 13:07 4 Oct '07

    A Good Article i_fan 20:11 17 Nov '03

    Another Framework Definition bjdemarco 7:41 12 Nov '03

    A Perspective Marty Spallone 19:01 11 Nov '03

    Re: A Perspective Marc Clifton 2:24 12 Nov '03

    Re: A Perspective Marty Spallone 17:21 12 Nov '03

    Re: A (2-Dimensional) Perspective LocoSteve 19:07 12 Nov '03

    othogonal development Vlad Vissoultchev 12:07 7 Nov '03

    Re: othogonal development Marc Clifton 12:20 7 Nov '03

    Re: othogonal development Vlad Vissoultchev 12:35 7 Nov '03

    Re: othogonal development Marc Clifton 14:11 7 Nov '03

    What is C++ framework TW 2:56 7 Nov '03

    Re: What is C++ framework Marc Clifton 4:09 7 Nov '03

    Re: What is C++ framework TW 0:36 8 Nov '03

    Re: What is C++ framework Marc Clifton 3:09 8 Nov '03

    Re: What is C++ framework rockNroll 9:24 29 Feb '08

    MFC no, .NET no David Stone 17:28 6 Nov '03

    MFC yes, .NET yes Anonymously 14:51 6 Nov '03

    MFC yes, .NET no Nemanja Trifunovic 10:59 6 Nov '03

    Re: MFC yes, .NET no Nitron 15:57 8 Nov '03

    Re: MFC yes, .NET no Nemanja Trifunovic 6:57 9 Nov '03

    Re: MFC yes, .NET no Nitron 3:20 10 Nov '03

    IBM Data Studio Developer

    IBM Zone - Downloads, webcasts and more!

    Free Developer Training from AppDev

    CodeProject: What Is A Framework?. Free source code and programming help http://www.codeproject.com/KB/architecture/WhatIsAFramework.aspx

  • 8/12/2019 What is a Framework

    11/1111 of 11 5/19/2009 11:57 AM

    Re: MFC yes, .NET no Nemanja Trifunovic 6:03 10 Nov '03

    Re: MFC yes, .NET no inthere 11:59 2 Jan '04

    Last Visit: 20:57 18 May '09 Last Update: 20:57 18 May '09 1 2 Next

    General News Question Answer Joke Rant Admin

    PermaLink| Privacy| Terms of UseLast Updated: 3 Nov 2003Editor: Marc Clifton

    Copyright 2003 by Marc CliftonEverything else Copyright CodeProject, 1999-2009

    Web18 | Advertise on the Code Project

    Translate this page Spanish6

    Spanish MicrosoftTranslator