Java Interfaces
Design Perspective
Chennai Java Summit - 2013

Manigandan Venkataraman
shivamanik@gmail.com
Agenda
●

Application

●

Interface – What is an Interface

●

Components and Interface

●

Java Interface

●

Abstraction...
Applications
●

Applications that can grow
●

Plugins and Addons

●

Examples
–
–

●

Application should grow
–

●

Browse...
Interface
●

What is an INTERFACE

●

Tell me the interface for this room
●

Doors

●

Windows

●

Interfaces are nothing ...
Components
println

PrintWriter

Public Interfaces are API
sum(int,int)

MyCalculator
sub(int,int)

Component Interface = method signature + return type
Operation

WebService
operation
●

●

RMI – Stubs and
Skeletons
We need Remote
Interfaces to compile
the local code

●

●
...
Java Interface
●

A way to implement multiple inheritance

●

Interface is a collection of abstract methods
●

●

now, we ...
Abstraction
●

What does Abstract mean ???

●

I need to go to Mumbai – abstract statement
●

Whats missing
–
–
–

●

Mean...
Abstraction
●

Your College Project
●

Abstract - ????
–
–
–

●

Problem Statement
Solution
Whats missing - How ??? The Im...
Abstraction
●

An idea without Implementation

●

Why do we need it??
●

Object Oriented Design

Interfaces have abstract ...
Abstraction and Interfaces
●

Runnable Interface
●

<Code>

●

What it does

●

JVM has to deal with unknown code

●

Its ...
Design Patterns
●

Mixture of Abstract Classes and Interfaces

●

No logic, only provides a guideline/approach

●

Upto to...
Good Design Practices
●

Program to an interface , not to implementation
●
●

●

Spring Framework
Code can grow, more impl...
Thank You
Upcoming SlideShare
Loading in …5
×

Java interfaces design perspective

611 views
373 views

Published on

To make it simple - Java Interfaces are nothing but APIs, without implementation, as they are nothing but component interfaces. Using Interfaces in the design, one can achieve loose coupling, but declaring the component interfaces and vary the implementations

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
611
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java interfaces design perspective

  1. 1. Java Interfaces Design Perspective Chennai Java Summit - 2013 Manigandan Venkataraman shivamanik@gmail.com
  2. 2. Agenda ● Application ● Interface – What is an Interface ● Components and Interface ● Java Interface ● Abstraction & Interfaces ● Design Patterns ● Good Design Practices
  3. 3. Applications ● Applications that can grow ● Plugins and Addons ● Examples – – ● Application should grow – ● Browser - Firefox IDE – Eclipse, Netbeans Provide plugin/ addon design How to design such an application???
  4. 4. Interface ● What is an INTERFACE ● Tell me the interface for this room ● Doors ● Windows ● Interfaces are nothing but communication points ● How do you interface with your Bike or Car ● Interfaces to the Computer ● USB, HDMI, VGA , Serial Ports ● Will this device work with my computer????
  5. 5. Components println PrintWriter Public Interfaces are API
  6. 6. sum(int,int) MyCalculator sub(int,int) Component Interface = method signature + return type
  7. 7. Operation WebService operation ● ● RMI – Stubs and Skeletons We need Remote Interfaces to compile the local code ● ● Webservice endpoints are interfaces Only interface and NO LOGIC
  8. 8. Java Interface ● A way to implement multiple inheritance ● Interface is a collection of abstract methods ● ● now, we can have default implemented methods too .... :) All methods in an interface are public
  9. 9. Abstraction ● What does Abstract mean ??? ● I need to go to Mumbai – abstract statement ● Whats missing – – – ● Means of transport Date and time Budget I am travelling to Mumbai on Monday 7 am, by Indigo – Concrete Statement
  10. 10. Abstraction ● Your College Project ● Abstract - ???? – – – ● Problem Statement Solution Whats missing - How ??? The Implemention Where's the Implementation – The whole project is the Implementation !!!! ;)
  11. 11. Abstraction ● An idea without Implementation ● Why do we need it?? ● Object Oriented Design Interfaces have abstract methods
  12. 12. Abstraction and Interfaces ● Runnable Interface ● <Code> ● What it does ● JVM has to deal with unknown code ● Its not aware of Our Code ● Interface Design provides Loose Coupling ● Eclipse Rich Client Platform ● Netbeans Platform
  13. 13. Design Patterns ● Mixture of Abstract Classes and Interfaces ● No logic, only provides a guideline/approach ● Upto to programmer to write an implementation – logic
  14. 14. Good Design Practices ● Program to an interface , not to implementation ● ● ● Spring Framework Code can grow, more implementations clients remain unaware ● ● ● of the specific types of objects they use, as long as the object adheres to the interface of the classes that implement these objects; clients only know about the abstract class(es) defining the interface Use of an interface also leads to dynamic binding and polymorphism
  15. 15. Thank You

×