Presentation is loading. Please wait.

Presentation is loading. Please wait.

By Justin Hendrix. Design Challenges Design is the activity that links requirements to coding and debugging. Good design is useful on small project and.

Similar presentations


Presentation on theme: "By Justin Hendrix. Design Challenges Design is the activity that links requirements to coding and debugging. Good design is useful on small project and."— Presentation transcript:

1 By Justin Hendrix

2 Design Challenges Design is the activity that links requirements to coding and debugging. Good design is useful on small project and indispensable o large ones. A “Wicked” problem is one that could be clearly defined only by solving it. Design is a Sloppy Process Design is About Tradeoffs and Priorities Design Involves Restrictions Design is Nondeterministic (Forever) Design is a Heuristic Process Design is Emergent (Evolve)

3 Key Design Concepts Good design depends on understanding a handful of key concepts. Desirable Characteristics of Design Minimal complexity Ease of maintenance Loose coupling Extensibility Reusability High fan-in (make good use of utility classes) Low-to-medium fan-out (class use low-to-medium number of other classes) Portability Leanness Stratification Standard techniques

4 Key Design Concepts Levels of Design Software System Division into subsystems/packages Division into classes within packages Division into data and routines within classes Internal routine design

5 Design Building Blocks: Heuristics Find Real-World Objects Identify the objects and their attributes Determine what can be done to each object. Determine what each object is allowed to do to other objects. Determine the parts of each object that will be visible to other objects—which parts will be public and which will be private Define each object’s public interface. Abstraction – Referring to an object and not its parts Inherit – When inheritance Simplifies the Design

6 Design Building Blocks: Heuristics Hide Secrets (Information Hiding) Two Categories of Secrets Hiding complexity so that your brain doesn't have to deal with it unless you’re specifically concerned with it Hiding sources of change so that when change occurs, the effects are localized Barriers to Information Hiding Excessive distribution of information Circular dependencies Class data mistaken for global data Perceived performance penalties Value of Information Hiding It adds to the quality of the object-oriented code.

7 Design Building Blocks: Heuristics Identify Areas Likely to Change Business rules Hardware dependencies Input and output Nonstandard language features Difficult design and construction areas Status variables Other heuristics Aim for Strong Cohesion Build Hierarchies Formalize Class Contracts Assign Responsibilities Design for Test Avoid Failure Choose Binding Time Consciously Make Central Points of Control Consider Using Brute Force Draw a Diagram Keep you Design Modular

8 Design Practices Design Practice – steps you can take that often produce good results. Iterate Design is an iterative process. You don’t’t usally go from point A only to point B; you go from point A to point B and back to point A. Divide and Conquer Top-Down and Bottom-Up Design Approaches Experimental Prototyping Collaborative Design How Much Design is Enough?

9 Layout and Style The Fundamental Theorem of Formatting says that good visual layout shows the logical structure of the program. Making the code look pretty is worth something, but it’s worth less than showing the code’s structure. Details of a specific method of structuring a program are much less important that the fact that the program is structured consistently.

10 Layout and Style Objectives of Good Layout Accurately represent the logical structure of the code Consistently represent the logical structure of the code Improve readability Withstand modifications White Space Grouping Blank lines Indentation

11 Layout Styles Pure Blocks – { | } or if | end if !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! Endline Layout !!!!!! (!!!!!!!!!!!!!!!!!!!!!!!!) !!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! Rare VB style If ( soldCount > 1000 ) Then mardown =.10 profit =.05 Else markdown =.05 End If

12 Control-Structure Blocks If ( expression ) One-statement; If (expression ) { One-statement; } If (expression ) { One-statement; } If (expression ) one-statement;

13 Control-Structure Blocks If (((‘0’ <= inChar) && (inChar <= ‘9’)) || ((‘a’ <= inChar) && (inChar <= ‘z’)) || ((‘A’ <= inChar) && (inChar <=‘Z’))) If ( ( ( ‘0’ <= inChar ) && ( inChar <= ‘9’ ) ) || ( ( ‘a’ <= inChar ) && ( inChar <= ‘z’ ) ) || ( ( ‘A’ <= inChar ) && ( inChar <=‘Z’ ) ) ) Avoid GoTo’s

14 Laying Out Individual Statements Statement Length – Lines longer that 80 character are hard to read. Using Spaces for Clarity While(pathName[startPaht+postion]<>’;’) Use only one statement per line – Avoid multi statement lines. Data Declarations Group the declarations with others of its kind. If reasonable, separate all declarations on their own lines. Declare variable close to where they’re first used. Pointers -> (EmployeeList *employees;)

15 Laying Out Comments

16 Laying Out Routines Public void InsertionSort( SortArray data, Int firstElement, Int lastElemnt )


Download ppt "By Justin Hendrix. Design Challenges Design is the activity that links requirements to coding and debugging. Good design is useful on small project and."

Similar presentations


Ads by Google