Results 1 to 2 of 2

Thread: Reducing cost of programming to interfaces?

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Default Reducing cost of programming to interfaces?

    When I did a googlesearch for benefits of using the Spring framework, this bulletpoint comes up under the "Architectural Benefits"

    Spring can facilitate good programming practice by reducing the cost of programming to interfaces, rather than classes, almost to zero.
    Can someone please elaborate about this one? Interface vs. Classes?

    Thanks

  2. #2
    Join Date
    Jun 2010
    Posts
    2

    Default

    Quote Originally Posted by vhsjon View Post
    When I did a googlesearch for benefits of using the Spring framework, this bulletpoint comes up under the "Architectural Benefits"



    Can someone please elaborate about this one? Interface vs. Classes?

    Thanks
    So you must be pretty new to OO in general?
    One reason I would give is the fact that an Interface is like a 'Contract' and more then likely is the Contract you will use to code to. With an Interface it provides the rules of what a 'Class' must do/does.

    public interface Shape{
    void draw();
    }

    public class Rectangle implements Shape{
    public void draw(){
    //RECTANGLE Draw logic
    }
    }

    In the long run, it will also allow you to swap in and out implementations of that 'interface' for testing/prototyping engineering exercises that require you to get to Market ASAP.

    A class is the Implementation, as mentioned, its the Hard Coded version of the 'Contract'.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •