规范3

Jun 13, 2016 am 10:23 AM
콘텐츠 기능 포함하다 오른쪽 문서 ~의 목차 사양 필요

目录文档 所有的目录下都需要具有README文档,其中包括: 该目录的功能及其包含内容 一个对每一文件的在线说明(带有link),每一个说明通常还应该提取文件标头的一些属性名字。 包括设置、使用说明 指导人民如何连接相关资源: 源文件索引 在线文档 纸文档 设计文档 其他对读者有帮助的东西 考虑一下,当每个原有的工程人员走了,在6个月之内来的一个新人,那个孤独受惊吓的探险者通过整个 工程的源代码目录树,阅读说明文件,源文件的标头说明等等做为地图,他应该有能力穿越整个工程。 -------------------------------------------------------------------------------- Use a Design Notation and Process Programmers need to have a common language for talking about coding, designs, and the software process in general. This is critical to project success. Any project brings together people of widely varying skills, knowledge, and experience. Even if everyone on a project is a genius you will still fail because people will endlessly talk past each other because there is no common language and processes binding the project together. All youll get is massive fights, burnout, and little progress. If you send your group to training they may not come back seasoned experts but at least your group will all be on the same page; a team. There are many popular methodologies out there. The point is to do some research, pick a method, train your people on it, and use it. Take a look at the top of this page for links to various methodologies. You may find the CRC (class responsibility cards) approach to teasing out a design useful. Many others have. It is an informal approach encouraging team cooperation and focusing on objects doing things rather than objects having attributes. Theres even a whole book on it: Using CRC Cards by Nancy M. Wilkinson. -------------------------------------------------------------------------------- Using Use Cases A use case is a generic description of an entire transaction involving several objects. A use case can also describe the behaviour of a set of objects, such as an organization. A use case model thus presents a collection of use cases and is typically used to specify the behavior of a whole application system together with one or more external actors that interact with the system. An individual use case may have a name (although it is typically not a simple name). Its meaning is often written as an informal text description of the external actors and the sequences of events between objects that make up the transaction. Use cases can include other use cases as part of their behaviour. Requirements Capture Use cases attempt to capture the requirements for a system in an understandable form. The idea is by running through a set of use case we can verify that the system is doing what it should be doing. Have as many use cases as needed to describe what a system needs to accomplish. The Process Start by understanding the system you are trying to build. Create a set of use cases describing how the system is to be used by all its different audiences. Create a class and object model for the system. Run through all the use cases to make sure your model can handle all the cases. Update your model and create new use cases as necessary. -------------------------------------------------------------------------------- Open/Closed Principle The Open/Closed principle states a class must be open and closed where: open means a class has the ability to be extended. closed means a class is closed for modifications other than extension. The idea is once a class has been approved for use having gone through code reviews, unit tests, and other qualifying procedures, you dont want to change the class very much, just extend it. The Open/Closed principle is a pitch for stability. A system is extended by adding new code not by changing already working code. Programmers often dont feel comfortable changing old code because it works! This principle just gives you an academic sounding justification for your fears :-) In practice the Open/Closed principle simply means making good use of our old friends abstraction and polymorphism. Abstraction to factor out common processes and ideas. Inheritance to create an interface that must be adhered to by derived classes. -------------------------------------------------------------------------------- Design by Contract The idea of design by contract is strongly related to LSP . A contract is a formal statement of what to expect from another party. In this case the contract is between pieces of code. An object and/or method states that it does X and you are supposed to believe it. For example, when you ask an object for its volume thats what you should get. And because volume is a verifiable attribute of a thing you could run a series of checks to verify volume is correct, that is, it satisfies its contract. The contract is enforced in languages like Eiffel by pre and post condition statements that are actually part of the language. In other languages a bit of faith is needed. Design by contract when coupled with language based verification mechanisms is a very powerful idea. It makes programming more like assembling specd parts. -------------------------------------------------------------------------------- 其他杂项 这一部分包含着各种各样的该做的和不该做的。 在需要用到离散的数值使,不要使用浮点数变量。采用浮点数来做循环计数器无异于向自己的脚 开枪。测试浮点数时总要使用 ,永远不要用 = 或 => 。 不要使用程序自动美化器,得益于好的程序样式的主要的人就是程序员自己,特别是刚开着手代 码、算法设计的程序员,使用程序自动美化器仅仅能根据语法来更正程序,因此当对空白和缩进 的注意有很大需要时,它是不可能做到的。正常的细心注意细节的程序员们能很好的用清晰直观 的样式来完成一个函数或文件(换句话来说,一些直观的样式是意向的规定而不是程序自动美化 器能读懂的智慧)。马虎的程序员应该学习细致的程序员,不要依赖程序自动美化器来增加程序 的可读性。最初的美化器是必须分析源代码的程序,复杂的美化器不值得通过这样获得好处,美 化器最好用于生成总的机器建立(machine-generated)格式代码。 对逻辑表达式第二个 = 不小心的忽略是一个问题,以下显得混乱而且更像是错误: if ($abool= $bbool) { ... } 程序员在这里真的是要赋值么?一般常常是,但通常又不是这样。这样避免引起这样的混乱呢?解 决方案就是不要这样做,利用显式和隐式的判断测试,推荐的方法是在做测试前先做赋值: $abool= $bbool; if ($abool) { ... } -------------------------------------------------------------------------------- 使用if (0)来注释外部代码块 有时需要注释大段的测试代码,最简单的方法就是使用if (0)块: function example() { great looking code if (0) { lots of code } more code } 你不能使用/**/,因为注释内部不能包含注释,而大段的程序中可以包含注释,不是么? -------------------------------------------------------------------------------- Different Accessor Styles Why Accessors? Access methods provide access to the physical or logical attributes of an object. We disallow direct access to attributes to break dependencies, the reason we do most things. Directly accessing an attribute exposes implementation details about the object. To see why ask yourself: What if the object decided to provide the attribute in a way other than physical containment? What if it had to do a database lookup for the attribute? What if a different object now contained the attribute? If any of the above changed code would break. An object makes a contract with the user to provide access to a particular attribute; it should not promise how it gets those attributes. Accessing a physical attribute makes such a promise. Implementing Accessors There are three major idioms for creating accessors. Get/Set class X { function GetAge() { return $this->mAge; } function SetAge($age) { $mAge= $age; } var $mAge; } One Method Name class X { function Age() { return $mAge; } function Age($age) { $mAge= $age; } var $mAge; } Similar to Get/Set but cleaner. Use this approach when not using the Attributes as Objects approach. Attributes as Objects class X { function Age() { return $mAge; } function rAge() { return &$mAge; } function Name() { return mName; } function rN

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. 크로스 플레이가 있습니까?
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

vivox100s와 x100의 차이점: 성능 비교 및 ​​기능 분석 vivox100s와 x100의 차이점: 성능 비교 및 ​​기능 분석 Mar 23, 2024 pm 10:27 PM

vivox100s와 x100 휴대폰은 모두 in vivo 휴대폰 제품군의 대표적인 모델입니다. 두 휴대폰은 각각 서로 다른 시대의 vivo 첨단 기술 수준을 대표하므로 디자인, 성능, 기능 면에서 일정한 차이가 있습니다. 이번 글에서는 소비자들이 자신에게 꼭 맞는 휴대폰을 선택할 수 있도록 두 휴대폰을 성능비교와 기능분석 측면에서 자세히 비교해보겠습니다. 먼저 vivox100s와 x100의 성능 비교를 살펴보겠습니다. vivox100s에는 최신 기술이 탑재되어 있습니다.

셀프미디어란 정확히 무엇인가? 주요 특징과 기능은 무엇입니까? 셀프미디어란 정확히 무엇인가? 주요 특징과 기능은 무엇입니까? Mar 21, 2024 pm 08:21 PM

인터넷의 급속한 발전으로 셀프미디어라는 개념은 사람들의 마음속에 깊이 뿌리내렸습니다. 그렇다면 셀프미디어란 정확히 무엇인가? 주요 특징과 기능은 무엇입니까? 다음에는 이러한 문제를 하나씩 살펴보겠습니다. 1. 셀프미디어란 정확히 무엇인가? We-media는 이름에서 알 수 있듯이 당신이 미디어라는 뜻입니다. 개인이나 팀이 인터넷 플랫폼을 통해 콘텐츠를 독립적으로 생성, 편집, 출판 및 전파할 수 있는 정보 매체를 말합니다. 신문, 텔레비전, 라디오 등과 같은 전통적인 미디어와 달리 셀프 미디어는 더욱 상호작용적이고 개인화되어 있어 모든 사람이 정보의 생산자이자 전파자가 될 수 있습니다. 2. 셀프미디어의 주요 특징과 기능은 무엇입니까? 1. 낮은 문턱: 셀프미디어의 등장으로 미디어 산업에 진출하기 위한 문턱이 낮아졌습니다. 더 이상 번거로운 장비와 전문팀이 필요하지 않습니다.

Xiaohongshu 계정 관리 소프트웨어의 기능은 무엇입니까? Xiaohongshu 계정을 운영하는 방법은 무엇입니까? Xiaohongshu 계정 관리 소프트웨어의 기능은 무엇입니까? Xiaohongshu 계정을 운영하는 방법은 무엇입니까? Mar 21, 2024 pm 04:16 PM

Xiaohongshu가 젊은이들 사이에서 인기를 끌면서 점점 더 많은 사람들이 이 플랫폼을 사용하여 자신의 경험과 인생 통찰력의 다양한 측면을 공유하기 시작했습니다. 여러 Xiaohongshu 계정을 효과적으로 관리하는 방법이 중요한 문제가 되었습니다. 이 글에서는 Xiaohongshu 계정 관리 소프트웨어의 일부 기능에 대해 논의하고 Xiaohongshu 계정을 더 잘 관리하는 방법을 살펴보겠습니다. 소셜 미디어가 성장함에 따라 많은 사람들이 여러 소셜 계정을 관리해야 한다는 사실을 깨닫게 되었습니다. 이는 Xiaohongshu 사용자에게도 어려운 과제입니다. 일부 Xiaohongshu 계정 관리 소프트웨어는 자동 콘텐츠 게시, 예약 게시, 데이터 분석 및 기타 기능을 포함하여 사용자가 여러 계정을 보다 쉽게 ​​관리할 수 있도록 도와줍니다. 이러한 도구를 통해 사용자는 자신의 계정을 보다 효율적으로 관리하고 계정 노출과 관심을 높일 수 있습니다. 또한 Xiaohongshu 계정 관리 소프트웨어에는

Word 문서 작업에 대한 자세한 설명: 두 페이지를 하나로 병합 Word 문서 작업에 대한 자세한 설명: 두 페이지를 하나로 병합 Mar 26, 2024 am 08:18 AM

Word 문서는 일상 업무와 학습에서 가장 자주 사용되는 응용 프로그램 중 하나입니다. 문서 작업을 하다 보면 두 페이지를 하나로 병합해야 하는 상황이 가끔 발생할 수 있습니다. 이 기사에서는 독자가 문서 레이아웃을 보다 효율적으로 처리할 수 있도록 Word 문서에서 두 페이지를 한 페이지로 병합하는 방법을 자세히 소개합니다. Word 문서에서 두 페이지를 하나로 병합하는 작업은 일반적으로 용지 비용과 인쇄 비용을 절약하거나 문서를 더 간결하고 깔끔하게 만들기 위해 사용됩니다. 다음은 두 페이지를 하나로 병합하는 구체적인 단계입니다. 1단계: 작동해야 하는 단어를 엽니다.

PHP는 어떤 용도로 사용되나요? PHP의 역할과 기능 살펴보기 PHP는 어떤 용도로 사용되나요? PHP의 역할과 기능 살펴보기 Mar 24, 2024 am 11:39 AM

PHP는 웹 개발에 널리 사용되는 서버 측 스크립팅 언어입니다. 주요 기능은 HTML과 결합하면 풍부하고 다채로운 웹 페이지를 생성할 수 있습니다. PHP는 강력하며 다양한 데이터베이스 작업, 파일 작업, 양식 처리 및 기타 작업을 수행하여 웹 사이트에 강력한 상호 작용과 기능을 제공합니다. 다음 기사에서는 자세한 코드 예제를 통해 PHP의 역할과 기능을 자세히 살펴보겠습니다. 먼저, PHP의 일반적인 용도를 살펴보겠습니다: 동적 웹 페이지 생성: P

WeChat에서 카탈로그를 읽는 방법 카탈로그를 보는 방법 WeChat에서 카탈로그를 읽는 방법 카탈로그를 보는 방법 Mar 30, 2024 pm 05:56 PM

WeChat 독서 앱의 모바일 버전은 매우 좋은 독서 소프트웨어입니다. 이 소프트웨어는 원클릭 검색으로 언제 어디서나 읽을 수 있으며 모두 공식적으로 승인된 다양한 유형의 책입니다. 책이 가지런히 정리되어 있어 편안하고 여유로운 독서 분위기를 즐기실 수 있습니다. 다양한 시나리오의 읽기 모드를 전환하고, 최신 도서 장을 매일 지속적으로 업데이트하고, 여러 장치에서 온라인 로그인을 지원하고, 인터넷 유무에 관계없이 책장에 일괄 다운로드하여 모든 사람이 더 많은 지식을 발견할 수 있습니다. 이제 편집자가 온라인으로 자세히 설명합니다. WeChat 독서 파트너에게 카탈로그를 보는 방법을 홍보하십시오. 1. 카탈로그를 보고 싶은 책을 열고 책 중앙을 클릭하세요. 2. 왼쪽 하단에 있는 세 줄 아이콘을 클릭하세요. 3. 팝업창에서 도서 카탈로그를 확인하세요.

VSCode 이해: 이 도구는 어떤 용도로 사용됩니까? VSCode 이해: 이 도구는 어떤 용도로 사용됩니까? Mar 25, 2024 pm 03:06 PM

"VSCode 이해: 이 도구는 어떤 용도로 사용됩니까?" 》프로그래머로서 초보자이든 숙련된 개발자이든 코드 편집 도구를 사용하지 않으면 할 수 없습니다. 많은 편집 도구 중에서 Visual Studio Code(약칭 VSCode)는 가볍고 강력한 오픈 소스 코드 편집기로 개발자들 사이에서 매우 인기가 높습니다. 그렇다면 VSCode는 정확히 어떤 용도로 사용되나요? 이 기사에서는 VSCode의 기능과 사용법을 자세히 살펴보고 독자에게 도움이 되는 구체적인 코드 예제를 제공합니다.

GateToken(GT) 화폐란 무엇인가요? GT 코인 기능 및 토큰 경제 소개 GateToken(GT) 화폐란 무엇인가요? GT 코인 기능 및 토큰 경제 소개 Jul 15, 2024 pm 04:36 PM

GateToken(GT) 화폐란 무엇인가요? GT(GateToken)는 GateChain 체인의 기본 자산이자 Gate.io의 공식 플랫폼 통화입니다. GT 코인의 가치는 Gate.io 및 GateChain 생태계의 발전과 밀접한 관련이 있습니다. GateChain이란 무엇입니까? GateChain은 2018년에 탄생했으며 Gate.io가 출시한 차세대 고성능 퍼블릭 체인입니다. GateChain은 사용자의 온체인 자산의 보안을 보호하고 편리한 분산 거래 서비스를 제공하는 데 중점을 두고 있습니다. GateChain의 목표는 기업 수준의 안전하고 효율적인 분산형 디지털 자산 저장, 유통 및 거래 생태계를 구축하는 것입니다. 게이트체인에는 원본이 있습니다.

See all articles