Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Foundations of Software Design Fall 2002 Marti Hearst Guest Lecture: Good Programming Practices Marat Boshernitsan Computer Science Division, EECS University.

Similar presentations


Presentation on theme: "1 Foundations of Software Design Fall 2002 Marti Hearst Guest Lecture: Good Programming Practices Marat Boshernitsan Computer Science Division, EECS University."— Presentation transcript:

1 1 Foundations of Software Design Fall 2002 Marti Hearst Guest Lecture: Good Programming Practices Marat Boshernitsan Computer Science Division, EECS University of California, Berkeley

2 2 What’s So Hard About Programming? Knowing where to begin and what to do next –What to do when stuck and how to get “unstuck” –How to fix it when it doesn’t work Knowing your tools –Programming language(s) –Compilers, IDEs, etc. Understanding the run-time environment Understanding other people’s programs Understanding customer’s requirements

3 3 Programming As a Craft Any craftsperson must understand: –Their tools –The needs of their customers –The professional procedures for meeting those needs Is programming any different? How does one become a master craftsperson?

4 4 Example: Building Houses 1.Understand the requirements (number of floors, number of rooms, architectural preferences, etc.) 2.Design the house How is it different from other houses in that neighborhood? How is it different from common house designs? 3.Build the house Foundation -> Walls -> Wiring/Pipes -> Interior

5 5 Patterns “Empirical rules representing regularities of behavior” Patterns in architecture (of buildings) from www.patternlanguage.com:www.patternlanguage.com –Workspace enclosure [183] –Cooking layout [184] –Dressing room [189]

6 6 Patterns in Programming Coding patterns (idioms) –Doing something to every element of an array for (int i = 0; i < size; i++) { do_something(a[i]); } –“Switch” on a string (in Java) if (arg.equals(“list”)) { … } else if (arg.equals(“verbose”)) { … } else if (arg.equals(“help”)) { … } else System.out.println(“bad argument”); –And many others…

7 7 Patterns in Programming Design patterns –Observer –Model/View/Controller –Iterator –And many others…

8 8 Patterns in Programming Patterns in architecture (of software) –Pipeline –Layered Architecture –Microkernel –And many others…

9 9 Case Study: Chat Application Build an application that lets several users chat by sending text messages to one another over the Internet.

10 10 Learning Patterns Steal good ideas –Read other people’s code –Note elegant ways of doing things –Reuse them Read books –“Design Patterns: Elements of Reusable Object-Oriented Software” by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. –As well as many others: see http://hillside.net/patterns/


Download ppt "1 Foundations of Software Design Fall 2002 Marti Hearst Guest Lecture: Good Programming Practices Marat Boshernitsan Computer Science Division, EECS University."

Similar presentations


Ads by Google