220 likes | 393 Views
CS498. February 14, 2005. Books for Reference. Design Patterns Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides Addison-Wesley Professional Thinking in C++ Thinking in Java Bruce Eckel Mindview http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html Code Complete
E N D
CS498 February 14, 2005
Books for Reference • Design Patterns • Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides • Addison-Wesley Professional • Thinking in C++ • Thinking in Java • Bruce Eckel • Mindview • http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html • Code Complete • Steve McConnell • Microsoft Press
“Writing” Code You don’t write code, you build code
Requirements • What does it do? • Who is going to use it? • How is it going to be used?
Make it work • Make it work • THEN Make it work well (or better)
Just start coding! Can result in bad design
Preparation • Experiment – write some code • Learn some details through experimentation • get used to using some functions, methods, or objects • Learn what’s available to you already
Design • Analysis paralysis • Use the results of your experiments in your design • Take what’s available already into consideration (don’t reinvent the wheel)
Design • Get your hands dirty • Avoid analysis paralysis • Use the results of your experiments in your design • Use what’s available • I can write something better • I want to write it myself
Design Practices • Top Down – decomposition • Bottom Up – composition
Design Practices • Top Down – decomposition • Bottom Up – composition • Some combination of the two methods • Iterate
Design Practices • Top Down – decomposition • Natural process • Allows you to defer details (procrastinate?) • Can run into problems associated with details • Bottom Up – composition • Start from what already exists • Create your toolkit or set of materials • Some combination of the two methods • Iterate
Design Practices While not done: Come up with a design Write some code to test it out Revisit your design Write more code
Requirements Use a finite state machine to process a metadata file into an HTML portfolio intended for viewing by others. Example metadata provided.
Analysis • Tag, end tag pairs with information between • Information may include other tag/end tags • Some tags appear nested between certain other pairs only • FSM • File IO • Strings • HTML • Use your own information
Implied Hierarchy Project Summary Author Date Day Month Year Files Doc Code
Preparation • Learning a new language • Syntax, flow control, conditions, data types, etc. • Available libraries, facilities, methods, objects • File IO • Processing strings • Trees
Simple Method • Process beginning to end, outputting HTML as you go • Get user input • Read/process data, output as you go • Strengths? • Weaknesses?
Another method • Save output until the end • This follows the scan raster method • Get user input • Read in all data • Process all data • Output all HTML • Strengths? • Weaknesses?
Some Bottom Up Ideas • “get a tag” • Compare against a list of legal tags