How to KISS?

2017-08-08  本文已影响46人  木子里9

首先,准备两张干净的嘴。 然后,酝酿好情感,比如脸红心跳等。接下来,咳咳,前方高能预警,非战斗人员请迅速撤离(斜眼笑)

**********************************我是华丽的分割线**********************************

What does KISS stand for?

The KISS is an abbreviation of Keep It Stupid Simple or Keep It Simple, Stupid

What does that mean?

This principle has been a key, and a huge success in my years of software engineering. A common problem among software engineers and developers today is that they tend to over complicate problems.

Typically when a developer is faced with a problem, they break it down into smaller pieces that they think they understand and then try to implement the solution in code. I would say 8 or 9 out of 10 developers make the mistake that they don't break down the problem into small enough or understandable enough pieces. This results in very complex implementations of even the most simple problems, another side effect is spagetthi code, something we tought only BASIC would do with its goto statements, but in Java this results in classes with 500-1000 lines of code, methods that each have several hundreds of lines.
This code clutter is a result of the developer realizing exception cases to his original solution while he is typing in code. These exception cases would have solved if the developer had broken down the problem further.

How will I benefit from KISS

How can I apply the KISS principle to my work

There are several steps to take, very simple, but could be challenging for some. As easy as it sounds, keeping it simple, is a matter of patience, mostly with yourself.

Are there any examples of the KISS principle

There are many, and I will look for some really great one to post here. But I will leave you with the following thought:

Some of the world's greatest algorithms are always the ones with the fewest lines of code. And when we go through the lines of code, we can easily understand them. The innovator of that algorithm, broke down the problem until it was so easy to understand that he/she could implement it.
Many great problem solvers were not great coders, but yet they produced great code!

Does KISS only apply to java coding

Absolutely not, it applies to many other programming languages and extends to many other areas in your life.
The areas that the principle doesn't apply to are: emotions, love and most importantly, your marriage :)

小姐姐对 KISS Principle的简记:

什么是KISS?

Keep It Stupid Simple or Keep It Simple, Stupid

如何在工作中使用KISS原则

1.保持谦逊
2.分解任务,每个子任务可在 4h-12h内完成
3.分解问题,每个小问题可以用一个或者有限几个classes解决
4.保持方法短小,每个方法不超过 30-40 lines.单一职责,一个方法解决一个问题,而不是很多情况
5.保持类短小, 同4
6.先解决问题,再开始写代码。而不是相反
7.别担心删除代码, 重命名和重构非常重要
8.最后一点,适应所有情况,尽可能地保持代码简洁,这也是最难的一点。

小姐姐对KISS Principle的总结:

两个字简单,四个字尽量简单,六个字尽可能地简单。

请问你学会KISS了吗(挑眉)。什么? 标题党?欺骗读者感情?哈哈哈,别激动,骗的就是你。小姐姐的标题还是挺有吸引力的嘛,就问你服不服!毕竟小姐姐的KISS can apply to emotions, love and even your marriage!

上一篇下一篇

猜你喜欢

热点阅读