Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall 645-4739 1."— Presentation transcript:

1 CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall 645-4739 alphonce@buffalo.edu 1

2 Announcements / Reminders Cell phones off Name signs out 2

3 Association for Computing Machinery Interest meetings (Davis 338A) will be held on: –Tuesday, 31 January at 6PM (FREE FOOD) –Wednesday, 1 February at 6PM (FREE FOOD) Teaching and applying our knowledge about computer science –Bus tracking project –UB Hacking –Mock technical interviews Develop strong relationships with CS faculty –Faculty meet and greet Feel free to contact the officers at ubsa- acm@buffalo.edu!

4 Activity I need 3 volunteers. 4

5 Activity details 3 volunteers, a.k.a. objects When I tell you… (I) …you should… (II) …you should… (III) …you should… STARTbegin doing jumping jacksstart counting slowly, 0…1…2… etc, but always starting at zero do nothing STOPstop jumping, and stand normally stop counting, but remember where you left off do nothing CONTINUEdo nothingkeep counting up from where you left off do nothing anything elsedo nothing

6 Activity Review Why did we do this activity? –To introduce the idea of an object. What is an object? –It is a representation of something in our problem domain –It has both: CAPABILITIES PROPERTIES / STATE

7 Questions? 7

8 Example Describe the game of soccer. http://en.wikipedia.org/wiki/Soccer

9 Executable Model Conceptual Model Apply same idea to developing software solutions:

10 The conceptual model A model of the problem domain problem domain consists of: –objects (in non-technical sense) properties capabilities –relationships between objects Conceptual model encodes relevant parts of the problem domain in a formal way

11 PROGRAM CODE Executable Model MACHINE EXECUTABLE Initial Conceptual Model Problem Domain Iterative refinement of model Compilation A more refined picture (iterative refinement in action!)

12 Tools Editor Compiler Execution environment Integrated Development Environment (IDE) DrJava, Eclipse, NetBeans, Emacs, etc. 12

13 Review Software development is an iterative and incremental process. OO software systems are systems of interacting objects. Objects have –properties: things objects know (think of the counting object last class) –behaviors: things objects do (think of the “jumping jack” object)

14 How do we create objects? –new example1.Terrarium() –There are three parts to this expression: new example1.Terrarium ()

15 Let’s try it! We use a tool called Eclipse… …and a plug-in for Eclipse called DrJava DrJava provides an interactions pane

16 Eclipse tour terminology –view: a subwindow in Eclipse –perspective: a collection of views Eclipse: a framework for building tools –Eclipse is extended via plug-ins –a plug-in: Java Development Tools (JDT) –others: DrJava, Green, CDT, …

17 Expression evaluation evaluating new example1.Terrarium() –causes an object to be created and initialized –produces a value

18 (part of) memory 107 108 109 110 111 112 113 114 115

19 evaluating a ‘new’ expression used available used 107 108 109 110 111 112 113 114 115 When evaluating an expression like ‘new example1.Terrarium()’, the operator ‘new’ first determines the size of the object to be created (let us say it is four byte for the sake of this example)

20 evaluating a ‘new’ expression used reserved by ‘new’ available used 107 108 109 110 111 112 113 114 115 When evaluating an expression like ‘new example1.Terrarium()’, the operator ‘new’ first determines the size of the object to be created (let us say it is four bytes for the sake of this example) Next, new must secure a contiguous block of memory four bytes large, to store the representation of the object.

21 evaluating a ‘new’ expression used 10101010 available used 107 108 109 110 111 112 113 114 115 When evaluating an expression like ‘new example1.Terrarium()’, the operator ‘new’ first determines the size of the object to be created (let us say it is four byte for the sake of this example) Next, new must secure a contiguous block of memory four bytes large, to store the representation of the object. Bit strings representing the object are written into the reserved memory locations.

22 evaluating a ‘new’ expression used 10101010 available used 107 108 109 110 111 112 113 114 115 When evaluating an expression like ‘new example1.Terrarium()’, the operator ‘new’ first determines the size of the object to be created (let us say it is four byte for the sake of this example) Next, new must secure a contiguous block of memory four bytes large, to store the representation of the object. Bit strings representing the object are written into the reserved memory locations. The starting address of the block of memory holding the object’s representation is the value of the ‘new’ expression. This address is called a ‘reference’.


Download ppt "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall 645-4739 1."

Similar presentations


Ads by Google