{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/code-design-principles/",
  "atlas": "https://www.pystone.net/?node=code-design-principles#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/code-design-principles.md",
  "context": "https://www.pystone.net/notes/code-design-principles.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:code-design-principles",
  "slug": "code-design-principles",
  "title": "代码设计之道",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "代码设计之道",
  "contentRole": "unspecified",
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "unspecified",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "7a9280b95335cd13dc5dfa90e03f8558310b85f894493808b571d904ebe6d563",
  "assets": [
    {
      "reference": "assets/0003 - 代码设计之道__resource-001-00dd586bc683.png",
      "url": "/media/fcf3bea4f78db98bd38b.png",
      "mediaType": "image/png",
      "contentHash": "fcf3bea4f78db98bd38b1ac30c086c6222c3d8bb3aa926e44349d1af9a59feb7",
      "byteLength": 18670,
      "width": 757,
      "height": 179
    },
    {
      "reference": "assets/0003 - 代码设计之道__resource-002-8787b1d8c8d0.png",
      "url": "/media/b512441fe94db1e08570.png",
      "mediaType": "image/png",
      "contentHash": "b512441fe94db1e08570a69ef09702062762f041ea4c90f62fdafffcc07e9791",
      "byteLength": 28104,
      "width": 460,
      "height": 527
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "代码设计之道",
      "anchor": "代码设计之道",
      "citation": "https://www.pystone.net/notes/code-design-principles/#%E4%BB%A3%E7%A0%81%E8%AE%BE%E8%AE%A1%E4%B9%8B%E9%81%93"
    },
    {
      "depth": 3,
      "text": "可读性与可扩展性1",
      "anchor": "可读性与可扩展性1",
      "citation": "https://www.pystone.net/notes/code-design-principles/#%E5%8F%AF%E8%AF%BB%E6%80%A7%E4%B8%8E%E5%8F%AF%E6%89%A9%E5%B1%95%E6%80%A71"
    }
  ],
  "claims": [],
  "outgoing": [],
  "incoming": [
    {
      "id": "note:software-engineering-and-quality",
      "title": "软件工程与质量保障",
      "url": "https://www.pystone.net/notes/software-engineering-and-quality/",
      "atlas": "https://www.pystone.net/?node=software-engineering-and-quality#knowledge-atlas",
      "label": "软件工程与质量保障",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "软件体系结构与设计模式中的“代码设计之道”导航项",
      "citation": "https://www.pystone.net/notes/software-engineering-and-quality/#%E8%BD%AF%E4%BB%B6%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84%E4%B8%8E%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F"
    }
  ],
  "contentMarkdown": "# 代码设计之道\n\n﻿# 代码设计之道\n\n> 创建时间：2021/11/3 17:54\n\n* 可读性与可扩展性1\n\n### 可读性与可扩展性1\n\n![](assets/0003 - 代码设计之道__resource-001-00dd586bc683.png)\n\n实际上是从Assembly加载同一个类的三个Method。\n\n这三行获取的东西是一样的，用同一个字段来表示。\n\n另外不建议用 GetTypes()[2]。\n如果以后加了某些类，或者其他原因，导致类的排列顺序变了，这个2获取到的就不对了\n而且 获取第2个Type，从代码可读性角度上也不合适，阅读代码的人不知道第二个type是什么。\n\n从设计原则上讲，代码的可扩展性要高，如果未来代码改变，之前代码的变动要尽可能少，否则会有隐患。而且这个问题是很难查的\n\n![](assets/0003 - 代码设计之道__resource-002-8787b1d8c8d0.png)\n"
}
