DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Guide To Selecting the Right GitOps Tool - Argo CD or Flux CD
  • The SPACE Framework for Developer Productivity
  • Hyperion Essbase Technical Functionality
  • How To Design Reliable IIoT Architecture

'Thin Patterns' for Killing Design Pattern Bloat?

John Esposito user avatar by
John Esposito
·
Feb. 17, 14 · Interview
Like (0)
Save
Tweet
Share
11.34K Views

Join the DZone community and get the full member experience.

Join For Free

This week I read a 2010 FoSER paper on software bloat analysis. The paper summarizes a bunch of research on runtime bloat of Java applications, nicely Java-flavoring Myhrvold's Four Laws and putting solid research behind those ubiquitous war-stories. Also includes a good bibliography.

The whole text is worth reading (only 4pp), but one direction for further research -- which the authors call 'thin patterns' -- stuck out in my mind:

While design patterns have been extremely successful in helping programmers write highly-manageable code, they are the root causes of many types of runtime bloat. In many large applications, for instance, in order to implement a visitor pattern, the programmer uses inner classes to represent different kinds of visitors, which contain nothing but a visit method. Such a visitor class can be instantiated an extremely large number of times (e.g., the allocation sites are located in loops with many layers of nesting), and all objects created are identical: they have no data and are used only for dynamic dispatch. It is not free to create and deallocate these objects, and significant overhead reduction can be seen when we use only the method without creating objects.


Future research on patterns may consider the creation of a few specialized versions for each existing pattern (i.e., thin patterns), which provides different tradeoffs between inefficiency and modularity. On the compiler side, pattern-aware optimization techniques could be expected to remove inefficiencies and generate higher-quality code.

This sounded exciting, so I did a quick lit search and couldn't find any follow-up. So I emailed one of the authors, who replied (super-amazingly-quickly) and confirmed that he also doesn't know of any more recent research in this direction.

But plenty of experienced Java devs have thought long and hard about the performance effects of using design patterns. You know better than most how to write performant Java and not reinvent the wheel at the same time.

So here's a hopefully-fruitful query:

Have you run into significant bloat caused by sloppy use of design patterns? If so, have you developed more specialized patterns optimized for your applications?

And if so (and here's the fruitfullest part) have you found any of these specialized patterns useful in other applications, or are the optimizations too application-specific to be applied repeatedly?

Design

Opinions expressed by DZone contributors are their own.

Trending

  • Guide To Selecting the Right GitOps Tool - Argo CD or Flux CD
  • The SPACE Framework for Developer Productivity
  • Hyperion Essbase Technical Functionality
  • How To Design Reliable IIoT Architecture

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: