CSC 221: Computer Programming I
Fall 2009


GENERAL KNOWLEDGE overview & history: hardware vs. software, technology generations, ... object-oriented design: approach to problem-solving, manage complexity, ... problem-solving skills, critical thinking skills, communiation skills SCRATCH PROGRAMMING simple, visual introduction to programming concepts actions (e.g., move), conditionals, loops, event-handlers, variables simple object interaction via sensing and broadcasts sprites = objects, sprite properties = fields, script blocks = methods JAVA LANGUAGE FEATURES classes & objects using classes, Java libraries, calling methods on objects class definitions fields: private, data types (int, double, char, boolean, String), static methods: public (usually), parameters, local variables, return constructor(s): same name as class, no return type examples: Die, Dot, DotRace, Dictionary, Card, DeckOfCards, ... Java statements assignment: variables, expressions, operators (+, -, *, /, ++, --, +=, ...) output: System.out.print, System.out.println return: returns value from method local variable declaration: primitive vs. objects if: conditional execution, if, if-else, cascading if-else Boolean expression, operators (==, !=, <, ...), connectives (&&, ||, !) while: conditional loop, Boolean expression for: counter-driven loop, equivalent to while but clearer String class methods: +, length, charAt, substring, indexOf, equals, compareTo Scanner class methods: next, hasNext, nextLine, hasNextLine, nextInt, hasNextInt, ... ArrayList class methods: add, get, set, size, remove, contains, indexOf, toString built on top of arrays (which use [] to access entries) PROGRAMMING TECHNIQUES object-oriented design principles classes model real-world entities methods implement behaviors, provide for computational abstraction fields maintain state of an object (final for constants, static for shared) classes/methods should be cohesive; classes should be loosely coupled conditionals for alternatives (1-way if, 2-way if-else, multi-way cascading if) loops for repetition (conditional while loops, counter-driven for loops) counters & sums for collecting data String traversal/concatenation for manipulating text Scanner class for reading user input; File for accessing text files ArrayLists/arrays for storing and accessing large amounts of data parallel lists for storing and accessing related data