Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 116 Introduction to Computer Science For Majors II Carl Alphonce 219 Bell Hall.

Similar presentations


Presentation on theme: "CSE 116 Introduction to Computer Science For Majors II Carl Alphonce 219 Bell Hall."— Presentation transcript:

1 CSE 116 Introduction to Computer Science For Majors II Carl Alphonce alphonce@cse.buffalo.edu 219 Bell Hall

2 Spring 2008CSE 116 Introduction to Computer Science For Majors II2 Last class Syllabus –pick one up if you didn’t get one last time –turn in signature sheet if you didn’t already Name sign –put yours out –bring to each class

3 Spring 2008CSE 116 Introduction to Computer Science For Majors II3 Today’s lecture Student survey 115 review –plus new details

4 Spring 2008CSE 116 Introduction to Computer Science For Majors II4 Modeling Software development can be viewed as model building Hard part is learning –what to model from a problem domain –how to model it

5 Spring 2008CSE 116 Introduction to Computer Science For Majors II5 Object orientation Building blocks of a program are objects. Objects: –properties –capabilities (behaviors) –instances of classes Classes –what the programmer writes

6 Spring 2008CSE 116 Introduction to Computer Science For Majors II6 Class instantiation process by which objects are created example new JButton()

7 Spring 2008CSE 116 Introduction to Computer Science For Majors II7 Class instantiation new + constructor new JButton() new : operator JButton() : constructor call

8 Spring 2008CSE 116 Introduction to Computer Science For Majors II8 Class instantiation 109500 109501 109502 109503 109504 109505 109506 109507 109508 109509 new + constructor new JButton() new : operator JButton() : constructor call

9 Spring 2008CSE 116 Introduction to Computer Science For Majors II9 Class instantiation 109500 109501 109502 109503 109504 109505 109506 109507 109508 109509 new JButton() is an expression whose value is 109500, the starting address of the block of memory storing the representation of the JButton object just created.

10 Spring 2008CSE 116 Introduction to Computer Science For Majors II10 Reference can be used can be stored (in a variable) for later use

11 Spring 2008CSE 116 Introduction to Computer Science For Majors II11 Calling a method (new JButton()).setText(“Quit”); JButton var = new JButton(); var.setText(“Quit”);

12 Spring 2008CSE 116 Introduction to Computer Science For Majors II12 Larger context: memory use How is memory allocated to a process (a running program)? How does allocation of memory affect the lifetime of a variable? How do method calls and parameter passing really work?

13 Spring 2008CSE 116 Introduction to Computer Science For Majors II13 Memory organization and usage A computer’s memory is, at its lowest level, composed of binary digits (bits). The memory is organized into bytes, which are groups of eight bits. Each byte has a unique address in memory. A byte is the smallest addressable unit of memory (i.e. nothing smaller than a byte has its own address)

14 Spring 2008CSE 116 Introduction to Computer Science For Majors II14 Memory organization Process BProcess AProcess C

15 Spring 2008CSE 116 Introduction to Computer Science For Majors II15 Memory organization Process BProcess AProcess C STATIC SEGMENT RUNTIME STACK FREE/AVAILABLE MEMORY HEAP dynamically allocated memory

16 Spring 2008CSE 116 Introduction to Computer Science For Majors II16 Next time Bring name signs (again) 115 review (continued)


Download ppt "CSE 116 Introduction to Computer Science For Majors II Carl Alphonce 219 Bell Hall."

Similar presentations


Ads by Google