Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Practical Adoption of Design Patterns

Practical Adoption of Design Patterns

Often there is a distinction between concepts and how those concepts are applied in the real world. Design patterns are no exception.

Design patterns are everywhere. It's hard to read a technology publication or Web site without seeing some reference to design patterns. By now you have probably read (or at least paged through) some of the design pattern books, such as Core J2EE Design Patterns or Design Patterns by the Gang of Four. At this point you are possibly asking some questions about design patterns. How will design patterns help me? Are they a silver bullet? Are there any problems with design patterns? Don't I get design patterns from my integrated development environment (IDE)?

All of these are good questions to ask as you go through the process of adopting design patterns. Often there is a distinction between concepts and how those concepts are applied in the real world. Design patterns are no exception. In this article we'll look at the real world adoption of design patterns. This information should help you make the right decisions about successfully adopting design patterns in your project.

Quick Overview
Design patterns provide a way to share experiences so that a community can benefit and not continually reinvent the wheel. Design patterns typically capture a problem description, the context of the problem, a proposed solution to the problem, and any anticipated consequences of using the solution. In order to have the broadest applicability (and therefore usefulness to the largest audience), design patterns are often abstracted from exact details that are situation dependent. This abstractness results in some required interpretation to apply the design pattern to the case at hand. This is an important detail: even though design patterns are a great way to share expertise, it is often not trivial to correctly apply that expertise.

The concept of design patterns originated in the construction industry. Architects (the ones that design buildings, not computer systems) realized they needed to share ideas about correct design techniques. These ideas were captured in design patterns that allowed the architect community to benefit from shared experiences and lessons learned. Design patterns made the leap from construction to computer systems in the late '80s. Object-oriented (OO) philosophies were gaining popularity and design patterns were a way to educate the new OO followers on best practices.

The book that launched design patterns into the limelight is Design Patterns: Elements of Reusable Object-Oriented Software by Richard Gamma, et al (the authors are commonly referred to as the Gang of Four [GoF]). As design patterns have grown in popularity, the number of flavors they come in has also ballooned in what could be described as the "Ben and Jerry" effect. For those of you not familiar with the popular ice cream brand, Ben and Jerry's is a purveyor of fine ice cream products that come in every imaginable combination of ingredients (including some you would never have ever imagined). So it is with design patterns, which originated with the general OO design patterns from the GoF book but now include design patterns that are specific for development languages, application servers, industry verticals, and so on.

Categorizing Design Patterns
Design patterns are often grouped together based on some common characteristics. The GoF book divided design patterns into three categories: Creational, Behavioral, and Structural. Design patterns for J2EE are often divided into Presentation Tier, Business Logic Tier, and Integration Tier. This grouping may make it easier to describe common details that all the design patterns share or simply make it easier to catalog and discover design patterns.

For our discussion of the practical adoption of design patterns, we need to divide design patterns into two categories: broad exposure and isolated use. This division is based on the visibility of the design pattern to the designers and developers of the application and the dependency of multiple parts of the application on the design pattern.

Broad exposure design patterns are distinguished by affecting the designs and development of more than just one team member or more than one area of the application. Some qualities of this type of design pattern are:

  • Adopting it has the downstream effect of many classes being created that depend on the design pattern.
  • Different parts of the application are aware of the use of the design pattern.
  • The decision to use this design pattern cannot be easily undone.

    Some examples of this type of design pattern are the Model-View-Controller (MVC) pattern, the Value Object J2EE pattern, and the Data Access Object (DAO) J2EE pattern.

    Isolated use refers to design patterns for which the use of the design pattern is a hidden detail. Some qualities of this type of design pattern are:

  • The design pattern does not impact the work of other team members or other parts of the application.
  • The decision to use the design pattern could easily be changed with minimal impact.

    Some examples of this type of design pattern are the Singleton GoF pattern or the Intercepting Filter J2EE pattern.

    Dividing design patterns into these categories provides a quick approach for understanding the scope of the design pattern. Understanding scope makes it easy to assess the impact of the design pattern. Is it a design pattern that can be used and discarded? Is it a design pattern that once adopted will impact the design of the application? Is it a design pattern that affects multiple parts of my application and possibly other applications? Understanding these impacts up front provides guidance for adopting the design pattern.

    Design Pattern Adoption AntiPatterns
    As design patterns grew in popularity, another type of patterns emerged called AntiPatterns. Whereas design patterns offer expert knowledge on repeatable best approaches, AntiPatterns describe often repeated behavior that should be avoided. AntiPatterns prove there is as much to be learned from people who do things wrong as those who do things right.

    In this section, we'll look at AntiPatterns that apply to the adoption of design patterns. Understanding these AntiPatterns should help you avoid the pitfalls of design pattern adoption. Like design patterns, the AntiPatterns here may be entirely new to you, in which case they provide some foresight; or they may be situations you are somewhat familiar with, in which case they can add color to your experiences and let you know that you're not alone. If you are interested in reading more AntiPatterns, see the resource list at the end of this article.

    AntiPattern Checklist
    Design Patterns? Yes, We Have All of Them

    Problem: Determining which design patterns to include on a project.

    Applies To: Both broad exposure and isolated use design patterns.

    Context: A developer has been introduced to design patterns and wants to use them on a project.

    Forces: Two forces are usually the source for this AntiPattern. One is the desire of the developer to improve the project by including best practices from design patterns. The other is that innate curiosity drives the developer to use the project for research on design patterns.

    Supposed Solution: All known design patterns are used on the project. A checklist is formed from the design pattern book and the motivating goal is to be able to check off all of the design patterns.

    Resulting Context: The project team and the delivered application suffer from the unnatural introduction of too many design patterns. This results in designs and development that are overly complex. This unnecessary complexity can impact the development effort in terms of the amount of work that has to be done, the ability of the development team to understand what is happening, and the actual performance and functional correctness of the application.

    Design Rationale: Design patterns are a great source of expert knowledge. If using them is good, then using all of them is mistakenly thought of as better.

    Real Solution: The description of a design pattern includes the context for which the pattern is targeted. Thought must be given to ensure that the design pattern is a match for the project. Second, design patterns are often incorporated not from someone reading a design pattern book and asking "where can I use this design pattern?" but from someone looking for a solution to a problem they have discovered.

    Implementation per Developer/Project AntiPattern
    (Also known as: Design pattern xyz? Yeah, we have 10 of those.)

    Problem: Controlling the implementation of design patterns within a project and across projects.

    Applies To: Both broad exposure and isolated use design patterns benefit from addressing this situation. However, broad exposure design patterns should definitely have controlled implementations.

    Context: The development team is incorporating design patterns into the project. The team consists of many experienced developers who understand when to use design patterns. The correct design patterns are being used. If multiple projects are involved, there is no design pattern - implementation sharing between projects.

    Forces: There are tight deadlines and the team is very efficient individually. Team efficiency might be impacted if they have to reuse implementations. It is assumed that since they are experts, their implementation will be good anyway. In the case of multiple projects, the cross-team communication and code sharing either is not considered or is dismissed as a potential impact on schedules.

    Supposed Solution: The team can include and implement the design patterns they need as individuals.

    Resulting Context: Even though the correct design patterns were used, they were implemented in many different ways. There are incompatibilities between the implementations that restrict integration and reuse efforts. More time and effort than necessary will have to be spent maintaining, debugging, and extending the various implementations. Eventually the various implementations will have to be consolidated.

    Design Rationale: A team of experts should be allowed to work alone. Including design patterns is good enough, there is no reason to share implementations.

    Real Solution: The development team should coordinate their use of design patterns. Sharing a common implementation of a design pattern can lower costs in the future, but more important, it should result in cross-developer compatibility today. If necessary, this sharing could be limited to design patterns that fall into the broad exposure category we discussed earlier. Reusing implementations is also valuable across projects, especially if they are expected to integrate in the future.

    Role of IDEs in Design Pattern Adoption
    IDEs continue to evolve and offer more functionality. Originally IDEs consisted of an editing environment and some debugging facilities. Now they often include a design environment, auditing facilities, integration with configuration management systems, and more. As IDEs expand their reach, their role in implementing design patterns needs to be identified. Of course, design patterns are implemented in a development language and IDEs can be used for editing the source code. But what other roles can IDEs play?

    Some IDEs have pull-down menus that allow you to select design patterns to include in your application. While this can expedite the inclusion of a design pattern, it might just result in writing bad code faster. There are a couple of factors to remember in evaluating this feature.

    One is that design patterns describe problems in the abstract and require some interpretation to arrive at the correct implementation. However, they often include a "sample implementation" and it is this sample class structure that the IDEs insert into your application. This is probably not the implementation that you need and just dropping it into your application will introduce more confusion and require more editing and refactoring than just putting thought into your own original implementation.

    Another problem with the IDE drag-and-drop design pattern approach is the two AntiPatterns we already discussed. Expediting the implementation of design patterns is more likely to result in rampant inclusion of design patterns and multiple versions of the same design pattern than it is to solve any problems.

    The challenge with design patterns isn't just in getting a quick implementation, but making sure you are using a correct implementation, and ideally an implementation that already exists in your organization.

    BEA WebLogic Workshop 8.1 and Design Patterns
    Since you are probably a BEA customer if you are reading this article, you may be wondering how the new BEA WebLogic Workshop 8.1 impacts your design pattern considerations. First of all, WebLogic Workshop is an IDE so the previous section on IDEs applies. The two additional aspects of Workshop that are interesting for this discussion are Controls and pre-implemented design patterns.

    WebLogic Workshop Controls are a way to package functionality so that it can be easily included in your application using the Workshop IDE. The packaging includes the visual elements required for the IDE, the runtime behavior, the configuration required, and more. How do Controls impact your inclusion of design patterns? Remember the earlier segregation of design patterns into isolated use and broad exposure? Design patterns that fall into the isolated use category may be candidates to be packaged as Workshop Controls. Packaging the design pattern as a Control would allow other users of the Workshop IDE to share an implementation, avoiding the Implementation per Developer/Project AntiPattern.

    You may be wondering why the broad exposure category cannot be implemented as Controls. The reason is that the broad exposure design patterns result in the creation of many other classes or in some dependence with other applications. This situation does not lend itself to the plug-and-play aspect of Controls. Adoption of the broad exposure design patterns should be done with much thought and consideration, and once adopted cannot be undone easily. These requirements do not match with the WebLogic Workshop Control goals.

    WebLogic Workshop also comes with many pre-implemented design patterns, such as Pageflow and the user interface structure. From within Workshop, you can create JSPs and define Pageflows to control the navigation between the pages of your Web application. Under the hood, WebLogic Workshop uses the popular Apache Struts presentation layer framework. This aspect of Workshop (which uses Struts) provides a Model-View-Controller (MVC) design pattern implementation, which means you won't have to create your own MVC implementation. Workshop includes other functionality that will probably replace your own design pattern implementations. While it is nice to get some of these design patterns implemented out-of-the-box, you should validate that you are comfortable with not only the implementation but with any dependency on WebLogic Workshop that the implementation creates.

    Three Steps for Successful Design Pattern Adoption
    So how do you merge the adoption of design patterns with the tight deadlines, scaled back budgets, and limited team resources that exist in many companies today? The following are three steps to follow to make your design pattern experience successful.

    Strong Communication and Education
    Many organizations have technical leadership, possibly formalized as an architects forum or informally as the recognized experts. These leaders should promote open communication around design pattern adoption and should educate the teams about specific design patterns. The communication should be across development teams and projects to proactively prevent adoption silos and multiple unique implementations (remember the Implementation per Developer/Project AntiPattern). The education can take the form of informal internal lunch-and-learns, formalized internal classes, or maybe even sending a few people to external training. Any of these education options should promote correct applications of design patterns. If only a limited audience can attend the training, the best candidates are ones who feel comfortable educating their peers upon return.

    Mentored Design Pattern Adoption
    Design patterns can be used for the benefit of the project but they are also easy to misuse to the detriment of the application. Their use should be encouraged but their adoption should be reviewed and verified. Design patterns can be included during both design and development. In either case, design patterns' use should be identified and verified by the reviewer. Also during this review, situations may be encountered where additional design patterns may be applicable that weren't originally included. Even if official reviews are not done in your environment, this step could be accomplished through peer reviews or team discussions. The reviewers in this step should be either part of the leadership team or in open communication with them.

    Mentoring adoption is especially critical for the broad exposure category of design patterns. These are the design patterns that have more associated risk because they will create dependencies. These dependencies may be within a class of objects, such as data access objects (DAOs) that only work within the scope of a broader DAO design pattern implementation, or across application boundaries, such as use of the Value Object design pattern to communicate data between applications and application layers. These design patterns are also ones that may have been implemented by somebody else on the project or by a different project, and that implementation should be reused versus creating another unique implementation.

    Reuse Implementations, Not Just Design Patterns
    While there is a certain satisfaction that comes in creating your own implementation of a design pattern, there is more benefit to the team and company when reuse takes place at the code level and not just the design idea level. The initial benefit design patterns provide to an organization is improved implementations. The real goal, however, should be to reuse implementations. Reusing implementations will result in: a) other reusable classes (that depend on the common implementation); b) lower development time and costs; c) lower maintenance time and costs; and d) easier integration both within and between applications.

    This reuse is more important (and sometimes essential) for the broad exposure category. These design patterns are the ones that create external dependencies (where integration would benefit from a common implementation) or result in a whole library of custom classes (that would be reusable if there was a common foundation). The isolated use category would benefit from reuse but they might be more difficult to reuse if they were strongly customized to their specific situation.

    Something you may ask yourself is, "If reuse is better, why don't design patterns come with a reusable implementation?" We touched on this when we talked about how design patterns are provided for the benefit of the largest audience. Achieving this goal of broad applicability would be difficult, if not impossible, if it came with a predetermined implementation. However, once the design patterns are applied to a particular problem domain or technical infrastructure, the resulting implementation may be reusable within that environment.

    Design Patterns Through Architecture
    It may seem a daunting task to understand how design patterns apply to your situation, build a quality implementation, and then encourage the reuse of that implementation. One approach to this is the introduction of application architecture into your environment. Application architecture provides the structure required for your application so that the development team can focus on the domain logic of the application. This includes implemented design patterns. Instead of reusing design pattern concepts or individual implementations, the architecture can be reused across projects and applications. This shared common implementation ensures compatibility and provides a lower cost alternative to developing and maintaining many different implementations. The compatibility provides the required technical foundation for reuse efforts to be possible. There is not enough space here to go into the other valuable qualities of architecture, such as runtime monitoring and management, configurable application logic, and adaptable behavior. You can learn more about architecture from the Carnegie Mellon Software Engineering Institute (www.sei.cmu.edu/ata/ata_init.html).

    Design patterns are an amazing resource that should be used to your advantage. While design patterns provide reusable concepts, the challenges come in determining which design patterns to use and working towards a reusable implementation. By understanding some of the risks involved with design pattern adoption, you can hopefully avoid them as you continue to learn and implement more design patterns.

    Following the steps outlined in this article will put a process in place that can be used to promote the successful adoption of design patterns on your team and within your organization.


  • Brown, William J.; Malveau, Raphael C.; McCormick, Hays W. "Skip"; Mowbray, Thomas J. (1998). AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis. John Wiley & Sons
  • AntiPatterns: www.antipatterns.com
  • Wiki site: http://c2.com/cgi/wiki?AntiPattern
  • More Stories By Walter Hurst

    Walter Hurst, Founder & CTO
    Walter Hurst has been working with advanced technologies for over ten years. Before founding Wakesoft, Walter was an independent consultant where he used early versions of Wakesoft technology to deliver Internet solutions to clients. Previously, Walter was a Technical Architect at Xpedior where he led internal efforts to develop application architectures that were implemented across client projects. Before Xpedior, Walter was a Senior Consultant at Andersen Consulting – Center for Strategic Technology. At Andersen, Walter led Enterprise projects for various Fortune 100 clients. Walter received a B.S. in Computer Engineering from the University of Michigan.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

    @ThingsExpo Stories
    Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
    Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
    Product connectivity goes hand and hand these days with increased use of personal data. New IoT devices are becoming more personalized than ever before. In his session at 22nd Cloud Expo | DXWorld Expo, Nicolas Fierro, CEO of MIMIR Blockchain Solutions, will discuss how in order to protect your data and privacy, IoT applications need to embrace Blockchain technology for a new level of product security never before seen - or needed.
    Imagine if you will, a retail floor so densely packed with sensors that they can pick up the movements of insects scurrying across a store aisle. Or a component of a piece of factory equipment so well-instrumented that its digital twin provides resolution down to the micrometer.
    In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settle...
    BnkToTheFuture.com is the largest online investment platform for investing in FinTech, Bitcoin and Blockchain companies. We believe the future of finance looks very different from the past and we aim to invest and provide trading opportunities for qualifying investors that want to build a portfolio in the sector in compliance with international financial regulations.
    No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
    Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
    In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
    "IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
    A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
    When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
    Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
    We are given a desktop platform with Java 8 or Java 9 installed and seek to find a way to deploy high-performance Java applications that use Java 3D and/or Jogl without having to run an installer. We are subject to the constraint that the applications be signed and deployed so that they can be run in a trusted environment (i.e., outside of the sandbox). Further, we seek to do this in a way that does not depend on bundling a JRE with our applications, as this makes downloads and installations rat...
    Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
    DX World EXPO, LLC, a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
    In this strange new world where more and more power is drawn from business technology, companies are effectively straddling two paths on the road to innovation and transformation into digital enterprises. The first path is the heritage trail – with “legacy” technology forming the background. Here, extant technologies are transformed by core IT teams to provide more API-driven approaches. Legacy systems can restrict companies that are transitioning into digital enterprises. To truly become a lead...
    Digital Transformation (DX) is not a "one-size-fits all" strategy. Each organization needs to develop its own unique, long-term DX plan. It must do so by realizing that we now live in a data-driven age, and that technologies such as Cloud Computing, Big Data, the IoT, Cognitive Computing, and Blockchain are only tools. In her general session at 21st Cloud Expo, Rebecca Wanta explained how the strategy must focus on DX and include a commitment from top management to create great IT jobs, monitor ...
    "Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
    The IoT Will Grow: In what might be the most obvious prediction of the decade, the IoT will continue to expand next year, with more and more devices coming online every single day. What isn’t so obvious about this prediction: where that growth will occur. The retail, healthcare, and industrial/supply chain industries will likely see the greatest growth. Forrester Research has predicted the IoT will become “the backbone” of customer value as it continues to grow. It is no surprise that retail is ...