The book The Pragmatic Programmer introduces this critical that one of the ways to treat our knowledge is not to duplicate your knowledge in your codes, or anywhere else without any sufficient or appropriate reason, so I'd like to kinda share it here.
DRY - Don't Repeat Yourself
It isn't a question of whether you'll remember: it's a question of when you'll forget.
It clearly made an impression on me; It does not just make sense to me what the textbook tells us, such as the fact that duplication later will be troublesome since if you need to change a certain part, then you will need to change multiple places, but it also made me realize that without any sufficient reason, duplication just makes our project or work useless.
Unnecessary Extra Information Causes Only Badness
I remember that many of documents about right ways of mark-up coding tell us that any useless spaces, codings.
Example: CSS Coding
The small careless you leave, such as two characters 'px' can critically make your website slow as well. For example, here is a small CSS code that I am sure you have seen it more than often if you are familiar with CSS.
The code above sets the both margin and padding of the selected area (in this case, 'body') to 0px. Here is another block of code:
Although you do not see much difference between those two blocks of codes, the loading speed varies; the second block of code will definitely be loaded faster than the first one. This is because in the first block of code, there are some useless spaces for making the code look somewhat organized, the words 'px', and an extra semicolon at the end. Whether containing those in your code or not definitely makes the difference in terms of the speed for your website to be loaded.You can find more info about how to optimize your CSS codes here: 5 CSS shorthand tips and how to optimize CSS
Therefore, I thought this is important that we treat our knowledge carefully so that we can prevent any negative effects caused by any misuse or extra-coding of our knowledge
No comments:
Post a Comment