CS100J, Spring 2001 Thurs 12/6 Lecture 27 ------------------------------------------------------------------------------- Announcements: + regular consulting ends at 6:00 on 12/7 + final consulting hours: 2-5pm, MTW (12/10-12/12) + Prelim 3 regrades due by 5pm on 12/12 + Project 6 regrades due by 4pm 12/14 in UPSON 303 (front desk person will collect them) + see grade postings in Carp -- to correct something, bring graded work to Laurie Buck during her office hours + makeup exam tonight, 7:30-9:30 (Beth Howard emailed the location) + final exam info posted in Exams-->Final (read it!) + review material for final in Exams-->Review Final ------------------------------------------------------------------------------- Topics: + MATLAB wrapup + $main$ and $args$: NO MORE MAGIC LINES! ------------------------------------------------------------------------------- MATLAB Function wrap up (see previous notes) ------------------------------------------------------------------------------- $args$: + command-line arguments: strings input to program + how to access? - CodeWarrior: Main Class Target arguments - Use JDK and command-line prompt > java - use MATLAB >> classname.main('stuff') ------------------------------------------------------------------------------- Done: Congratulations! You now know EXACTLY what the following means: public class Blah { public static void main(String[] args) { } } ------------------------------------------------------------------------------- Semester wrapup/Course summary: + programming: automating problem solving + problem solving process: (1) find problem (2) brainstorm (3) research (4) outline (5) draft (6) polish + why follow this process? sooner to computer, longer it takes! ------------------------------------------------------------------------------- Computer language: + convert human language into written language + language components: - alphabet --> keyboard characters (character set) - words -> tokens - sentences -> statements + elements: - tokens: comments, whitespace, strings, numbers, operators, identifiers, keywords - statements: empty, expression, assignment, selection, repetition, function, .... ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Problem Solving Process: (1) finding problems? - think of physical and abstract situations - something starts it, something goes in, something comes out, something stops it (2) brainstorm - thinking about a problem - search for specifications, which are stated and implied (3) research - find nouns (become variables, fields, classes) - find verbs (become operations and methods) (4) outline - the algorithm (a collection of short, instructional steps, written in a general fashion as pseudocode to solve a problem) - may have to make many algorithms for complex software - special trick: write your algorithm as comments inside file(s) and then convert comments to code (5) draft - write code - do a little at a time (STEPWISE REFINEMENT) - approaches: + topdown: start at top of algorithm and work "downwards" (test code before moving to next step) + bottomup: start with each operation/function and write (test each function separately with dummy inputs) + reuse: find something similar and swipe it (with proper credits) + mixed: most common approach: do a little bit of each! - for mixed approach, write names of functions without actually writing the bodies (called STUBBING) -- then gradually fill in the "missing pieces" - always remember to break big problems into smaller ones! (6) polish - debug and test code - try to "break" things to develop robust software - improve efficiency of algorithms ------------------------------------------------------------------------------- Software engineering: + iterate the design and testing process + may have to return to several stages of the process! ------------------------------------------------------------------------------- Style: + clear, consistent commenting and user manuals + comment major variables, functions, control structures + indentation of substructures + avoid redundancy but not at cost of cryptic code ------------------------------------------------------------------------------- Advice: What to do next: + beyond CS100: inheritance, I/O, interfaces, GUIs, recursion, efficiency (O(n) stuff), data structures + review P6 -- add Diner stuff, linked lists, learn/improve I/O, write GUI + programming and life (break problems down into smaller problems...) ------------------------------------------------------------------------------- Mystery event ??? -------------------------------------------------------------------------------