CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 1.

Slides:



Advertisements
Similar presentations
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Advertisements

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall NEW   NEW 1.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE116: Introduction to Computer Science 2 Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Summary of the lecture We discussed –variable scope –instance variable declarations –variable lifetime.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Lecture #5 Agenda Cell phones off & name signs out Review Questions? UML class diagram introduction Our first class definition!
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
Summary of the lecture We introduced the instantiation dependency –This is a binary relationship (a relationship between two classes). –It is directional,
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Fall 2007CSE 115/503 Introduction to Computer Science for Majors I1 Now What? What if we want to talk to something that was created somewhere else? E.g.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
1 Composition A whole-part relationship (e.g. Dog-Tail) Whole and part objects have same lifetime –Whole creates instance of part in its constructor In.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CSE 115 / 503 Introduction to Computer Science For Majors I Carl Alphonce 219 Bell Hall.
CSE 305 Introduction to Programming Languages
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
Fall 2007CSE 115/503 Introduction to Computer Science for Majors I1 Announcements Attendance sheet is going around – be sure you sign it! First part of.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Fall 2005CSE 115/503 Introduction to Computer Science I1 Association Also called “knows a”. A relationship of knowing (e.g. Dog-Collar as opposed to Dog-Tail)
Week 5 Recap CSE 115 Spring Composition Informally called “has a” Represented in UML with a diamond- headed arc In code: Declare an instance variable.
CSE 115 / 503 Introduction to Computer Science For Majors I Carl Alphonce 219 Bell Hall.
Fall 2007CSE 115/503 Introduction to Computer Science for Majors I1 Announcements Attendance sheet is going around – be sure you sign it! First part of.
Fall 2007CSE 115/503 Introduction to Computer Science for Majors I1 End of Week Five! Questions? First part of essay assignment (choosing a topic) is posted.
UML class diagrams (1) UML = Unified Modeling Language We use only class diagrams, not other UML diagrams Purpose: –keep OO concepts separate from implementation.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
CSE 116 Introduction to Computer Science For Majors II Carl Alphonce 219 Bell Hall.
CSE 115 / 503 Introduction to Computer Science I
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall 1.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
Thanks, Andrew. Reminders: –wear the wireless mike –combination is 1-31 –speak slowly, pause for questions –I’d rather you get through less material than.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
Presentation transcript:

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall

Announcements Advice –take notes in lecture –don’t rely only on slides –REVIEW notes regularly –bring notes to recitation Web-CAT –we’re tweaking it –don’t worry if you get about regrading

Agenda Brief review Unified Modeling Language (UML) Methods in general

BRIEF REVIEW

Object class instantiation created by ‘new’ + constructor representation stored on heap

Reference an address value of ‘new’ expression

Variable name location type value scope lifetime local variable instance variable

Expression examples of expressions –‘new’ expression –variable expression (on RHS of assignment) example1.Terrarium t1; example1.Terrarium t2; t1 = new example1.Terrarium(); t2 = t1;

package organizational mechanism each class belongs to a package

class “blueprint” of an object

constructor used by new to initialize a new object

scope static property of variable part of program text where a variable declaration holds

lifetime runtime property of variable period of time during which variable exists in memory

UML Unified Modeling Language –industry standard Class diagrams

UML Unified Modeling Language –express design without reference to an implementation language For example

Binary Class Relationships: directional binary  two classes are involved –source class has code modification –target class does not composition –source: WHOLE –target: PART in diagram: –line decoration is on source/WHOLE –show only detail that’s needed/desired

package cse115; public class Dog { public Dog() { } package cse115; public class Tail { public Tail() { }

package cse115; public class Dog { private Tail _tail; public Dog() { _tail = new Tail(); } package cse115; public class Tail { public Tail() { }