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 Video Library
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
View Events Video Library
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
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Legacy Code Refactoring: Tips, Steps, and Best Practices
  • Common Performance Management Mistakes
  • The Key To a Good Start in Programming
  • Developers Are Scaling Faster Than Ever: Here’s How Security Can Keep Up

Trending

  • AWS Amplify: A Comprehensive Guide
  • Choosing the Appropriate AWS Load Balancer: ALB vs. NLB
  • Cognitive AI: The Road To AI That Thinks Like a Human Being
  • How To Handle Technical Debt in Scrum
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Weasel Words

Weasel Words

Roger Hughes user avatar by
Roger Hughes
·
Sep. 25, 11 · Interview
Like (0)
Save
Tweet
Share
5.28K Views

Join the DZone community and get the full member experience.

Join For Free

The other day I had to look into a project’s source code and shocked by the state it was in. I can, hand on heart, say I haven’t seen code like it for 10 years... which made it interesting.

Everyone, even the most inexperienced programmer seems to be able to look at code and figure out when it’s bad, after all there are obvious signs: for example it’s unintelligible, has lots of repetition through cut ‘n’ paste coding and its class and method names contain weasel words1

Weasel words turn up in both class and method names. Classes usually have weasel words appended to the end of their name, with the most common being Utils, Helper and Processor, for example: GeneralUtils, MiscellaneousUtils, PageHelper and XmlProcessor.

These Utils and Helpers are usually classes that are containers for disparate miscellaneous functions.

Then we move on to weasel word method names, a sure sign that the programmer who wrote the code didn’t understand what she2 was doing. Examples of weasel word method names are:

  • process(...)
  • manage(...)
  • parse(...)
  • fixup(...)

...with ‘process’ and ‘manage’ being my favourites.

Weasel Word class and method names like this are an example of the ‘Functional Decomposition’ anti-pattern, which has the following cause: lack of programmer experience and or ineptitude. The programmers just didn’t understand Object Orientation and have written functions that just happen to be in classes. Note that If you read various books and articles on this pattern, they usually list additional reasons such as bad specifications or architecture, but in my experience, this one’s usually down to us, the programmers - full stop3

The solution to this problem is simply refactoring. Take a look at the Weasels, itemise the methods in those Utils classes, move them to there own meaningful classes, add JUnit tests (if the code is that bad then I’ll put money on there being no unit tests). Remember that there isn’t a magic wand for this situation, you have to take the long view, refactoring a little at a time (story by story if you’re in the Agile world), so as not to break the product.

The cowboys who wrote the project I looked at probably left town on the last stage a long time ago. They either learn by experience and improve or simply go on making mess after mess leaving people like you and me to clear up...


1 I first saw the term Weasel Words when coined by Scott Adams in his Dilbert cartoon. He used it to refer to management speak, but is equally applicable to Software development.

2 You’ll notice I used the word she here. I’m not being misogynistic, I just didn’t want to assume that all programmers are male, although in my experience the overwhelming majority are. Besides, it seems quite trendy to refer to programmers as ‘she’ in technical books these days.

3‘Full Stop’ = English for ‘period’.

 

From http://www.captaindebug.com/2011/09/weasel-words.html

Programmer (hardware) Anti-pattern IT Book Architecture Testing Clear (Unix)

Opinions expressed by DZone contributors are their own.

Related

  • Legacy Code Refactoring: Tips, Steps, and Best Practices
  • Common Performance Management Mistakes
  • The Key To a Good Start in Programming
  • Developers Are Scaling Faster Than Ever: Here’s How Security Can Keep Up

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

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: