Limboy

软件构建设计

这是《代码大全 2》的软件设计篇章,花了两天时间啃下来的,不得不感慨讲得很细致很到位。

Key Design Concepts

Managing complexity is the most important technical topic in software development.

The goal of all software-design techniques is to break acomplicated problem into simple pieces. The more independent the subsystems are, the more you make it safe to focus on one bit of complexity at a time.

design characteristics

The steps in designing with objects

Form Consistent Abstractions

Abstraction is the ability to engage with a concept while safely ignoring some of its details - handling different details at different levels.

A good class interface is an abstraction that allows you to focus on the interface without needing to worry about the internal workings of the class.

Design Building Blocks: Heuristics

Encapsulate Implementation Details

Encapsulate picks up where abstraction leaves off. you aren’t allowed to look at an object at any level of detail.

Inherit - When Inheritance Simplifies the Design

Inheritance simplifies programming because you write a general routine to handle anything that depends on a door’s general properties and then write specific routines to handle specific operations on specific kinds of doors.

Hide Secrets (Information Hiding)

Information hiding is part of the foundation of both structured design and object-oriented design. In structured design, the notion of “black boxes” comes from information hiding. In object-oriented design, it gives rise to the concepts of encapsulation and modularity and it is associated with the concept of abstraction.

One key task in designing a class is deciding which features should be known outside the class and which should remain secret.

Identify Areas Likey to Change

Accommodating changes is one of the most chanllenging aspects of good program design. The goal is to isolate unstable areas so that the effect of a change will be limited to one routine, class, or package.

areas that are likely to change:

Keep Coupling Loose

Coupling describes how tightly a class or routing is related to other classes or routines. The goal is to create classes and routines with small, direct, visible and flexible relations to other classes and routines.

Classes and routines are first and foremost intellectual tools for reducing complexity. If they’re not making your job simpler, they’re not doing thier jobs.

Look for Common Design Patterns

Popular Design Patterns

Design Practices

Iterate

Design is an iterative process. You don’t usually go from point A only to point B; you go from point A to point B and back to point A.

Divide and Conquer

no one’s skill is big enough to contain all the details of a complex program, and that applies just as well to design. Divide the program into different areas of concern, and then tackle each of those area individually.

Top-Down and Bottom-Up Design Approaches

Top-down design begins at a high level of abstraction. You define base classes or other nonspecific design elements. As you develop the design, you increase the level of detail, identifying derived classes, collaborating classes, and other detailed design elements.

Bottom-up design starts with specifics and works toward genealities. It typically begins by identifying concrete objects and then generalizes aggregations of objects and base classes from those specifics.

Experimental Prototyping

Collaborative Design

Capturing Your Design Work