20091005-UML_Methods

20091005-UML_Methods - CSE115:Introductionto...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style CSE115: Introduction to  Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 [email protected] 11
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Phones off Signs out
Image of page 2
Agenda Unified Modeling Language (UML) Methods in general
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
UML Unified Modeling Language industry standard  Class diagrams
Image of page 4
UML Unified Modeling Language express design without reference to an  implementation language For example
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
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
Image of page 6
package cse115; public class Dog { public Dog() { } } package cse115; public class Tail { public Tail() { } }
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
package cse115; public class Dog { private Tail _tail; public Dog() { _tail = new Tail(); } } package cse115; public class Tail { public Tail() { } }
Image of page 8
METHODS
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
package lab2; public class EcoSystem { private example1.Terrarium _t; public EcoSystem() { _t = new example1.Terrarium(); } public void addTwoCaterpillars() { example1.Caterpillar c1 = new example1.Caterpillar(); example1.Caterpillar c2 = new example1.Caterpillar(); _t.add(c1); _t.add(c2); c1.start(); c2.start(); } } Constructor definition Method definition
Image of page 10
package lab2; public class EcoSystem { private example1.Terrarium _t; public EcoSystem() { _t = new example1.Terrarium(); } public void addTwoCaterpillars() { example1.Caterpillar c1 = new example1.Caterpillar(); example1.Caterpillar c2 = new example1.Caterpillar(); _t.add(c1); _t.add(c2); c1.start(); c2.start(); } } The scope of an instance  variable declaration is the  entire class body.
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern