05classesIntroSmall

05classesIntroSmall - Lecture Set 5: Design and Classes...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) Lecture Set 5: Design and Classes This Set: c Methods and Parameter Passing c Basics of program design c Pseudo-code c Objects and classes c Heaps c Garbage Collection c More about Creating Objects and classes in Java c Methods c Constructors, Accessors, Mutators c Equality c Printing an object CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 1 methods: defining and invoking c One useful type of method for this project: c defined within the FlagMaker class c invoked from within another method that is defined in the same class c we’ll do a lot more variations later c Defined based on a name and a list of parameters public static void name(parameterlist){ body } c Invoked by stating its name and giving an argument for each element of the parameter list name(argumentlist); CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 2 method information: parameters and arguments c parameter list c type name for each item in the list c e.g. (MyGrid grid, char where) c argument list c expression for each item in the list c e.g. (grid, ‘t’) c Matched between the arguments and the parameters based on position in the list
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 3 The Software Lifecycle Requirements Design Coding Testing Deployment Maintenance Evolution What customers want What you plan to do Your program Did you meet requirements? Delivery (documentation, etc.) Bug fixes New versions CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 4 In the Real World, Requirements and Design Rule c Getting requirements right is essential for successful projects c FBI electronic case file (junked after $180m) c IRS system upgrade in late 90s (junked after >$2bn) c FAA air-traffic control (false starts, >$10bn spent) c Good design makes other parts of lifecycle easier c In “the real world” coding typically < 30% of total project costs c A good design improves: c efficiency (speed) c efficiency (memory) c ease of coding c ease of debugging c ease of expansion CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 5 Program Design c There are many aspects to good design c Architecture c Modeling c Requirements decomposition c Pseudo-code c In this class we will focus on latter
Background image of page 2
3 CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 6 What Is “Pseudo-code”? c When developing a complex part of a program (an algorithm), one of the tools often useful is pseudo-code. c It's not English, not programming language -- somewhere between. c Captures the flow of the program without worrying about language-specific details. CMSC 131 Spring 2007 Jan Plane (adapted from Bonnie Dorr) 7 Example: c Requirement : email program that allows you to send a message either to one person, or to your whole address book c Pseudo-code : prompt "Enter message: " input message prompt "Send to whole address book? " input answer if answer == "no“ prompt "Enter recipient: " input recipient send message to recipient
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

05classesIntroSmall - Lecture Set 5: Design and Classes...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online