Specification 3_php Tutorial

Source: Internet
Author: User
Directory documents all directories need to have a Readme document, which includes: The directory's functionality and its contents a description of each file (with link), each of which usually should also extract some property names for the header of the file. Includes settings, instructions for how people connect to related resources: source file Index online document paper document design document other things that help readers think about it, when each of the original engineers went away, a newcomer who came within 6 months, the lone frightened explorer through the entire project's source code tree, Read the documentation, the source file header description and so on as the map, he should have the ability to cross the whole project. --------------------------------------------------------------------------------use a Design Notation and Process Programmers need to has a common language for talking on 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 are a genius you'll still fail because people would endlessly talk past each other because T This 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 could not come back seasoned experts but at least your group'll all is on the same Page A team. There is MANY Popular methodologies out there. The point was to does some, 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 could find the CRC (class responsibility cards) approach to teasing out a design useful. Many others has. It is a informal approach encouraging team cooperation and focusing on objects doing things rather than objects have at Tributes. Theres even a whole book on it:using CRC Cards by Nancy M. Wilkinson. --------------------------------------------------------------------------------Using Use Cases 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 are typically used to specify the behavior of a whole applicat Ion system together with one or more external actors this interact with the system. An individualUse case may has a name (although it is typically not a simple name). Its meaning are often written as an informal text description of the external actors and the sequences of events between OB Jects the transaction. Use cases can include the other, cases as part of their behaviour. Requirements Capture use cases attempt to capture the Requirements for a system under an understandable form. The idea was by running through a set of use case we can verify that the system is doing what it should be doing. has as many use cases as needed-describe what a system needs to accomplish. The Process Start by understanding the system is trying to build. Create a set of use cases describing how the system was to be used by all its different audiences. Create a class and object model for the system. Run through all, 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 have the ability to be extended. Closed means a class is closed to modifications other than extension. The idea is once a class have been approved for use have gone through code reviews, unit tests, and other qualifying proc Edures, 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 does by changing already working code. Programmers often dont feel comfortable changing old code because it works! This principle just gives a 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 a interface that must is adhered to by derived classes. --------------------------------------------------------------------------------design by contract the idea of design by contract is strongly rel Ated to LSP. A contract is a formal statement of the expect from the another party. The contract is between pieces of code. An object and/or method states the It does X and you is supposed to believe it. For example, when your ask an object is volume thats what do you should get. And because volume is a verifiable attribute of a thing all could run a series of checks to verify volume are correct, that is, it satisfies it contract. The contract is enforced in languages like Eiffel by pre and post condition statements that was actually part of the Langu Age. In and languages a bit of faith is needed. Design by contract when coupled with language based verification mechanisms are a very powerful idea. It makes programming more like assembling SPECD parts. --------------------------------------------------------------------------------other miscellaneous This part contains a variety ofWhat to do and what not to do. Do not use floating-point variables when you need to use discrete values. Using floating-point numbers to do a loop counter is tantamount to shooting at your own feet. Always use <= or = = When testing floating point numbers, never use = or = =. Do not use the program auto-beautification, the main person that benefits from the good program style is the programmer himself, especially the programmer who just opened the code, algorithmic design, using the program auto-beautification can only correct the program according to the syntax, so when the attention to whitespace and indentation has great need, it is impossible to do. The normal attention to detail of the program can be very good with a clear and intuitive style to complete a function or file (in other words, some of the intuitive style is the intent of the rules rather than the application of automatic beautification can read the wisdom). Sloppy programmers should learn meticulous programmers and do not rely on program auto-beautification to increase the readability of the program. The original beautification is the program that must analyze the source code, the complex beautification is not worth the benefit by this way, the beautification device is best used to generate the total machine build (machine-generated) format code. The second = careless ignoring of logical expressions is a problem, and the following is confusing and more like an error: if ($abool = $bbool) {...} Does the programmer really want to assign a value here? Often, but not usually. To avoid causing such confusion? The solution is not to do this, using explicit and implicit judgment tests, the recommended method is to do the assignment before doing the test: $abool = $bbool; if ($abool) {...}--------------------------------------------------------------------------------use if (0) to annotate external code blocks Sometimes it is necessary to annotate a large section of the test code, the simplest way is to use if (0) Block: function Example () {Great looking code if (0) {Lots of code} more code} You cannot use/**/because the note The internal cannot contain comments, and large segments of the program can contain comments, right? --------------------------------------------------------------------------------Different Accessor Styles why Accessors? Access methods provide access to the PhysicaL or logical attributes of an object. We disallow direct access to attributes-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-to-do other than physical containment? What if is it had to does a database lookup for the attribute? What if a different object now contained the attribute? If any of the above changed code would. 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 is 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/setBut cleaner. The use of this approach is 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

http://www.bkjia.com/PHPjc/532253.html www.bkjia.com true http://www.bkjia.com/PHPjc/532253.html techarticle Directory documents all directories need to have a Readme document, which includes: The directory's functionality and its contents a description of each file (with link), each of the online instructions ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.