Final Exam Review
Review: Java from bottom up
- simple statements: input, output, assignment
- System.out.println, in.next() are actually ____ calls!
- control:
- selection (if, switch)
- repetition (while, for, do-while)
- grouping (compound statement)
- variable declarations
- can initialize variable at same time
- variables must be made up of letters, digits, and underscores
- don't start with digit
- don't use a reserved word (like float or while)
- types
- simple types:
- (scalar:) int, char, boolean
- measures: float, double
- arrays: collection of items each with same type
- Note: type can be an array: int [][] grid;
- classes
- attributes, methods, constructor, static final data
- expressions:
- precedences (can override with parens):
- high:
- [] . () ++ -- (where ++, -- are post-increment)
- ++ -- ! unary + - (where ++, -- are pre-increment)
- * / %
- + -
- < <= > >=
- == !=
- &&
- ||
- low: = += -= etc.
- type rules:
- combining float and int: result is float
- / with floats is different than / with ints
- methods, parameters
- arguments vs. parameters
- simple types: pass the value
- instances of classes: pass the reference
- Scope, lifetime
- Reading data
- Scanner input = new Scanner(System.in); - read from console
- input.next() - read next word, skipping any whitespace
- input.nextLine - read next line; used rarely
- input.nextInt(), input.nextDouble - read next
integer/double
- JOPtionPane.showMessageDialog(null, "message")
- JOptionPane.showInputDialog("prompt") - returns input as string
Building Software Systems
- This class: writing Java programs.
- There's more to developing applications than this, though!
- Steps:
- business decision: will building application be worth the cost
- is management committed?
- is there a social impact?
- requirements: what does customer need?
- analysis: more detailed requirements, deciding what pieces to implement
in hardware vs. software
- design: breaking system into components, decide on algorithms and
software architectures
- implementation: translating design into C++
- testing: verifying system does what customer wants/needs
- Writing code less than 25% of project!
- determining what customer wants/needs: much domain-specific knowledge
- managerial activities: coordinating efforts, negotiating schedules
- verifying system meets customer needs and expectations
Another theme: problem solving
- First step: ask questions: make sure you know what the problem
is!
- know inputs, outputs
- know how much data you need to deal with
- what are the errors that we must address?
- Second step: find solution
- look for similar problems you've already solved
- maybe the new problem is similar with different names
- maybe the new problem contains components that you've solved elsewhere
- means-ends analysis: identify intermediate goals, figure out how to get
from one goal to the next
- divide and conquer: break large pieces into smaller pieces
- Biggest problem: mental blocks
- solution: start by writing down what you do know
Sample Real-world Projects
- Cellular Phone Billing System
- typical business application (computer information systems emphasis)
- process call records, calculate charl. various taxes), print
bills, track payments, track customer issues
- front-end: GUI to handle customer calls/requests
- back-end: reports on system (eg: commission payments); interfaces to
telephone switch and bank; past-due notices
- big issue: converting data from one system to another when a new
cell-phone agency installs a new billing system
- approximately 1/2 million lines of code
- Flight Management Controller
- controller for in-flight fueling jet
- controller: responsible for ensuring jets don't crash; handle take-off
and landing with an extremely dangerous load; autopilot for very long
missions
- basic architecture: interface with a dozen subsystems; give pilot
control through touch-panel; control flight path; distribute fuel; advise
pilot of emergencies
- future:
- when your clothing contains a computer, computation needs will make
today look like the stone ages!
- computers will be so tiny they can be sprayed on your wall with paint!
- application: emit sound to cancel out noises on the other side of the
wall
Professional Responsibility
- We've discussed how to write a program, but not much about
what programs should be written!
- Programmer has responsibility to not make the world a more dangerous
place with his or her program.
- Programmer must ensure he or she has the necessary skills!
- Programmer must also often be the conscience.
- Examples:
- programs which use SSN as id numbers
- transmitting patient records from Dubuque to Madison
- Can they be intercepted? spoofed?
- more controversial: traffic cameras at intersections
- Computers continue to double in power about every year and a half
- At some point, there will be enough computational power to build
computers that can track everything - is this good?
- Too many people look at the computer as the ultimate solution without
asking the cost; programmer must ask serious questions before agreeing to
build the system.