Coding Standards- بخش اول

  • یوسف مهرداد

یکی از مهمترین مراحل در توسعه نرم‏افزار، برنامه‏نوسی و کدنویسی آن است و یکی از مهمترین مشکلات در این مرحله، کم‏کیفیت و ناهمگون بودن کدی است که توسط برنامه‏نویسان نوشته می‏شود. برای حال یا کاهش اثر این معضل، یکی از روشهایی که معمولاً به کار می‏بریم، تدوین استانداردهای برنامه‏نویسی است که برنامه‏نویسان ملزم به پیروی از آن هستند. Robert Martin در نوشته‏ای به بررسی این موضوع پراهمیت پرداخته است.

Coding Standard
Coding Standards are a good idea. Every team should adopt a coding style and standard, and stick to it. The code produced by that team should have a consistent look and feel that is devoid of individual preferences and fetishes.

Of course this means that the members of the team will have to be mature enough to realize that it doesn’t really matter where they put their braces, or how they adorn their member variables. What matters is that they all use the same conventions.

Consistency

My goal for a good coding standard is to eliminate individual styles in favor of a team style. The code produced by a team should look like the team produced it. I don’t want any code recognizable as Bob’s or Bill’s.

This is not some egalitarian fantasy to hide individuality for the sake of the collective. Rather, it is a raw necessity. We’ve all seen products that look like they were designed by a committee. We’ve all used software products where the look and feel changed depending on which part of the application you were using. The result feels messy, clumsy, inefficient.

Individuals, used to their own particular style, will reformat other people’s code when forced to work on it, further shuffling the patchwork of styles. Over time, as each team member touches different parts of the code, and team members come and go from the team, the code begins to look like a jumbled Rubick’s cube of different styles.

Code is a product, in and of itself. The team producing it needs to take pride in the elegance of it’s structure, and the expressiveness of it’s presentation. This kind of pride is infeasible when the code is crisscrossed with a patchwork of individual styles. Without this pride, there is no drive to keep the overall product clean. Without that cleanliness, messes build up at the boundaries. And, as we all know, messes slow us down, and they spread.

گزیده:

Write your code to be read. By humans. Easily. The compiler will be able to cope. Pete Goodliffe

https://bibalan.com/?p=175
یوسف مهرداد

یوسف مهرداد


کانال تلگرام

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

برای خروج از جستجو کلید ESC را بفشارید