今日推薦開源項目:《讓他們自己動手 lmbtfy》
今日推薦英文原文:《3 Coding Stages: Writing. Avoiding. Deleting.》
今日推薦開源項目:《讓他們自己動手 lmbtfy》傳送門:GitHub鏈接
推薦理由:總有些人喜歡瞎問「xxx是什麼」這樣的問題而不會選擇自己去百度或者 google 上搜一下,更何況這些問題絕大多數搜一下都會有個像模像樣的結果,所以如果你遇上了這樣的人,就可以考慮一下使用這個項目了。你只需要把它的問題輸入搜索框,然後把鏈接丟給他就好了——既然你都真的幫他百度了,他也不好說你什麼不是嗎?
如果你想試試,可以按一下這個。http://t.cn/AipXfMKh
今日推薦英文原文:《3 Coding Stages: Writing. Avoiding. Deleting.》作者:Huseyin Polat Yuruk
原文鏈接:https://medium.com/better-programming/3-coding-stages-writing-avoiding-deleting-598d21518023
推薦理由:寫代碼只不過是剛剛開始而已
3 Coding Stages: Writing. Avoiding. Deleting.
Writing code is just the tip of the iceberg
Iceberg
This is how I see all the hidden facts that we developers usually forget or tend to ignore when we are excited about writing code or implementing something new. In the form of an iceberg…The iceberg looks small and beautiful from the outside, so people tend to forget its actual size and what hides beneath the peak. What people see from the outside is actually just the tip.
Writing code is the same thing.
When you start writing code, you are too focused on what you have to write, and you don』t focus on how much it may cost you down the road. Or, you ignore it.
As the years pass, all your experience and the mistakes you make teach you that what you used to ignore is actually the most important thing you must consider.
So what are those important facts that, as a developer, you usually forget?
Every line of code you write is:
- code that has to be read and understood by other programmers
- code that has to be tested and debugged
- code that will increase defects in your software
- code that probably will introduce new bugs in the future
In a developer』s programming life, it takes some time to develop the ability to see the whole of the iceberg. To see that, you have to pass through the three coding stages in your programming life.
Let』s speed up time and check each of the stages together.
1. Writing code as much as possible
Remember this time? You had just started your programming career as a junior developer. You were hungry, foolish. You were always on the lookout to write some more code lines and for problems to solve. You said yes to every possibility that required you to write code. You were too excited. You spent hours and days on it. You forget about sleeping.Being too excited and writing code as much as you can in that stage is good. This is how it should be. This is how we learn to program. This is how we practice being a better developer. In the meantime, while we are writing that bunch of code, we make a lot of mistakes too. And that is totally fine. They are just small mistakes. Nothing can stop you from writing code.
After some time, maybe four to five years, you start learning the new programming facts that you didn』t know before. You face the reality beyond the code. You have just seen the tip of the iceberg with writing code, and now you are curious to see what is under the sea.
This is the stage where you see that every code has to be read, understood, tested, debugged. You』ve just understood how important future maintenance is for your software to last longer.
2. Learning when not to write code
After you experienced a few programming horror stories, you found yourself thinking about how you can avoid writing unnecessary code, because you knew how much it can cost you.In this stage, you were learning when not to write code to avoid being a victim of another horror story. You were still excited about writing code, but you were wise enough to know that less code is better. Simplicity is your ultimate guide here. You understood that it』s harder to read code than to write it. That』s why you started focusing on more readable, understandable, and simpler code.
In this stage, you followed a few simple rules that transformed you into a better programmer.
- Writing less code.
- Keeping your codebase small
- Saying yes to what is essential and saying no to rest of it
Knowing when not to code is possibly the most important skill a programmer can learn. — The Art Of Readable Code
3. Deleting code as much as possible
One of my most productive days was throwing away 1000 lines of code. — Ken ThompsonIn this stage of coding, you understand exactly what Ken Thompson was trying to say with the above sentence.
You know that the more code you have, the more places there are for bugs to appear. It takes longer checkouts or compiles. It takes longer for a new employee to understand your system. There』s more stuff to move around if you have to refactor.
Furthermore, more code often means less flexibility and functionality. You understand it based on your own experience. You know when not to code, but, at the same time, you know that by deleting the unnecessary codes or refactoring complex solutions with simpler, more elegant ones, you can decrease defects in your software.
In this stage, you discovered all parts of the iceberg. You know what is under the sea. The next time you see a new iceberg, you will be more careful, and you will not make the same mistake as the Titanic did.
The key idea of this piece is not that writing code is your enemy. You are a programmer. Writing code is your passion and it will always be. It will cover a big part of your life. I just want you to understand what is behind all of that code writing, and that with each line of code you have written, you accept the burden that comes along.
Don』t surround yourself with unnecessary codes.
下載開源日報APP:https://openingsource.org/2579/
加入我們:https://openingsource.org/about/join/
關注我們:https://openingsource.org/about/love/