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 Fal 2009 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 Local Variable and Parameter Management c Local variables go in and out of existence c Come into existence when declared c Go out of existence at the end of their scope c Parameters act just like local variables where their scope is that one method c When tracing – be careful to watch the scope CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 1 CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 2 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
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 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 3 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 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 4 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 CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 5 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.
Background image of page 2
3 CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 6 Objects c Bundles of (related) c data (“state”) c operations (“behavior”) c Data often referred to as instance variables c Operations usually called methods c Invoking operations can change state (values stored in instance variables) CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 7 Sample Student Object Kerry Keenan Name 444230695 ID 06-22-1987 DOB CMSC Major State Methods getAge date age getGrades semester grades etc. etc. CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 8 Accessing State / Methods c If c o is an object c v is an instance variable of the object c m is a method of the object c Then c o.v is how to access the data v in o c o.m is how to invoke m in o c So c System is an object, with out an instance variable c out is also an object, with println a method
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 / 13

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