Download presentation
Presentation is loading. Please wait.
Published byEdgar Rodgers Modified over 8 years ago
1
CS110 Introduction to Programming Lecture 1 January 27, 2004 Ethan Bolker Philosophy Bank: user interface, Java, object model Programming environment Homework 1 Start now! www.cs.umb.edu/cs110
2
Lecture 12 Announcements These slides are available on course web page Hand in questionnaire on your way out Discussion sections meet regularly in Purple Lab, upper garage level in Healey library Purple lab PCs have been configured for CS110 Other lab computers will be ready soon – I will let you know when Passwords for homework turnin web site available at next class
3
Lecture 13 Learning to program Lots of fun Practical Hard, time consuming Unusual mixture: –sophisticated intellectual content –picky details that must be right Exercise in reading, writing, thinking CS110 is for CS majors, future professionals
4
Lecture 14 Teaching/learning style To learn a language well, live in a land where it’s spoken – anxiety producing, but efficient! Learn to write by to reading and writing and writing about what you learn 60% of a lot is more than 100% of a little Ask questions (to slow me down)
5
Lecture 15 Computers and programs Computer: a machine that can simulate many different machines word processor traffic light controller internet shopping site bank ATM … Program: the instructions that tell a computer how to act like some particular machine Example: Bank simulation –user interface (how the program behaves) –object model (the program’s architecture) –Java implementation (the program itself)
6
Lecture 16 Bank simulation - user interface a:\> java Bank [Enter, CR] Welcome to Engulf and Devour Account number (1 or 2), 0 to shut down: 1 Transactions: exit, help, deposit, withdraw, balance transaction: balance 200 transaction: deposit amount: 799 transaction: balance 999 transaction: exit Account number (1 or 2), 0 to shut down: 0 Goodbye from Engulf and Devour a:\>
7
Lecture 17 Bank simulation - object model program architecture “Engulf and Devour” int 200 int 200 BankAccount balance: BankAccount balance: Terminal String bankName: Bank BankAccount account1: BankAccount account2: Terminal atm: 999 200 int
8
Lecture 18 Why Java? Fashionable, modern (for good reasons) Object oriented: when you have designed the architecture a program almost writes itself Portable: the same Java code turns any computer (PC, mac, server) into a Bank Well designed: –consistent user interface –easy to learn –hard to make serious mistakes –prebuilt objects plug into your programs
9
Lecture 19 Send object a message Bank.java (lines 101ff) while ( moreTransactions ) {... String command = atm.readWord( "transaction: " );... else if ( command.equals( "deposit" ) ) { int amount = atm.readInt( "amount: " ); account.deposit( amount ); }... else if ( command.equals( "balance" ) ) { atm.println( account.getBalance() ); }... } object dot message ( information )
10
Lecture 110 message from Bank : Bank simulation Objects responding to messages Terminal object (the atm) return info to Bank readWord(″transaction: ″ ) true or false equals( ″ deposit ″ ) String object (the command) return info to Bank command customer typed line 107 line 114
11
Lecture 111 message from Bank : Bank simulation Objects responding to messages BankAccount object afterbefore return info to Bank: bal: 999 getBalance() bal: 999 bal: 200bal: 999deposit(799) 999 line 123 line 116
12
Lecture 112 Software development cycle imagine design edit compile run, test imagine the next release... user interface object model Java implementation quality assurance good programs evolve! XEmacsXEmacs
13
Lecture 113 emacs The programmer’s editor (word processor) Learning emacs is as important as learning Java You will live inside emacs in this course XEmacs installed on all lab PCs, available free for home machines Start using it today – tutorial linked from course home pagetutorial
14
Lecture 114 Homework 1 Handed out in class, on course web page Part 1 – get started –Hard copy due at the next class –Send email –Explore course web page –Understand rules about honesty –Write about what you find – use emacs Part 2 - jump in to Java –Collected electronically Tuesday Feb 3 –Play with Bank simulation –Improve Bank simulation –Write about your coding and testing
15
Lecture 115 Start now! Turn in questionnaire as you leave class Sections meet in Purple lab (Library upper level) Today: begin hw1 –send email! (any lab) –explore web page www.cs.umb.edu/cs110 (any lab)www.cs.umb.edu/cs110 –begin using XEmacs (Purple lab) I will be in my office (S-3-179) today until 4, tomorrow 12-2:30
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.