Take me back!! I want my CSS!! Click me to get back :)

×

Are you missing out on your dream job?

Enrollment for Skillcrush Blueprints JUST OPENED. Register today!

Click Here

Kludge

Web developer’s duct tape to the rescue! A kludge is a quick-fix; a less-than-ideal solution to a coding problem.

Web developer’s duct tape to the rescue! A kludge is a quick-fix; a less-than-ideal solution to a problem. Just like duct tape, a kludge gets the job done, but it’s not easy on the eyes. A kludge is usually a small block of code or a script that fixes a single bug, or presents a workaround. This code is inelegant, hard to maintain, and difficult to extend with your existing code base, because it wasn’t written with the code base in mind.

A kludge can also refer to an entire system or website that is heavily reliant on lots of poorly written blocks of code. All these blocks may fit together to make a website, but the blocks are brittle.

Kludges may sound relatively benign, but there can be serious risks. Kludges can open security holes, or they can break and create bugs when newer code is added to other areas of your website. This can create a snowball effect of needing more and more kludges just to keep your system running.

While kludges are sometimes unavoidable, there are steps you can take to minimize the likelihood that you’ll have to use one:

Plan ahead
Having a detailed plan when building a website means you can anticipate issues and bugs, and architect your code to be cleaner and more maintainable. When bugs do appear, as they always do, this will make it easier to roll out fixes that aren’t kludgy.

Write unit tests
If you have a suite of units tests for your application, you can run them after every code change you make to sure that you haven’t broken other areas of your site. So even if you do have to rely on a kludgy fix for a bug, you can run your units tests and verify that your fix didn’t create issues elsewhere.

Refactor
Code refactoring is a great way to clean up your code to make it easier to read and maintain, and to identify issues you may have missed in previous code-writing. While this won’t prevent your website from ever having bugs, it will make it easier for you to fix bugs in an elegant, non-kludgy way when they do appear.

Your email address will not be published.

0 comments

Want more articles like this?

Sign up to get the most recent tech news, tips and career advice.