Eliminating Code Smells

Christian Baumann's profile
Christian Baumann

Principal Software Tester

Challenge Description

To eliminate a code smell, you first need to identify that there is a smell, then you need to come up with a way to safely remove that smell. However, removing code smells can have many advantages, such as making your code base cleaner and thus easier to read and maintain.

Instructions:

Identify code smells

Have a look at the provided code examples (or pick some code that you or your team has created) and identify anything that you think is a code smell. Also think about why your finding is a code smell.

Eliminate code smells

Eliminate the found code smells by applying proper programming principles, maybe by introducing meaningful names for variables or removing duplication.

Also think about:

  • Advantages & disadvantages of your solution

  • How to ensure you didn’t introduce any bugs or other code smells?

Wrap-up:

Removing code smells is a good way to improve the code base in many ways. It speeds up development, decreases the risk of bugs & failures as well as technical debt. Also, it makes it easier to maintain the application in the future, by any programmer, including yourself.

What you’ll learn
  • Follow good programming techniques & implement good design
  • Decrease the risk of future bugs & failures
  • Reduce the risk of technical debt

Prerequisites

Example code that can be used in this activity can be found at https://christianbaumann.dev/workshops/2022-testbashuk-workshop-codesmells-101/

Resources

Watch Party: TestBash Revisited with Paul Grizzafi
I've Made Huge Mistakes in Test Automation, so You Don't Have To - Butch Mayhew
Taking an Agile Approach to Test Automation by TestRail
Announcing 30 Days of Tools!
How Guild Education Automates
Redefining Test Automation - Richard Bradshaw
The Hidden Treasure Of Static Analysis: Finding Risks In Forgotten Places
Staying Tool Aware with Rahul Parwal and Ajay Balamurugadas
Who Will Guard the Guards Themselves? How to Trust Your Automation and Avoid Deceit - Bas Dijkstra
With a combination of SAST, SCA, and QA, we help developers identify vulnerabilities in applications and remediate them rapidly. Get your free trial today!
Explore MoT
TestBash Brighton 2024
Thu, 12 Sep 2024, 9:00 AM
We’re shaking things up and bringing TestBash back to Brighton on September 12th and 13th, 2024.
MoT Intermediate Certificate in Test Automation
Elevate to senior test automation roles with mastery in automated checks, insightful reporting, and framework maintenance