xml文檔包含html代碼_為什么文檔很重要,以及為什么應將其包含在代碼中

xml文檔包含html代碼

There are a plethora of acronyms when it comes to software development. KISS, DRY, SOLID… and so on and so forth. But, when it comes to documenting or commenting your code, there is no simple catchphrase.

關于軟件開發,有很多首字母縮寫詞。 吻,干,固體……等等。 但是,在記錄或注釋代碼時,沒有簡單的流行語。

Why is that?

這是為什么?

Documentation should be as important to a developer as all other facets of development

文檔對于開發人員應該與開發的所有其他方面一樣重要

In this article, I’ll argue why documenting your code will lead to becoming a better developer, and will contribute to being a great team member.

在本文中,我將爭論為什么記錄您的代碼將導致成為更好的開發人員,并有助于成為一名出色的團隊成員。

沒有人有時間 (Ain’t nobody got time for that)

The main reason code goes undocumented is because of time.

代碼未記錄的主要原因是由于時間原因。

When developing a feature that needs to be completed within a certain time frame, rarely do we have a moment to stop everything and focus on documenting our code.

在開發需要在特定時間范圍內完成的功能時,很少有時間停止所有工作并專注于記錄我們的代碼。

Apart from designing and writing the code itself, we also need to undergo code reviews, automation tests, and add unit tests (to name a few things). Documentation is pretty much left out of the equation.

除了設計和編寫代碼本身之外,我們還需要進行代碼檢查,自動化測試和添加單元測試(僅舉幾例)。 文檔幾乎不存在。

It is the least thought about detail that can make the most difference in the future.

對細節的最少思考可以在將來發揮最大作用。

No matter what you are developing, chances are that some day you or one of your colleagues will have to revisit it. When that day comes, you will not remember so vividly what you wrote and why.

無論您正在開發什么,都有可能您或您的一位同事有一天不得不重新審視它。 當那一天到來時,您將不會非常清楚地記得自己寫的內容和原因。

And if you do remember, there may be some edge cases or specific uses which may not be clearly apparent. The obvious solution is documentation.

而且,如果您還記得,可能會出現一些不太明顯的極端情況或特定用途。 顯而易見的解決方案是文檔編制

Taking that extra time to write a proper description of what you worked on will save huge amounts of time in the future.

采取這一額外的時間來寫你的工作是什么在將節省大量的時間在未來適當的說明。

Next time someone wants to understand what happens inside your code, all you have to do is point them to the documentation. It will save time for you, since you won’t need to explain things, and it will save time for them, since they won’t be dependent on you.

下次當某人想了解您的代碼內部發生了什么時,您所要做的就是將他們指向文檔。 這將為您節省時間,因為您不需要解釋任何事情,并且會為它們節省時間,因為它們將不再依賴您。

And after all, when you, as a developer, need to understand something about a certain aspect of coding, what do you do?

畢竟,當您作為開發人員需要了解某些方面的編碼時,您會怎么做?

? You go to the documentation ?
? 你去看文檔?

好的代碼不需要文檔 (Good code does not need documentation)

Yeah, I know, I know… well written code, that is concise and well thought out, does not need to be documented. It reads like a story.

是的,我知道,我知道...編寫簡潔,經過深思熟慮的良好代碼,無需記錄在案。 它讀起來像一個故事

While that may be so, it does not forego the need for documentation, and here is why:

盡管可能是這樣,但它不會放棄對文檔的需求,這就是為什么:

  1. We are all too familiar with the robustness of code that comprises a feature. Looking at one section of code, may not make it clear there are other sections that are deeply linked to it.

    我們都非常熟悉包含功能的代碼的健壯性。 僅僅看一段代碼,可能還不清楚,還有其他部分與它緊密相關。
  2. Every service you create has a unique API to it. Writing how to use that API requires documentation that can be read outside of the code. You do not want to inflate the class itself with details about how to use the API.

    您創建的每個服務都具有唯一的API。 編寫如何使用該API的文檔需要在代碼之外閱讀。 您不想使用有關如何使用API??的詳細信息來使類本身膨脹。
  3. Coworkers who work in different departments (who may not be developers) may want to understand what you did and how it works.

    在不同部門工作的同事(可能不是開發人員)可能想了解您的工作及其工作方式。
  4. Just the act itself may cause you to look differently at the code you wrote. Explaining what your code does will cause you to assess the validity of it and to maybe consider changing things if they do not meet your expectations.

    只是行為本身可能會使您對編寫的代碼有所不同。 解釋代碼的作用會使您評估代碼的有效性,并在代碼不符合您的期望的情況下考慮進行更改。
  5. For posterity’s sake

    為了后代的緣故

如何編寫好的文檔 (How to write good documentation)

Good documentation is like a good block of code. Short, simple, and easy to understand. Here are a few guidelines you can follow:

好的文檔就像一個好的代碼塊。 簡短,簡單且易于理解。 您可以遵循以下準則:

  • Understand who the documentation is aimed at. Is it only for developers? Is there a broader audience? Understanding this will save you time, since you will know up front how much to elaborate in your explanations.

    了解文檔的目標對象。 僅適用于開發人員嗎? 是否有更廣泛的受眾? 了解這一點將節省您的時間,因為您將預先知道要解釋的內容。
  • Write a short, but descriptive background explaining the main points of what you built. This will help readers understand the purpose of the feature and ascertain its relevance to what they want to know.

    寫一個簡短但描述性的背景,解釋所構建內容的要點。 這將幫助讀者理解功能的目的,并確定其與他們想知道的內容的相關性。
  • List and describe the main perspectives of your feature, making sure to point out any dependencies that exist with other features.

    列出并描述功能的主要觀點,并確保指出其他功能存在的任何依賴關系。
  • Make sure there is a timestamp, to tell readers the validity of the documentation. Also, if you are using certain libraries, be sure to include their versions as well.

    確保有時間戳記,以告知讀者文檔的有效性。 另外,如果您使用的是某些庫,請確保也包括它們的版本。
  • Be generous with your coding examples, detailing how to properly use the feature you wrote and showcase the expected results.

    慷慨地編寫代碼示例,詳細說明如何正確使用所編寫的功能并展示預期的結果。

例子 (Examples)

To further understand how good documentation looks like, we’ll review some great examples: Mozilla’s Developer Network(MDN), Django and Stripe.

為了進一步了解優質文檔的外觀,我們將回顧一些出色的示例: Mozilla的開發人員網絡(MDN) , Django和Stripe 。

In MDN’s documentation, you can clearly see that each page starts with a brief explanation about the subject.

在MDN的文檔中,您可以清楚地看到每個頁面都以關于該主題的簡短說明開頭。

Then, it proceeds to detail the use cases and methods. Finally, it shows which browsers are compatible with the feature and gives links to relevant material.

然后,它繼續詳細說明用例和方法。 最后,它顯示了哪些瀏覽器與該功能兼容,并提供了相關資料的鏈接。

Django’s documentation is very robust. No matter your coding level, they start you off with an overview and tutorials.

Django的文檔非常強大。 無論您的編碼水平如何,他們都會以概述和教程開始。

Then, they go through each subject, detailing it meticulously, giving short and concise code snippets that demonstrate what needs to be done

然后,他們遍歷每個主題,并對其進行細致的詳細說明,并給出簡短明了的代碼段,以說明需要完成的工作

I hope I have managed to stress the importance of documentation and have given you some pointers on how to start documenting your code. If you have an idea for an acronym for documentation, feel free to do so in the comments below.

我希望我能設法強調文檔編制的重要性,并為您提供一些有關如何開始編寫代碼的指南。 如果您有一個文檔縮寫的想法,請隨時在下面的評論中進行。

Maybe KID — Keep It Documented?

也許KID - K EEP d ocumented?

If you liked this article, clap away so that others can enjoy it as well! ???

如果您喜歡這篇文章,請拍一下,以便其他人也能喜歡它! ???

翻譯自: https://www.freecodecamp.org/news/why-documentation-matters-and-why-you-should-include-it-in-your-code-41ef62dd5c2f/

xml文檔包含html代碼

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/393617.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/393617.shtml
英文地址,請注明出處:http://en.pswp.cn/news/393617.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python 版本分布式鎖

此文章,實現python 版本的分布式鎖,java版本的可以使用curator很容易實現,python版本如下在做分布式系統開發的時候,分布式鎖可以說是必需的一個組件。最近做了一些調研和嘗試,經過對比,基于ZooKeeper的分布…

JavaScript數組(2)---遍歷/迭代方法 8種

最近工作中經常涉及到數據的處理,數組尤其常見,經常需要對其進行遍歷、轉換操作,網上的文章零零散散,不得已自己又找出紅寶書來翻出來看,順便記一筆,便于以后查詢。 數組常用的方法 ECMAScript5為數組定義了…

用例設計:思維導圖orExcel

一、 某次緊急發版時使用思維導圖來進行了用例的設計,很被導圖多分支羅列、在單一分支上層層遞進設計模式的吸引,最終看到由版本主題開枝散葉衍發出的結構性用例時非常開心。從此,幾個版本的迭代都使用思維導圖進行用例設計。 然而部門制度關…

class對象和class文件_Class文件格式

我們知道Java是一門跨平臺的語言,我們編寫的Java代碼會被編譯成中間class文件以讓Java虛擬機解析運行。而Java虛擬機規范僅僅描述了抽象的Java虛擬機,在實現具體的Java虛擬機時,僅指出了設計規范。Java虛擬機的實現必須體現規范中的內容&…

2018計算機應用基礎考試6,2018結構工程師《計算機應用基礎》試題(6)

大家做好準備迎接2018考試了嗎?出國留學網為您整理了“2018結構工程師《計算機應用基礎》試題(6)”,跟著出國留學網來了解一下吧。要相信只要自己有足夠的實力,無論考什么都不會害怕!2018結構工程師《計算機應用基礎》試題(6)1、下列存儲器中&#xff0…

leetcode1282. 用戶分組(貪心算法)

有 n 位用戶參加活動,他們的 ID 從 0 到 n - 1,每位用戶都 恰好 屬于某一用戶組。給你一個長度為 n 的數組 groupSizes,其中包含每位用戶所處的用戶組的大小,請你返回用戶分組情況(存在的用戶組以及每個組中用戶的 ID&…

mysql解鎖_mysql 解鎖

show OPEN TABLES where In_use > 0;show processlist;show status like Table%;show status like %lock%;show OPEN TABLES where In_use > 0;//1.查看當前數據庫鎖表的情況SELECT * FROM information_schema.INNODB_TRX;//2.殺掉查詢結果中鎖表的trx_mysql_…

強制換行和禁止換行

強制換行:word-break: break-all; 只對英文起作用,以字母作為換行依據word-wrap: break-word; 只對英文起作用,以單詞作為換行依據white-space: pre-wrap; 只對中文起作用,強制換行禁止換行:white-space: now…

構建自己的簡單微服務架構(開源)

構建自己的簡單微服務架構(開源) 原文:構建自己的簡單微服務架構(開源)前言 本篇僅作引導,內容較多,如果閱讀不方便,可以使用電腦打開我們的文檔官網進行閱讀。如下圖所示&#…

職業生涯愿景計算機,職業生涯愿景

《職業生涯愿景》由會員分享,可在線閱讀,更多相關《職業生涯愿景(10頁珍藏版)》請在人人文庫網上搜索。1、職業生涯愿景職業生涯愿景設備安裝技術是掌握本專業必需的基本理論知識,具有設備制造、安裝、調試、管理、設計。施工方案編制的專業技…

leetcode881. 救生艇(貪心算法加雙指針)

第 i 個人的體重為 people[i],每艘船可以承載的最大重量為 limit。 每艘船最多可同時載兩人,但條件是這些人的重量之和最多為 limit。 返回載到每一個人所需的最小船數。(保證每個人都能被船載)。 示例 1: 輸入:people [1,2]…

react避免子組件渲染_如何與React一起使用正確的方法來避免一些常見的陷阱

react避免子組件渲染One thing I hear quite often is “Let’s go for Redux” in our new React app. It helps you scale, and the App data shouldn’t be in React local state because it is inefficient. Or when you call an API and while the promise is pending, th…

[轉載]Spring配置文件詳解一:

2019獨角獸企業重金招聘Python工程師標準>>> 原文地址&#xff1a;Spring配置文件詳解一&#xff1a;<context:annotation-config/>與<context:component-scan base-package"com.xx 作者&#xff1a;愛情隨遇而安 <context:annotation-config/>…

mysql 8.0.16修改root密碼_mysql 8.0.16 winx64及Linux修改root用戶密碼 的方法

連接數據庫等基礎操作請自行解決哈&#xff0c;本篇是重點記錄如何改密碼。一、查詢用戶密碼:查詢用戶密碼命令&#xff1a;select host, user, authentication_string from mysql.user ;host&#xff1a;允許用戶登錄的ip‘位置%表示可以遠程&#xff1b;user&#xff1a;當前…

舞臺設計

舞臺設計 #include<iostream> #include<cstring> #include<algorithm> #include<cmath> #include<cstdio> #include<queue> using namespace std;int ucol[1005],dcol[1005],lrow[1005],rrow[1005]; int numr[1005],numc[1005]; int a[100…

LoadRunner11支持的瀏覽器小結

LoadRunner11支持的瀏覽器小結轉載于:https://www.cnblogs.com/zwh-Seeking/articles/11060154.html

手機計算機的隱藏小技巧,漲知識!MIUI計算器原來有這么多隱藏小技巧,最后一個絕對想不到...

原標題&#xff1a;漲知識&#xff01;MIUI計算器原來有這么多隱藏小技巧&#xff0c;最后一個絕對想不到計算器除了我們需要進行日常的計算以外&#xff0c;幾乎是用不到的。但是MIUI中的計算器與普通計算器可不同&#xff0c;里面的隱藏小技巧足以讓你震驚到&#xff0c;那么…

如何使用JavaScript中的工廠函數構建可靠的對象

Discover Functional JavaScript was named one of the best new Functional Programming books by BookAuthority!“發現功能JavaScript”被BookAuthority評為最佳新功能編程書籍之一 &#xff01; I suggest to take into consideration these ideas for building reliable …

leetcode99. 恢復二叉搜索樹(優先隊列)

二叉搜索樹中的兩個節點被錯誤地交換。請在不改變其結構的情況下&#xff0c;恢復這棵樹。示例 1:輸入: [1,3,null,null,2]1/3\2輸出: [3,1,null,null,2]3/1\2代碼 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* …

Android零基礎入門第83節:Activity間數據傳遞方法匯總

2019獨角獸企業重金招聘Python工程師標準>>> 在Activity間傳遞的數據一般比較簡單&#xff0c;但是有時候實際開發中也會傳一些比較復雜的數據&#xff0c;本節一起來學習更多Activity間數據的傳遞。 一、常用數據類型 在前面幾節我們只學習了一些常用類型的數據傳遞…