Title: CS Department Survey
1CS Department Survey
- while waiting for class to start
2Week 01 - a
- Course Introduction
- What is Computer Science?
- What is Programming?
- How Do Computers Work?
- Using the BlueJ IDE
3Course Philosophy
4Sample Programs Referenced(code located in
course folder)
- simcom(AnimatedIllustrations)
- Payroll
- Washer Weight(bring washers)
- Temperature Conversion
5Handouts(All are Available on Web)
- Course Schedule
- Grading Policies
- Programming Standards
- HW 1 Temperature Conversion
- HW Grading Sheet
- to be attached to the front of all HW
6Course Introduction
- Web site http//cs.union.edu/csc105
- Students and Instructor
- Goals and Objectives
- Schedule
- Textbooks
- Grading
- Labs
- Assignments
7Typical CSc-105 Student
- Extensive C/Java experience?
- Should be in CSc-140 (Data Structures)
- Some Programming Background?
- CSc-10 or equivalent High School Course
- May have had a little C/Java experience
- No Programming Experience?
- Need to have a logical mind
- good at math, chess, problem solving, etc.
- Youll need to spend extra time on course
8Introductions
- Instructor Dave Hannay
- Please send email to hannayd_at_union.edu
- Your name, class year, major, computer background
- Counts as HW 0 due before next class
- Office in Steinmetz 207 388-6318
- Office Hours
- Mondays 130-245pm
- Wednesdays 930-1100am 130-245pm
- Thursdays 930-1030am
- Others by Appointment
- Or just stop in if you're in the neighborhood
- here most of the day at least 4 days per week
9Obtaining Course Software
- First the good news It is all free!
- Now the bad news It takes a while
- You will need two items on your PC/MAC
- (see course web site for links)
- Java Software Development Kit (not needed for MAC
OS/X)http//java.sun.com - BlueJ Integrated Development Environmenthttp//ww
w.bluej.org
10Course Outline
- Course Schedule
- Reading assignments
- Exam Dates this term
- Test 1 28 Sep 2005
- Test 2 24 Oct 2005
- Final ?? Nov 2005
- Tests
- Tests are "closed book"
- May bring up to 4 (double-sided) sheets of notes
- may not be shared during the test
11Textbooks
- Problem Solving with Java, 2nd Edition (Addison
Wesley, 2002) - by Elliot Koffman Ursula Wolz
- BlueJ Tutorial (download at www.BlueJ.org)by
Michael Kölling
12Course Logistics
- Class runs from 300 440pm
- 5 minute break around 350
- Grab a cuppa java -or-
- Get help on reading/lecture material -or-
- Demonstrate or get help on HW
- Bring Textbook with you to Class Lab
- For In-Class Exercises
- As a Command Code Reference
13Grading
see Grading Policies Web Page for Attendance
Policy
- 25 Test 1
- 25 Test 2
- 30 Test 3 (Final)
- 10 Homework Projects
- 10 Lab see Grading Policies Web Page for
Rules
14Laboratory
- Hands-on Practice
- Bring Textbook (needed as reference)
- Olin 110 (use ID Card for access)
- You may work there at other times if there is no
class meeting at the time - You should have been assigned to either Morning
(1050am) or Afternoon (145pm) Lab Tomorrow
15Programming Assignments
- Really worth 100 since doing them will affect
your performance on Tests Labs as well - List names of all people working with you or from
whom you received any assistance (assisted by) - Extra Credit for doing something significant
beyond requirements.
16Course Instructor will serve as the "Client"
- After turning in each assignment, you need to
demonstrate the features of your program to the
client - HW not graded until after the demonstration
- Demo in my office, or before class
17Programming Assignments
- The purpose of the HW exercises is not merely to
parrot back things that you learn in class, but
rather to learn by doing. - As I can assure you from years of programming
experience, you learn a lot more about writing
programs by trying things that sometimes don't
work than by simply copying someone elses
working code.
18Experience is the Best Teacher!
- Learning what does not work is as important as
learning what does work - It will save you a lot of time in the future.
19Turning in Homework
- Create program using BlueJ
- Compile/Run Program
- possibly multiple times
- Print out Program Demonstrate
- Copy contents of Output (Paste into File)
- to show Results
- Staple Grading Sheet to front
- Due at Beginning of Class on Due Date
20What is Computer Science?
- Algorithms Data Structures
- Computer Architecture
- Artificial Intelligence Robotics
- Database Information Retrieval
- Human-Computer Communication
- Numerical Symbolic Computation
- Operating Systems
- Programming Languages
- Software Methodology Engineering
- Social Professional Context
21Algorithms Data Structures
- Specific Classes of Problems and their Efficient
Solutions - Performance Characteristics of Algorithms
- Organization of Data relative to Different Access
Requirements - (what we do in this class)
22Computer Architecture
- Methods of Organizing Efficient, Reliable
Computing Systems - Implementation of Processors, Memory,
Communications and Software Interfaces - Design and Control of Large, Reliable
Computational Systems - (more on this shortly)
23Artificial Intelligenceand Robotics
- Basic Models of Behavior
- Building (virtual or actual) Machines to Simulate
Animal or Human Behavior - Inference, Deduction, Pattern Recognition and
Knowledge Representation
24Database andInformation Retrieval
- Organizing Information and Designing Algorithms
for the Efficient Access and Update of Stored
Information - Modeling Data Relationships
- Security and Protection of Information in a
Shared Environment - Characteristics of External Storage Devices
25Human-Computer Interface
- Efficient Transfer of Information between Humans
and Machines - Computer Graphics
- Human Factors that Affect Efficient Interaction
- Organization and Display of Information for
Effective Utilization by Humans
26Numerical and Symbolic Computation
- General Methods for Efficiently and Accurately
using Computers to Solve Equations from
Mathematical Models - Effectiveness and Efficiency of Various
Approaches to the Solution of Equations - Development of High-Quality Mathematical Software
Packages
27Operating Systems
- Control Mechanisms that Allow Multiple Resources
to be Efficiently Coordinated during Execution of
Programs - Appropriate Service of User Requests
- Effective Strategies for Resource Control
- Effective Organization to Support Distributed
Computation
28Programming Languages
- Notations for Defining Virtual Machines that
Execute Algorithms - Efficient Translation from High-Level Languages
to Machine Code - Extension Mechanisms that can be Provided in
Programming Languages
29Software Methodologyand Engineering
- Specification, Design and Production of Large
Software Systems - Principles of Programming and Software
Development, Verification and Validation of
Software - Specification and Production of Software Systems
that are Safe, Secure, Reliable and Dependable
30Social andProfessional Context
- Privacy and Misuse of Data
- Hacking and Viruses
- Plagiarism and Software Piracy
- Misuse of a Computer Resource
31General-PurposeStored-ProgramDigitalComputers
32Computer Architecture
- Central-Processing Unit
- performs the actual work of executing the program
- Main Memory
- holds the program and during execution
- Hard Disk (secondary storage)
- holds all programs not executing and all data
files - Input/Output Devices
- allow the computer to communicate with the
outside world
33(No Transcript)
34Input/Output I ? NY
- (credited to Roger Hulls brother-in-law, John
Dyson, while he was NYS Commissioner of Commerce) - public class SimpleIO
- public void Love() throws java.io.IOException
- System.out.print("Please enter state ")
- char ch1 (char) System.in.read()
- char ch2 (char) System.in.read()
- System.out.println("I LOVE " ch1 ch2)
- // end of Love method
- // end of SimpleIO class
- Try Maine!
35Binary
- Computers use Binary Numbers
- bit binary digit
- byte collection of 8 bits
- word usually 4 or 8 bytes (32 or 64 bits)
36Data Representation
- Numbers can be used to represent any type of data
- Each text character is assigned a unique number
- ASCII uses 1 byte (8 bits 256 possible
characters) - Unicode uses 2 bytes (16 bits over 65,000
characters) - pictures are represented by dividing them into
picture elements known as pixels - video images or animations are represented by
placing several pictures one after another - songs are represented by sampling the wave at
regular intervals
37(No Transcript)
38Computer Software
- Operating System
- Examples?
- Responsibilities?
- Application Software
- Examples?
- Where do they reside when not in use?
- Where do they reside when running?
39Programming Languages
- Machine Language
- Binary codes
- Processor specific
- Assembly Language
- Mnemonic codes
- Processor specific
- High-level Language
- English/math-like codes
- A A B
- Processor independent
- Examples of high-level languages?
40Object-Oriented Programming
- Programs are structured as a collection of
classes. - Each class describes a type of object.
- A program creates a collection of objects from
class definitions. - Objects interact via methods.
- Objects also have attributes that describe their
state.
41(No Transcript)
42(No Transcript)
43Analogies for Concept of "Class"
- Class Blueprint for houses in Levittown
- Properties (attributes, state) Location, Color,
etc. - Object One House (e.g. identity myHouse)
- Constructor Contractor ("Construction" workers)
- Class Class of People (say Union students)
- Properties GPA, major, birthdate, height, etc.
- Object Person in class
- Method person.installLightBulb(b)
44Mike the Monster
- Class Monster
- Class attributes (data)
- Color
- Number of eyes
- Others?
- Class methods
- Speak
- Look left
- Look right
- Others?
- Object Mike
- Object attributes
- Color green
- Number of eyes 1
- object.method
- Mike.speak("Its scaring time!")
- Mike.lookLeft()
45To the Computers...
- Check out the Course Web Site if you havent
already done so - cs.union.edu/csc105
46Java BREAK
47Running a Program
Main memory
CPU
Fetch/Execute Cycle
Hard disk
Program
48Running a Program
- First the program and all its data are copied
from the hard disk into main memory - The CPU goes to the location of the program
instruction and reads that word - The CPU determines what action is requested by
decoding its bit pattern representation - The CPU performs the action
- The CPU then moves to the location of the next
program instruction in memory, reads the word,
and repeats the process
49"Stored Program" Concept
- Simple Computer Simulation
- PC Start Menu gt Run gt cmd
- set CLASSPATH
- C (to change to drive C)
- cd \AnimatedIllustrations
- java simcom.SimComFrame
- -OR- Double-Click the "MS DOS Command Prompt"
icon - File Menu gt Scenarios gt Times5
- Double-Click Decimal Value of Location 31
- Change to 17
- Step Button then Step Lightspeed
- Watch what happens!
50We will use an IDE (Integrated Development
Environment). It contains an editor, compiler,
interpreter, and more!
51Processing a Java Program
- What form must our program instructions be in so
that they can be executed? - What do Java instructions look like?
- A compiler is a program that translates source
code into object code. - Java is different (Java is also more Fun)
- Why?
- How?
52Software Development
- Specify the problem requirements
- Analyze the problem and identify the classes that
will be needed - Design the classes
- Locate relevant existing classes
- Modify existing classes
- Design new classes
- Implement the new and modified classes
- Test and verify the completed program
- Maintain and update the program
53Java Modes
- Applications
- stand-alone programs that run on you own computer
- can read and write data on your hard disk
- Applets
- executed from within a browser window (e.g.
FireFox, Netscape or Internet Explorer) - can be loaded from the World Wide Web and
executed on another computer - cannot read or write data on your hard disk
54Object-Oriented Programming and Java
- The use of OOP in Java is pervasive
- easy to create multiple objects of the same type
- easy to create similar objects without having to
rewrite the overlapping code - OOP makes programs easier to understand and more
reliable - Prevents objects from having to know any more
about structure of other objects than is really
necessary
55Objectives in Programming
- A program should solve a problem
- correctly (it actually solves the problem)
- efficiently (without wasting time or space)
- readably (understandable by another person)
- in a user-friendly fashion (in a way that is
easy to use).
56Errors
- Errors found in a program
- Syntactic errors are caused by giving the
compiler a program it cannot recognize - Logical errors come from programs that compile
correctly but fail to execute as expected
sometimes much harder to find! - Programs must be designed carefully and tested
thoroughly to ensure that neither type of error
will occur
57Testing and Debugging
- These are crucial skills.
- Testing searches for the presence of errors.
- Debugging searches for the source of errors.
- The manifestation of an error may well occur some
distance from its source. - Commercial Software is rarely bug free!
- Dilbert has trouble with a software vendor...
58Using BlueJ
- Start BlueJ
- Open Project (Payroll Application)
- Open Class (Payroll)
- Edit the class
- Revise the code from the template
- Compile the class
- Add other classes as needed
- Either instantiate an object and run method or
run the main method (more on this later)
59Simple Payroll Class
- / CSc-105 In-Class Demonstration "Payroll"
- class Payroll
- Calculate gross pay given hours worked and
rate of pay -
- _at_author Dave Hannay
- _at_version Lecture Week01-a
- /
- public class Payroll
- public void calcPayroll()
- double hours 40.0 // hours worked
- double rate 9.65 // rate of pay
- double pay // gross pay
- pay hours rate
- System.out.print("Hours")
- System.out.print(hours)
- System.out.print(" x Rate")
- System.out.print(rate)
- System.out.print(" PAY ")
- System.out.println(pay)
60Case Study Problem Definition and Analysis
- Problem Get weight of a box of flat washers
- User should enter the washer dimensions, density
and quantity - Program should compute and display the weight
- Analysis
- Box weight Quantity Washer weight
- Washer weight Volume Density
- Volume Surface area Thickness
- Surface area area of outer circle area of
inner circle - Area of circle PI radius 2
61Case StudyDesign the Classes
- Most solutions will involve at least 2 classes
- Worker class to represent the object being
modeled - User interface or Application that interacts
with the user - Classes
- Washer ? Worker
- WasherApp ? User Interface or Application
- Others?
- Any existing classes for input and output?
- Washers are circular ? Circle class?
62Classes for Washer Weight
63Class Definitions
- Attributes (data fields) describe state
- e.g. a circle has a radius
- Methods define what the object can do or what can
be done to an object - e.g. a circle should be able to compute its area
and a user or client should be set the circles
radius - see Circle class
- What attributes should the Washer class have?
- What methods should the Washer class have?
64Class Definition Form
- Header
- Body
- Data field declarations
- Method definitions
private double radius
public double computeArea() return Math.PI
radius radius
Review the code for the Circle and Washer
classes(in BlueJ, and on handout)
65HW Assignment 0 and 1email and Temperature
Conversion
- HW 0Send e-mail to hannayd_at_union.edu
- Preferred Name, Class Year, Major
- Computer Background
- Due before next Class
- HW 1Enter and run given program
- Purpose
- Example of Documentation Standards
- Learn how to Print Program Files
- Learn how to e-mail Attachments
- Due One Week from Today
66Lab 1 Pre-Lab
- Read Sections 1.4 and 1.5 in the textbook
- Download the BlueJ Tutorial (see web)
- In general, it is a good idea to read the
material before it is presented in class so that
you can be prepared to ask questions when a
particular topic is discussed. - HANDOUT How-To Notes
67To the Computers...
- Run the "square" Scenario on simcom
- Double-Click "DOS Command Prompt" Icon, then type
in - set CLASSPATH
- java simcom.SimComFrame
- Double-click the second column of location 31 to
enter number to be squared.
68Java BREAK