This post ia about what is KISS (Keep It Simple, Stupid) and why is not related with KISS rock band …
Does not apply for your: emotions, love and most importantly, your marriage …
Table of contents:
What is KISS anyway? KISS is a rule that was created in the context of aircraft design, has found its application in programming. The simplicity rule allows a moderately skilled mechanic to understand and repair in combat conditions, using simple tools. This rule has been carried over and adapted to many other fields of science and engineering. It works great in programming.
KISS is not a set of rules like SOLID, it is more like the DRY rule. This means that we should remember something, but we do not define specific rules. KISS is a principle that tells us what we should remember when writing code to make everything we do as simple and readable as possible.
Keeping things simple is, ironically, not simple! It requires abstract thinking. It requires knowledge of the domain you’re working on. It requires knowledge of the code, the framework, and the language you’re working with. It requires experience. In fact, let me present you this quote by Martin Fowler:
A codebase which doesn’t change is a myth. The context around your application will change (libraries, market…) and, as a result, your application will need to change, too. To modify your application, you’ll have to understand how the different parts of your system work together. This representation sitting in your brain is the mental model of your system.
Depending on the system, your mental model will be more or less accurate. What about complex systems? I’m sure you’ve guessed it: it’s difficult and tiring to create an accurate mental model of a complex application.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. — Martin Fowler
KISS: “Keep it simple, stupid” or “keep it stupid simple” is a design principle that states that most systems work best if they are kept simple rather than made complicated. And while this is logical, it is sometimes difficult to achieve.#coding #programming— Coding Blocks (@CodingBlocksIn) February 20, 2022
Keep It Super Simple
Keep It Simple, Sweetie
Keep It Small and Simple
Keep It Simple, Smart
Keep It Short and Simple
Keep It Short and Sweet
How to Achieve KISS
- program as if you were writing code for the person who will maintain the project
- making sure that you don’t have to think about individual pieces of your code
- try not to let the code to think too much during the analysis
- always leave the code cleaner than you found it
- keep your method small
- keep your classes small, same methodology applies here as we described for methods.
- break down your tasks into sub tasks that you think should take no longer than 4-12 hours to code
- solve the problem, then code it
- don’t be afraid to throw away code
- each problem should be able to be solved within one or a very few classes
- for all other scenarios, try to keep it as simple as possible, this is the hardest behavior pattern to apply to, but once you have it, you’ll look back and will say, I can’t imagine how I was doing work before
Benefit of KISS
- faster and easier to understand the code
- less bugs
- it is easier to maintain a given system and it is easier to modify
- systems based on simplicity just work better
- going back to simpler code saves you less time understanding it
- you will be able to produce code to solve complex problems in fewer lines of code
- you’re code base will be more flexible, easier to extend, modify or refactor when new requirements arrive
- highter qualiti code
- able to work in large development groups and large projects since all the code is stupid simple
The conclusion is that the simplest solutions are the best and there is no need to complicate them. Writing good code is not easy, and I believe it is a career-long journey, and an article or a book alone is not sufficient.
- KISS - the band ;)
- The Kiss Principle In Survey Design: Question Length And Data Quality
- Applying KISS to Healthcare Information Technolog
- BOOK, PRESS KISS’ PAUL STANLEY OVERCAME DEAFNESS, DEFORMITY AND BULLYING TO BECOME A ROCK STAR
- Keep It Simple Stupid (KISS)