小米5s服务器代码_通过5S实现更易管理,更高效的代码
小米5s服務器代碼
Sometimes code turns ugly. We add quick fixes or enhancements and our code starts to become a big tangle of functions that aren’t laid out in any sort of organized fashion. Over time, our code becomes bloated, difficult to maintain and what should be simple little fixes can quickly turn into long walks through messy syntax. One way of combating this is by implementing the 5S System.
有時代碼變得丑陋。 我們添加了快速修復或增強功能,并且我們的代碼開始變得雜亂無章,無法以任何有組織的方式進行布局。 隨著時間的流逝,我們的代碼變得腫,難以維護,而簡單的小錯誤修復很快就會變成凌亂的語法。 解決此問題的一種方法是實施5S系統。
The 5S System is actually a Japanese improvement process originally developed for the manufacturing industry. Each of the five words when translated to English began with ’S’ hence we call it the 5S System. Like many good philosophies however, the 5S System can apply to a variety of topics. For example, the 5S System has been applied by the Hewlett-Packard Support Center in a business context and has resulted in improvements like reduced training time for employees and reduced call-times for customers. By using the system applied to coding, we can make our code more efficient and much easier to maintain.
5S系統實際上是最初為制造業開發的日本改進程序。 五個單詞中的每個單詞翻譯成英語后都以“ S”開頭,因此我們將其稱為5S系統。 像許多優秀的哲學一樣,5S系統可以適用于各種主題。 例如,惠普(HP)支持中心在商業環境中應用了5S系統,并帶來了改進,例如減少了對員工的培訓時間和減少了對客戶的呼叫時間。 通過使用用于編碼的系統,我們可以使我們的代碼更高效且更易于維護。
塞里(排序) (Seiri (Sort))
The first ’S’ is Seiri which roughly translates to ‘Sort’. Applied to the manufacturing industry, the goal of sorting was to eliminate unnecessary clutter in the workspace. The idea here is that in a workspace, you need to sort out what is needed and what is not. If you eliminate all of the items that are not necessary, you immediately have a workspace that is cleaner and thereby more efficient
第一個“ S”是Seiri,它大致翻譯為“排序”。 在制造業中,分類的目的是消除工作空間中不必要的混亂。 這里的想法是,在工作空間中,您需要梳理需要的和不需要的。 如果您消除了所有不必要的項目,那么您將立即擁有一個更干凈,更高效的工作空間。
Applied to coding, this can mean going through our code and determining if we have any lines of code that are really just taking up space. This can be things like error checking that has already been done at a previous step, or if working in the DOM, retrieving the same element in more than one function, instead of simply passing a reference to the element. This definitely applies to CSS code as well. There are very few stylesheets in use that don’t have a line or two that are really just unnecessary because they either accomplish nothing different than the user agent’s default behavior, or are being overridden elsewhere.
應用于編碼時,這可能意味著要遍歷我們的代碼并確定我們是否有任何實際上僅占用空間的代碼行。 這可以是上一步已經完成的錯誤檢查之類的事情,或者是在DOM中工作時,可以在多個函數中檢索同一元素,而不是簡單地將引用傳遞給該元素。 這當然也適用于CSS代碼。 很少使用沒有一行或兩行的樣式表,這些樣式表實際上只是不必要的,因為它們要么完成與用戶代理的默認行為相同的功能,要么被其他地方覆蓋。
封隔(拉直) (Seition (Straighten))
The next ’S’ means to straighten or ‘sort in order.’ This step involves arranging resources in the most efficient way possible so that those resources are easy to access.
下一個“ S”表示拉直或“按順序排序”。 此步驟涉及以最有效的方式安排資源,以便易于訪問這些資源。
For coders, this means going through and making sure that functions and code snippets that are related are grouped together in some way. This can be done by a variety of ways. If you are working with server-side scripting, consider placing related code together in an include. In CSS, use either comments or imported stylesheets to separate style declarations based on either the section of page they refer to or the design function that they carry out. (Typographic styles in one place, layout styles in another). In object-oriented programming, organize your code into logical classes and subclasses to show relationships.
對于編碼人員來說,這意味著要仔細檢查并確保以某種方式將相關的功能和代碼段組合在一起。 這可以通過多種方式來完成。 如果使用服務器端腳本,請考慮將相關代碼放到包含中。 在CSS中,根據注釋所引用的頁面部分或所執行的設計功能,使用注釋或導入的樣式表來分隔樣式聲明。 (印刷樣式在一個地方,布局樣式在另一個地方)。 在面向對象的編程中,將代碼組織為邏輯類和子類以顯示關系。
Seiso(發光) (Seiso (Shine))
The third step laid down in the 5S system is the Shine phase. This involves getting and keeping the workplace clean. This is an on-going phase that should be done frequently to polish up anything that is starting to lose its luster.
5S系統中的第三步是Shine階段。 這涉及到保持工作場所的清潔。 這是一個正在進行的階段,應該經常進行以完善任何開始失去光澤的東西。
As we go back and work on code, we can often start to get lazy and just throw things wherever and use messy coding techniques because it’s quick and dirty. The long term result of that though is unorganized code that is difficult to maintain. The phase requires a bit of discipline, we have to be willing to keep an eye out for portions of our code that are becoming a bit unwieldy and take the time to clean it up so 6 months down the road we aren’t pulling out hair trying to remember what the heck we were thinking there.
當我們回過頭來處理代碼時,我們經常會變得懶惰,隨便扔東西,然后使用凌亂的編碼技術,因為它既快速又骯臟。 但這的長期結果是難以維護的無組織代碼。 這個階段需要一些紀律,我們必須愿意留意我們的部分代碼變得有些笨拙,并花時間清理它,所以在接下來的6個月中我們不會拔頭發試圖記住我們在想什么。
清池(標準化) (Seiketsu (Standardize))
The Standardize phase involves setting down standards to ensure consistency. We can apply this to our coding and make it much easier both for us in the future, and for new employees who may have to try and work with some of the code we have developed.
標準化階段涉及制定標準以確保一致性。 我們可以將其應用到我們的編碼中,這對于我們將來以及對于可能不得不嘗試使用我們開發的某些代碼的新員工來說,都將變得更加容易。
Standardization in code can come in a variety of forms. We’ve seen some standardization in coding for-loops for example. In a for-loop it is very typical for people to use the variable i as the counter variable throughout the loop. Coders of various levels of expertise recognize the variable i in those situations very quickly and easily, because it is used so frequently.
代碼的標準化可以有多種形式。 例如,我們已經在for循環的編碼中看到了一些標準化。 在for循環中,人們通常在整個循環中都將變量i用作計數器變量。 各種專業水平的編碼人員在這種情況下都可以非??焖?#xff0c;輕松地識別變量i,因為它是如此頻繁地使用。
You can also standardize the way you format your code. Some people prefer to indent code inside of loops or functions for readability, others don’t. Whatever the case may be, be consistent with it. Having a consistent coding style makes it a lot easier to come back to that code later and be able to quickly locate where that new feature needs to be dropped in.
您也可以標準化格式化代碼的方式。 有些人喜歡在循環或函數內縮進代碼以提高可讀性,而另一些人則不喜歡。 無論是哪種情況,都應與之保持一致。 擁有一致的編碼風格可以使以后更輕松地返回到該代碼并能夠快速找到需要插入新功能的位置變得容易得多。
靜(可持續) (Shitsuke (Sustain))
Finally, our last step is to sustain the work we set down in each of the previous phases. This is perhaps the most difficult phase of all because it is never ending. There is a definite level of commitment to the process that has to be displayed here in order for us to continue using and utilizing this process when we code. We can’t be satisfied with doing this once or twice and then letting it go. If we work to continually implement this process, we help ourselves to create more manageable and efficient code from the start of the development process to the conclusion.
最后,我們的最后一步是維持我們在之前每個階段中確定的工作。 這可能是所有階段中最困難的階段,因為它永遠不會結束。 必須在此處顯示對流程的明確承諾,以便我們在編碼時繼續使用和利用此流程。 我們對執行一次或兩次然后放手不滿意。 如果我們致力于持續實施此過程,那么我們將幫助自己創建從開發過程開始到結論的更易管理和高效的代碼。
翻譯自: https://timkadlec.com/2008/04/more-manageable-efficient-code-through-5s/
小米5s服務器代碼
總結
以上是生活随笔為你收集整理的小米5s服务器代码_通过5S实现更易管理,更高效的代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: F. Fitness Baker
- 下一篇: 世界十大流行编程语言