SlideShare a Scribd company logo
1 of 13
Extra Discussion – Interface vs. Class

● An

interface is a
collection of abstract
methods

● An

interface contains
behaviors
that
a
class implements

●A

class
implements
an interface, thereby
inheriting the abstract
methods of the interface
● A class describes the
attributes and behaviors
of an object

● Unless the class that implements the interface is
abstract, all the methods of the interface need to
be defined in the class

1
Extra Discussion – Interface vs. Class

● SIMILARITY

● An

interface can contain any number of
methods.
● An interface is written in a file with
a .java extension, with the name of
the interface matching the name of the file.
● The bytecode of an interface appears in
a .class file.
● Interfaces appear in packages, and their
corresponding bytecode file must be in a
directory structure that matches the package
name.
2
Extra Discussion – Interface vs. Class

● DIFFERENCE

● You cannot instantiate an interface.
● An interface does not contain any constructors.
● All of the methods in an interface are abstract.
● An interface cannot contain instance fields.
The only fields that can appear in
an interface must be declared both static and
final.
● An interface is not extended by a class; it is
implemented by a class.
● An interface can extend multiple interfaces.
3
Extra Discussion – Interface vs. Class

● Declaring Interfaces

● Interfaces have the following properties:
● An interface is implicitly abstract. You do not need to use
the abstract keyword when declaring an interface.
● Each method in an interface is also implicitly abstract, so the
abstract keyword is not needed.
● Methods in an interface are implicitly public.

● Example:

/* File name : Animal.java */
interface Animal {
public void eat();
public void travel();
}
4
Extra Discussion – Interface vs. Class

● Implementing Interfaces
●

●

A class uses the implements keyword to implement an interface. The
implements keyword appears in the class declaration following the
extends portion of the declaration.
Example:
/* File name : MammalInt.java */
public class MammalInt implements Animal{
public void eat(){
System.out.println("Mammal eats");
}
public void travel(){
System.out.println("Mammal travels");
}
public int noOfLegs(){
return 0;
}
public static void main(String args[]){
MammalInt m = new MammalInt();
m.eat();
m.travel();
}
}

5
UML Diagram

Diagram II
Use Case Diagram
● What is Actor? Use Case?
● Use Case Diagram elements

6
Use Case Diagram

●A

use case diagram is used to visualize high level
functions or requirements of a system, i.e., what a system
is supposed to do (but not how to do).
● A use case diagram contains primarily actors and use
cases. Actors are entities that interact with the system,
while use cases are a means for capturing the
requirements of a system.
● A use case diagram is a specialization of Class Diagram
such that the classifiers shown are restricted to being
either Actors or Use Cases

7
Use Case Diagram elements

● Actor

● An

actor models a type of role played by an entity,
e.g., a user or any other system, that interacts with the
system.
● An actor is external to the system.
● An actor icon may represent roles played by human
users, external hardware, or other systems.
● Notation: An actor is represented by “stick man”
icon with the name of the actor below the icon.

8
Use Case Diagram elements

● Use Case
●

A use case is the specification of a set of actions
performed by a system, which result in value for one or
more actors of the system.
● A use case icon represent the actions performed by
one or more actors in the pursuit of a particular goal.
● Notation: A use case is shown as an ellipse
containing the name of the use case. An optional
stereotype keyword may be placed above the name

9
Use Case Diagram elements

● Relationship
●

Association
● An association indicates that an actor takes part in
this use case.
Notation: An association relationship between an
actor and a use case is shown by a solid
line, i.e., a binary arrow.
● Dependency
● A dependency indicates that the design of the
source depends on the design of the target.
Notation: An dependency relationship between
use cases is shown by a dashed arrow. The arrow
may be labeled with an optional stereotype
keyword.
10
Use Case Diagram elements

● Relationship

● Dependency
● Extend relationship
specify that one use case (extension) extends the
behavior of another use case (base)

11
Use Case Diagram elements

● Relationship

● Dependency
● Include relationship
one use case (the base use case) includes the
functionality of another use case (the inclusion use
case)

12
Use Case Diagram elements

13

More Related Content

What's hot

8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces Tuan Ngo
 
Javainterface
Javainterface Javainterface
Javainterface prakash GB
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classesShreyans Pathak
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMAmr E. Mohamed
 
Interfaces and abstract classes
Interfaces and abstract classesInterfaces and abstract classes
Interfaces and abstract classesAKANSH SINGHAL
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAhmed Nobi
 
What are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaWhat are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaEdureka!
 
8abstact class in c#
8abstact class in c#8abstact class in c#
8abstact class in c#Sireesh K
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Patterneprafulla
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Jamshid Hashimi
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaMOHIT AGARWAL
 
Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Jamshid Hashimi
 

What's hot (20)

8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces
 
interface in c#
interface in c#interface in c#
interface in c#
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Interface
InterfaceInterface
Interface
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Javainterface
Javainterface Javainterface
Javainterface
 
javainterface
javainterfacejavainterface
javainterface
 
Oop
OopOop
Oop
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
SE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAMSE_Lec 07_UML CLASS DIAGRAM
SE_Lec 07_UML CLASS DIAGRAM
 
Interfaces and abstract classes
Interfaces and abstract classesInterfaces and abstract classes
Interfaces and abstract classes
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
 
What are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaWhat are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | Edureka
 
8abstact class in c#
8abstact class in c#8abstact class in c#
8abstact class in c#
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
 
Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
 

Viewers also liked

Viewers also liked (20)

Bai giang-spm-16jan14
Bai giang-spm-16jan14Bai giang-spm-16jan14
Bai giang-spm-16jan14
 
Bai giang-se-16jan14
Bai giang-se-16jan14Bai giang-se-16jan14
Bai giang-se-16jan14
 
Bai giang-se-10feb14
Bai giang-se-10feb14Bai giang-se-10feb14
Bai giang-se-10feb14
 
Bai giang-spm-20feb14
Bai giang-spm-20feb14Bai giang-spm-20feb14
Bai giang-spm-20feb14
 
Bai giang-se-20feb14
Bai giang-se-20feb14Bai giang-se-20feb14
Bai giang-se-20feb14
 
Bai giang-uml-18feb14
Bai giang-uml-18feb14Bai giang-uml-18feb14
Bai giang-uml-18feb14
 
Bai giang-se-27feb14
Bai giang-se-27feb14Bai giang-se-27feb14
Bai giang-se-27feb14
 
Bai giang-se-06mar14
Bai giang-se-06mar14Bai giang-se-06mar14
Bai giang-se-06mar14
 
Bai giang-se-03mar14
Bai giang-se-03mar14Bai giang-se-03mar14
Bai giang-se-03mar14
 
Bai giang-uml-25-27feb14
Bai giang-uml-25-27feb14Bai giang-uml-25-27feb14
Bai giang-uml-25-27feb14
 
Bai giang-spm-06mar14
Bai giang-spm-06mar14Bai giang-spm-06mar14
Bai giang-spm-06mar14
 
Bai giang-spm-11mar14
Bai giang-spm-11mar14Bai giang-spm-11mar14
Bai giang-spm-11mar14
 
Bao tri-phan-mem-for-56 pm
Bao tri-phan-mem-for-56 pmBao tri-phan-mem-for-56 pm
Bao tri-phan-mem-for-56 pm
 
Bai giang-se-24feb14
Bai giang-se-24feb14Bai giang-se-24feb14
Bai giang-se-24feb14
 
Bai giang-se-13jan14
Bai giang-se-13jan14Bai giang-se-13jan14
Bai giang-se-13jan14
 
Bai giang-se-17feb14
Bai giang-se-17feb14Bai giang-se-17feb14
Bai giang-se-17feb14
 
Bai giang-uml-14jan14
Bai giang-uml-14jan14Bai giang-uml-14jan14
Bai giang-uml-14jan14
 
Bai giang-se-20jan14
Bai giang-se-20jan14Bai giang-se-20jan14
Bai giang-se-20jan14
 
Bai giang-spm-13feb14
Bai giang-spm-13feb14Bai giang-spm-13feb14
Bai giang-spm-13feb14
 
Bai giang-se-13feb14
Bai giang-se-13feb14Bai giang-se-13feb14
Bai giang-se-13feb14
 

Similar to Bai giang-uml-11feb14

Lecture 3 cst205 cst281-oop
Lecture 3 cst205 cst281-oopLecture 3 cst205 cst281-oop
Lecture 3 cst205 cst281-oopktuonlinenotes
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.pptVISHNUSHANKARSINGH3
 
Lecture 4-oop class diagram
Lecture 4-oop class diagramLecture 4-oop class diagram
Lecture 4-oop class diagramktuonlinenotes
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxssuser84e52e
 
Advanced Structural Modeling
Advanced Structural ModelingAdvanced Structural Modeling
Advanced Structural ModelingAMITJain879
 
Java - Interfaces & Packages
Java - Interfaces & PackagesJava - Interfaces & Packages
Java - Interfaces & PackagesArindam Ghosh
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Professor Lili Saghafi
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questionsgokul174578
 
Interface in Java
Interface in JavaInterface in Java
Interface in JavaDucat India
 
Design Patterns Part1
Design Patterns  Part1Design Patterns  Part1
Design Patterns Part1Tom Chen
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 

Similar to Bai giang-uml-11feb14 (20)

Lecture 3 cst205 cst281-oop
Lecture 3 cst205 cst281-oopLecture 3 cst205 cst281-oop
Lecture 3 cst205 cst281-oop
 
12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt12.2 Abstract class and Interface.ppt
12.2 Abstract class and Interface.ppt
 
Lecture 4-oop class diagram
Lecture 4-oop class diagramLecture 4-oop class diagram
Lecture 4-oop class diagram
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
OOFeatures_revised-2.pptx
OOFeatures_revised-2.pptxOOFeatures_revised-2.pptx
OOFeatures_revised-2.pptx
 
Advanced Structural Modeling
Advanced Structural ModelingAdvanced Structural Modeling
Advanced Structural Modeling
 
Java - Interfaces & Packages
Java - Interfaces & PackagesJava - Interfaces & Packages
Java - Interfaces & Packages
 
The smartpath information systems java
The smartpath information systems javaThe smartpath information systems java
The smartpath information systems java
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)
 
14274730 (1).ppt
14274730 (1).ppt14274730 (1).ppt
14274730 (1).ppt
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Interface in Java
Interface in JavaInterface in Java
Interface in Java
 
Design Patterns Part1
Design Patterns  Part1Design Patterns  Part1
Design Patterns Part1
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
java.pptx
java.pptxjava.pptx
java.pptx
 
Interface &packages
Interface &packagesInterface &packages
Interface &packages
 
C# concepts
C# conceptsC# concepts
C# concepts
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 

Recently uploaded

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 

Recently uploaded (20)

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 

Bai giang-uml-11feb14

  • 1. Extra Discussion – Interface vs. Class ● An interface is a collection of abstract methods ● An interface contains behaviors that a class implements ●A class implements an interface, thereby inheriting the abstract methods of the interface ● A class describes the attributes and behaviors of an object ● Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class 1
  • 2. Extra Discussion – Interface vs. Class ● SIMILARITY ● An interface can contain any number of methods. ● An interface is written in a file with a .java extension, with the name of the interface matching the name of the file. ● The bytecode of an interface appears in a .class file. ● Interfaces appear in packages, and their corresponding bytecode file must be in a directory structure that matches the package name. 2
  • 3. Extra Discussion – Interface vs. Class ● DIFFERENCE ● You cannot instantiate an interface. ● An interface does not contain any constructors. ● All of the methods in an interface are abstract. ● An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final. ● An interface is not extended by a class; it is implemented by a class. ● An interface can extend multiple interfaces. 3
  • 4. Extra Discussion – Interface vs. Class ● Declaring Interfaces ● Interfaces have the following properties: ● An interface is implicitly abstract. You do not need to use the abstract keyword when declaring an interface. ● Each method in an interface is also implicitly abstract, so the abstract keyword is not needed. ● Methods in an interface are implicitly public. ● Example: /* File name : Animal.java */ interface Animal { public void eat(); public void travel(); } 4
  • 5. Extra Discussion – Interface vs. Class ● Implementing Interfaces ● ● A class uses the implements keyword to implement an interface. The implements keyword appears in the class declaration following the extends portion of the declaration. Example: /* File name : MammalInt.java */ public class MammalInt implements Animal{ public void eat(){ System.out.println("Mammal eats"); } public void travel(){ System.out.println("Mammal travels"); } public int noOfLegs(){ return 0; } public static void main(String args[]){ MammalInt m = new MammalInt(); m.eat(); m.travel(); } } 5
  • 6. UML Diagram Diagram II Use Case Diagram ● What is Actor? Use Case? ● Use Case Diagram elements 6
  • 7. Use Case Diagram ●A use case diagram is used to visualize high level functions or requirements of a system, i.e., what a system is supposed to do (but not how to do). ● A use case diagram contains primarily actors and use cases. Actors are entities that interact with the system, while use cases are a means for capturing the requirements of a system. ● A use case diagram is a specialization of Class Diagram such that the classifiers shown are restricted to being either Actors or Use Cases 7
  • 8. Use Case Diagram elements ● Actor ● An actor models a type of role played by an entity, e.g., a user or any other system, that interacts with the system. ● An actor is external to the system. ● An actor icon may represent roles played by human users, external hardware, or other systems. ● Notation: An actor is represented by “stick man” icon with the name of the actor below the icon. 8
  • 9. Use Case Diagram elements ● Use Case ● A use case is the specification of a set of actions performed by a system, which result in value for one or more actors of the system. ● A use case icon represent the actions performed by one or more actors in the pursuit of a particular goal. ● Notation: A use case is shown as an ellipse containing the name of the use case. An optional stereotype keyword may be placed above the name 9
  • 10. Use Case Diagram elements ● Relationship ● Association ● An association indicates that an actor takes part in this use case. Notation: An association relationship between an actor and a use case is shown by a solid line, i.e., a binary arrow. ● Dependency ● A dependency indicates that the design of the source depends on the design of the target. Notation: An dependency relationship between use cases is shown by a dashed arrow. The arrow may be labeled with an optional stereotype keyword. 10
  • 11. Use Case Diagram elements ● Relationship ● Dependency ● Extend relationship specify that one use case (extension) extends the behavior of another use case (base) 11
  • 12. Use Case Diagram elements ● Relationship ● Dependency ● Include relationship one use case (the base use case) includes the functionality of another use case (the inclusion use case) 12
  • 13. Use Case Diagram elements 13