And an interface framework design patterns

Design Patterns

What is a design pattern

  1. A design pattern is a solution to common problems that people encountered in the development proposed
  2. For example: a variety of strategies in the Art of War is actually the lessons learned for certain situations
  3. Program development design pattern is just a reference, rather than static

Common design patterns

  1. Simple factory pattern (Typical Applications: Extended to solve the problem created by a single object)
  2. Abstract Factory (Typical application: to solve a variety of different types of database access issues or business logic)
  3. Singleton (Typical application: in WEB development, shopping cart design time)

Problems encountered in the development of reality

  1. A project needs a program to print a report, but the user may use a variety of project report form, for example, some companies use Excel reports, some companies use direct design reports, some companies use Word reports, some companies may use other reporting components
  2. Project requires at least three reports module design, the project is released only need to modify the configuration to meet the reporting needs of different users

solution

  1. Because the design to system problems, consider using the report module interface design
  2. There are different manifestations of the same requirements, in line with the multi-state application conditions

Simple factory pattern

The principle is simple factory pattern

  1. Plant through the "selection" method to specify what should be created "interface object class"
  2. "Factory" is actually a method to create an object, so the object "defer the creation of"

Here Insert Picture Description

Simple factory Problems

If the user needs to update again proposed to add other new types of reports, we need to modify the code in the plant, in violation of the object-oriented "open - closed principle."

Reflected in simple factory

Reflectometry

concept

Reflex (Reflection) is .NET is an important technique, you can get a variety of information types at runtime through reflection, methods, properties, events, and constructors, etc., you can also get the name of each member and other information

Feature

The program is running, dynamically created objects, call methods, set properties, fire events, rather than at compile time to complete

Reflected Application

  1. The VS can only suggest the use of anti-compilation tool to view MSIL IL code is using reflective technology
  2. Eclipse plug-ins using the Java development tools are also reflected in technology

Development Application

  1. When the system needs to be based plug-in development, it is necessary to use reflective
  2. Simple reflection technique requires the use of plants and in the abstract factory design pattern when
  3. Have generally used in conjunction with a reflective interface
  4. Reflection technology enables the system performance somewhat reduced, unless it is necessary, or not to use too much

Interface Framework

Interface design based on three-tier architecture

Develop teamwork guarantee

  1. Project name, module name, class preparation of requirements specification, requirements comment ...
  2. Database design specifications: naming table, named entity attributes, constraints ...
  3. In the form of a collaboration project development: vertical division, parallel development.

Vertical division of labor:

  1. The division of tasks: according to its function
  2. Technical requirements: requires developers must be familiar with the project modules (DAL / BLL / UI) write
  3. Applications: small and medium sized projects, and the development team strength is relatively small
  4. More realistic: Similar to small businesses "workshop" production

Parallel development:

  1. The division of tasks: implementation of the software modules in accordance with (business logic, data access, view, general ...)
  2. Technical requirements: Law requires developers only need to master their own corresponding module technology

Here Insert Picture Description

Hardware Interface Application

Interface design and production

  1. Hardware application interfaces so that different vendors can focus on what they do best production of the product
  2. Composition of the product + = different hardware interfaces Interface Products

Task interface to control all product manufacturers to keep product is a unified interface to allow manufacturers to focus more on the quality of their products, no tangle common problems

Interface Layer

advantage:

  1. Good teamwork to solve the problem of parallel development
  2. Scalability of the system is further enhanced when adding new features point, the interface layer and the layer can easily achieve synchronization of changes, completely independent of each work independently of each other
  3. When using a larger and more suitable for project developers

Disadvantages:

  1. Workload difficult to design and develop a framework to increase
  2. It should not be used when the project is small

Interface design is based on, in addition to the other three-tier architecture architecture also can use

Use interface or not, depending on the actual needs of development teams and projects, rather than to use the interface and the introduction of interfaces

Select the frame of development

Basic framework

Small-scale projects, features a simple, personal development, shorter project cycle

Two-tier framework

Small-scale projects, slightly more functional, personal development or team development, project cycle moderate

Three-tier architecture

Large and medium-sized projects, multi-function, professional team development, long project cycle

Interface Layer

Large and medium-sized projects, many functions, professional team parallel development, long project cycle

Published 126 original articles · won praise 268 · views 20000 +

Guess you like

Origin blog.csdn.net/chonbi/article/details/104952771