Page 1 of 7 1234 ... LastLast
Results 1 to 10 of 70
  1. #1

    Default Interfaces in Object Oriented Programming


    What is the advantages of using interfaces?
    What's the difference between defining methods in your classes and with having interfaces, diba ma doble2x naka ug declare?

  2. #2
    Quote Originally Posted by Tin_Tin View Post
    What is the advantages of using interfaces?
    What's the difference between defining methods in your classes and with having interfaces, diba ma doble2x naka ug declare?
    Do some research on the uses of interfaces. Suppose you are referring to Java language, I can share to you few sources:

    Interface (Java) - Wikipedia, the free encyclopedia

    Java: Advantages of Interfaces | Ben Pryor’s blog

  3. #3
    try researching about oop concepts... you'll learn more of the advantages of interfaces...

  4. #4
    I ask you what are the advantages, then you tell me to go research.... Let's put it this way, to all of you who have implemented interfaces in real world projects, can you please explain what advantage can we obtain when we use interfaces instead of just declaring methods in our classes irregardless of what programming language you are using.
    Last edited by Tin_Tin; 02-19-2011 at 11:28 PM.

  5. #5
    Quote Originally Posted by Tin_Tin View Post
    I ask you what are the advantages, then you tell me to go research.... Let's put it this way, to all of you who have implemented interfaces in real world projects, can you please explain what advantage can we obtain when we use interfaces instead of just declaring methods in our classes irregardless of what programming language you are using.

    Makita nimu ang tanang advantages if you do some research. A simple google will do.

    Again, the answers are here:

    Interface (Java) - Wikipedia, the free encyclopedia

    Java: Advantages of Interfaces | Ben Pryor’s blog

  6. #6
    if you understand Object Oriented concepts such as polymorphism and even abstraction, you can fully understand the use of interfaces.

    One important use: Flexibility

    for example;
    - to do graphics for my game, i can abstract the rendering by using interface.
    I can declare an interface for my renderer and the application will not worry how the graphics are handled.
    the graphics can be rendered by either GDI or SDLor any renderer

    example:
    interface IGraphics
    {
    void DrawLine();
    void DrawCircle();
    ...
    }

    class GDIGraphics extends IGraphics
    {
    //do rendering using GDI
    }
    or
    class SDLGraphics extends IGraphics
    {
    //do rendering using SDL
    }

    and my application layer wont care how the rendering is being done.
    if i want to use pure GDI then i just

    void Initialize()
    {
    IGraphics* gfx = new GDIGraphics; //use GDI
    }
    ...

    void DrawObjects(IGraphics* gfx)
    {
    gfx->DrawCircle();
    }

    As you can observed, you have a very flexible code. If you want to use the SDL in the above code, you only change the initialization part,

    the above example is just one of the manny application for using interfaces classes.

    you cant write a good java or c++ (or any object oriented language) program without utilizing abstract classes and/or interfaces.
    Last edited by cebugdev; 02-20-2011 at 07:28 PM.

  7. #7
    So more on sa design/architecture sa imong program na siya. Sa OOP kani ra gyung interfaces ang akong wala jud nasabtan sukad pa pag college.

  8. #8

    Default Re: Interfaces in Object Oriented Programming

    Quote Originally Posted by Tin_Tin View Post
    So more on sa design/architecture sa imong program na siya. Sa OOP kani ra gyung interfaces ang akong wala jud nasabtan sukad pa pag college.
    Yep.. ma-consider rapud nimo as design/architecture ang Interfaces. But more on polymorphism gud ni ang interfaces.

    MakaEncounter ka ani if magDeal naka og different objects (internal or external) but same ra ang methods(& same signature) ang imo iCall.
    By using interface, no need na nga iIdentify pa nimo cla unsa cla nga type of object.

    NakaAppreciate ko aning interface atong nagDev mi og plugin-based system.

    refer sa example ni cebugdev, bali mao gud na xa ang concept sa interfaces.

  9. #9

    Default Re: Interfaces in Object Oriented Programming

    To illustrate the use of interfaces is this.

    Suppose you have these classes: ClassA, ClassB, and ClassC and all have methods: show(), display(), and retrieve() respectively. You can use an interface on your superclass (say ClassZ) to implement the same methods such as this, because show, display, and retrieve act the same thing.

  10. #10

    Default Re: Interfaces in Object Oriented Programming

    Try review / research on design patterns bai, ma appreciate jd nmo dre how to use interface.

  11.    Advertisement

Page 1 of 7 1234 ... LastLast

Similar Threads

 
  1. Object Oriented Programming
    By poymode in forum Programming
    Replies: 31
    Last Post: 09-02-2011, 10:21 AM
  2. Your opinion regarding Josh Hartnett interview in ABC's program
    By epardz_azia in forum General Discussions
    Replies: 7
    Last Post: 03-24-2009, 10:20 PM
  3. 3 killed in Negros Oriental clash
    By radiostar in forum Politics & Current Events
    Replies: 7
    Last Post: 09-22-2008, 11:32 PM
  4. C/C++ i need help in making a program
    By mE_bytes in forum Programming
    Replies: 54
    Last Post: 07-30-2008, 05:41 PM
  5. Need help in Installing Java programs in my Samsung D880
    By Soj in forum Software & Games (Old)
    Replies: 0
    Last Post: 04-24-2008, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top