亚洲精品久久久久久第一页-人妻少妇精彩视品一区二区三区-91国产自拍免费视频-免费一级a在线播放视频正片-少妇天天日天天射天天爽-国产大屁股喷水视频在线观看-操美女骚穴抽插性爱视频-亚洲 欧美 中文字幕 丝袜-成人免费无码片在线观看

程序員編程培訓_每個程序員都必須知道的5條編程原則


程序員編程培訓_每個程序員都必須知道的5條編程原則

文章插圖
程序員編程培訓
Thanks to a proliferation of free online tutorials, virtually anyone can learn how to code. Once you’ve been a developer for a while though, you quickly start to realize that all code is not created equal. Programming forums are awash with horror stories detailing ginormous if-else blocks, massive spaghetti-like algorithms and redundant code that serve no purpose.
由于免費在線教程的大量增加,幾乎任何人都可以學習編碼 。一旦成為開發(fā)人員已有一段時間,您就會很快開始意識到并非所有代碼都是平等的 。編程論壇上充斥著恐怖的故事,詳細描述了巨大的if-else塊,大量類似于意大利面條的算法以及毫無用處的冗余代碼 。
While these may seem like rookie errors that only bedevil persons just starting out, many programmers carry on these bad habits well into their career with disastrous results.
盡管這些看上去像菜鳥般的錯誤,只是讓那些剛起步的人迷上了,但許多程序員卻將這些不良習慣帶入了他們的職業(yè)生涯,并帶來了災難性的后果 。
程序員編程培訓_每個程序員都必須知道的5條編程原則

文章插圖
Image Source
圖片來源
Below are some of the useful principles of programming that you must keep in mind while writing code.
以下是編寫代碼時必須記住的一些有用的編程原理 。
1.簡單性 (1. Simplicity)
Simplicity is the ultimate sophistication and perhaps nowhere more than in programming. It all begins with how you document and dissect program requirements. Each requirement should be well articulated to the extent that once you start to code, you can satisfy these requirements using the simplest of techniques.
簡單性是最終的復雜性,也許在編程中無處不在 。這一切都始于您如何記錄和分析程序需求 。每個要求都應明確闡明,以便您開始編碼后就可以使用最簡單的技術來滿足這些要求 。
Complex code not only takes more time to design and write but is also more vulnerable to errors and bugs. A labyrinth of code can make web app monitoring tedious. Beware of feature creep where you start to add new features to the program that the customer didn’t ask for as this only needlessly entangles the software.
復雜的代碼不僅需要花費更多的時間來設計和編寫代碼,而且更容易出錯和出現(xiàn)錯誤 。迷宮般的代碼會使 Web應用程序監(jiān)視 變得 乏味 。當心功能蔓延,在這里您開始向客戶不需要的程序添加新功能,因為這只會不必要地糾纏軟件 。
2.不要重復自己 (2. Do Not Repeat Yourself)
Minimal repetition is a sign of quality code. Avoid duplicating logic and data. To know whether your program has excessive repetition, think about how much code you’d need to modify if you wanted to alter one aspect of the application’s behavior.
重復最少是質量代碼的標志 。避免重復邏輯和數(shù)據(jù) 。要知道您的程序是否重復過多,請考慮如果您想改變應用程序行為的一個方面,需要修改多少代碼 。
To minimize duplication, identify all sections of code that do the same thing. Abstract this common blocks of code into a single function that you call whenever you need to perform the said task. That way, if you ever need to change how the task is performed, you’ll need only modify the one function as opposed to amending multiple lines of code throughout program.
為了最大程度地減少重復,請確定執(zhí)行相同操作的所有代碼段 。在需要執(zhí)行上述任務時,將這些通用代碼塊抽象為一個函數(shù) 。這樣,如果您需要更改任務的執(zhí)行方式,則只需要修改一個函數(shù),而不是在整個程序中修改多行代碼即可 。


以上關于本文的內容,僅作參考!溫馨提示:如遇健康、疾病相關的問題,請您及時就醫(yī)或請專業(yè)人士給予相關指導!

「愛刨根生活網」www.malaban59.cn小編還為您精選了以下內容,希望對您有所幫助: