can also provide powerful capabilities for searching and integrating traditional SQL and XML data.
Sample Database
The query in this article will access the sample database created in "DB2 Viper Quick Start" (developerWorks, November April 2006. Here we will briefly review the definitions of the "items" and "clients" tables in the sample database:Listing 1. Table Definition
create table items (id int primary key not null, brandname varchar(30), itemname varchar(30), sku int,
to ensure that the entity has only one reason for its change.Example 2:
Rectangle has two methods. One is draw, which is used to draw a graph, and the other is area, which is used to calculate the area. Rectangle violates the single responsibility principle because it has two responsibilities: Calculating Area and drawing Rectangle. Drawing a graphic is related to the user interface, but the calculation of the graphic area is not necessarily related to the interface. If you write these two resp
sort, otherwise you will be more embarrassed oh.
12. When deleting data from the database, be aware that cascading operations avoid dirty data that will never be erased.
13. About formal parameter arguments: When the function is called, the argument is the value of the basic type, that is, the value is passed, and the argument passes the reference to the object, that is, the address.
In the ListView, the SetSelection function does not work when the data is not full, and the ListView and t
interface. This means that although specific actions are different for different objects, they can be called in the same way through a common class.Five basic Principlessingle principle of responsibility SRP (single Responsibility Principle)Refers to the function of a class to be single, not all-encompassing. Like a person, the distribution of work can not be too much, otherwise busy all the way, but the efficiency is not high up.Open Closure Princip
"See" http://www.cnblogs.com/jiangzhengjun/p/4260969.htmlSingle responsibility principle (SRP)--the definition of cohesionThe definition of a single responsibility principle: For a class page, there should be only one reason for it to vary (there should never be more than one reason for a class to change).A single responsibility principle requires that an interface or class have only one cause to change, that is, an interface or class has only one res
relationship. Replace inheritance with dependencies, aggregations, combinations, and so on. The Richter substitution principle can be used to detect whether two classes have a parent-child relationship.7 Common Object-oriented design principlesDesign Principle NameDefinedFrequency of UseSingle principle of responsibility(Single Responsibility Principle, SRP)A class is responsible only for the corresponding responsibilities in a functional area★★★★☆Op
I. Overview of object-oriented principlesThe general context of the seven main principles: Two. The commonly used object-oriented design principles include 7, which are not isolated and interdependent and complementary to one another..Three. The following detailed analysis:(i) Single principle of responsibility (Responsibility Principle, SRP)1, definition: An object should contain only a single responsibility, and the responsibility is completely enc
Low -level architecture: relationships between ClassesCombination, inheritance, dependency, aggregation.High-level architecture: Design PatternsComplex design patterns evolve with simple design patterns, solving problems that can not be solved by simple design patterns in more complex scenarios.Design principles: (through design patterns to achieve design principles)Single Responsibility principle (SRP), the concept of understanding a single from the
same way through a common class.These three characteristics are also the basis for understanding the five principles of object-oriented design.The Five principles of object-oriented design ( These five principles are also the basis of 23 design patterns) Single Duty principle SRP (Responsibility Principle)Refers to the function of a class to be single, not all-encompassing. Like a person, the distribution of work can not be too much, otherwise bus
The five Principles of object-oriented, also known as the S.O.L.I.D principle:S (SRP, single reponsibility Principle): Sole responsibility principle, a class should have and only one responsibility (or only one causes it to change)O (OCP, Open/close Principle): Open for expansion, closed for modification.L (LSP, Liskov Substitution Principle): Lee substitution, subclasses should be able to replace the parent class anywhere without causing any errors;I
Single Responsibility principle (SRP): In the case of a class, there should be only one cause for it to change. If a class takes on too much responsibility, it is tantamount to coupling these responsibilities, and a change in responsibility may be less likely to inhibit the ability of the class to perform other duties. This coupling is a fragile design, and when changed, the design can cause unexpected damage. Software design really has to do a l
, a variable no, and so on, using some JavaScript code analysis tool, can be very good to help us check some common problems.HTML refers to JavaScript or CSS files: for example, we need to use Bower to refer to the front-end JavaScript and CSS third-party libraries, if the version upgrade, add Remove and so on by hand to modify the HTML, first more time-consuming, the second more easily overlooked, Especially when we need to switch between debug and production versions, there will be a lot of ex
critics accuse XP of ignoring the design is incorrect. In fact, the simple design practice of XP is not to ignore the design, and think that the design should not be done one time before coding, because it can only be based on "the situation will not change" or "we can foresee all the changes" on the basis of lies.The simple design of Kent Beck concept is this:
Able to pass all the test procedures.
No duplicate code is included.
Clearly shows all the intentions given to the pro
decomposing the system into modules: The object is the module. It is a module that combines the data structure and the methods of manipulating these data together.2. AbstractObject-oriented methods not only support process abstraction, but also support data abstraction.3. Information hidingIn the object-oriented method, information hiding is realized by the encapsulation of the object.4. Low couplingIn object-oriented methods, the object is the most basic module, so the coupling mainly refers t
need to introduce the appropriate namespace2. Class Library Methods :a DLL file , which is a class libraryIt creates a new class library, writes classes and corresponding methods in it, generates a DLL file, takes it, and puts it in its ownProgram folder, right-click on the project → add reference → find this DLL class library file add, and then reference the namespace , you can call the corresponding method in the classNote Class must be public access rightsThe use of class libraries is the wa
1. Single Responsibility rule (SRP): there is only one reason for the change of class.2. Dependency inversion Rule (DIP):
High-level modules should not rely on the underlying modules, both with dependent interfaces;
Interface does not depend on details;
The details depend on the Interface.
3. Interface Isolation rules: dependencies between classes should be based on a minimum number of Interfaces.4, the Richter replacement rule: so the r
Single responsibility principle (SRP)The single Responsibility PrincipleA classic illustration of a foreigner's reference:The single principle of responsibility requires that "a class can have only one duty", and the only reason for this kind of change is that responsibility. When a class has multiple responsibilities, it should separate the other responsibilities and create classes to complete.For example:The class modem realizes the function of mode
Inheritance is a form of abstraction, and if a subclass throws out an exception that is more abstract than the parent class, it is equivalent to showing more attributes than the parent class , which is incompatible with the design principle of inheritance.The five principles of OO meanSRP (a Class A duty, a method to do only one thing),OCP (open for expansion, closed for modification),LSP (where the parent class appears, you can use subclass overrides),DIP (Dependency abstraction, interface-orie
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacesingleresponsibilityprinciple{//Single-accusation principle (Responsibility Principle) SRP//There should never is more than one reason for a class-to-change. //There is only one reason for the class to change. classProgram {//Usage Scenarios Static voidMain (string[] args) { //A single function applies to interfaces, classes, methods. //let's start by looking a
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.