VMWare Inc Interview Question for Software Engineer / Developers


Team: Cloud Resource Management
Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
1
of 1 vote

Interfaces help in creating a loosely coupled code. how?
ok here it goes
consider this

/// is this what you use interface for. sorry dude its of no use.
IMyInterface myObject=new MyImplementation();
//so what to do for loose coupling
IMyinterface myObject= SomeFactory.getMyObject("someParam");
//as you this this class is aware of only the interface and the factory and not of the actual //implementing class.
//same can be acheived by dependency injection.

- Gagan Suri February 08, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

It's not just for factory methods, though surely those could return interfaces at times. It's for any situation where you wish to present a certain view of a certain category of classes. For instance, consider a KeyListener interface. This interface can be implemented by any class wishing to process keystrokes. It presents a view of such classes that only involves the methods that are related to processing keys. That is, when you look at a KeyListener object, all you know is that this object can call keyPressed(), keyReleased(), etc. -- in short, you're just seeing that one aspect of the object that is related to keystrokes. All other info has been abstracted away -- you're not seeing all the unrelated functionality that object may have (perhaps its core functionality, the keyboard input being a minor aspect).

- eugene.yarovoi February 08, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Interfaces define a common contract for unrelated classes that can extend some other classes and inherit behavior apart from the behavior they already have inherited from interfaces. When the design decisions are very dynamic and lot of frequent changes are to be accomodated in future, interfaces are more efficient than classes. Even Gang of Four recommends using interfaces.

- taojfew February 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

coool

- chandan March 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

- Interfaces are used for writing extensible code, when you modify an implementation of an interface, you ensure that this change will not effect the system because only the implementation has changed but not the contract, so when you really need to modify the implementations without really affecting how the application uses it, you use interfaces.
- And usually it is a good practice to write interfaces because they also help you in Mocking and unit testing of your code.
- It is also a good practice to ensure that you set the implementations of interfaces in your application using setter methods because that ensures more ways to mock your objects and helps in loose coupling.

- Dev February 10, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Interfaces, in general define a contract which the implementing classes should be using. The best use of interfaces can be seen in the Collections API.

e.g The List<E> interface defines methods like get(), set(), add() ... which are generalised operations on List. The implementing classes like ArrayList, Vector give meaning(definitions) to these contracts.

The other advantage of using interfaces are parameterized polymorphism. It gives you the flexibility to bind the "type" of parameters to functions at run time.

- Chander Shivdasani February 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the main use of interfacte is

1) to get polymorphism &dynamic binding
2) interface with composition(ie interface implementation and it's equivalent to inheritence implementation)
3) finally multiple inheritence

- nameless March 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Here i'm giving few real usage of/ reason behind Interface

1>Extensibility /flexibility ( for designing point of view)
http:--java.sys-con.com--node--36250

2> We can achieve more polymorphism than using class/abstract polymorphism

www--artima.com--designtechniques--interfaces3.html#getting

3> we can implement inheritance using interface with composition

4> Implementing design patterns and finally Multiple inheritance and no diamond problem

- Nameless June 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

interface is a contract between third party vendor and the programmer.

- yaser March 27, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More