Click here to Skip to main content
15,909,051 members
Home / Discussions / Java
   

Java

 
GeneralRe: Thorwing Exception to the calling function from other class Pin
muhammed_k2-Aug-12 21:19
muhammed_k2-Aug-12 21:19 
GeneralRe: Thorwing Exception to the calling function from other class Pin
Nagy Vilmos2-Aug-12 21:48
professionalNagy Vilmos2-Aug-12 21:48 
GeneralRe: Thorwing Exception to the calling function from other class Pin
muhammed_k2-Aug-12 21:55
muhammed_k2-Aug-12 21:55 
Questionaccess data stored in hashset java Pin
ahmadiss31-Jul-12 1:56
ahmadiss31-Jul-12 1:56 
Questionerror when run project jsf2.0 Pin
ahmadiss30-Jul-12 7:14
ahmadiss30-Jul-12 7:14 
AnswerRe: error when run project jsf2.0 Pin
Nagy Vilmos30-Jul-12 23:50
professionalNagy Vilmos30-Jul-12 23:50 
QuestionDesigning to interfaces? Pin
Neo1010129-Jul-12 9:52
Neo1010129-Jul-12 9:52 
AnswerRe: Designing to interfaces? Pin
BobJanova29-Jul-12 23:01
BobJanova29-Jul-12 23:01 
Composition allows you to switch the internal implementation of an interface easily. In your example you can easily change A so that it delegates to a new class X instead of B, and the client code won't notice (not even to change a new A() to new X(), or a DI container registration, as with inheritance). You can even write A so that it chooses a different internal implementation class at runtime (for example a file access wrapper which uses a local disk mapper, a memory mapper or a network resource mapper depending on what is passed to a constructor).

Unlike an inherited solution, the class B is totally decoupled from the class which uses A. B can be package-visible, if it's in the same package as A (in .Net it can and probably should be internal).

B won't be decoupled from A as long as A contains a 'new B()' type statement. You can, of course, use the normal interface and DI or factory mechanisms to decouple them, but you have to ask yourself what the purpose of that is, considering that A itself is already little more than a decoupling wrapper class (decoupling B from the outside world).

If you find that a method on an interface isn't used any more, if you're using a decent IDE you can chase down all the implementations in subclasses and remove them as well. Alternatively, if you use @Override annotations, when you remove the interface method, the implementers' methods with @Override will cause a compilation failure (because they're now not overriding anything) and you can go and delete them.
GeneralRe: Designing to interfaces? Pin
Neo1010129-Jul-12 23:48
Neo1010129-Jul-12 23:48 
GeneralRe: Designing to interfaces? Pin
BobJanova30-Jul-12 0:13
BobJanova30-Jul-12 0:13 
AnswerRe: Designing to interfaces? Pin
jschell30-Jul-12 5:54
jschell30-Jul-12 5:54 
Questionhow to convert java code to c# code Pin
LAPEC25-Jul-12 12:55
LAPEC25-Jul-12 12:55 
AnswerRe: how to convert java code to c# code Pin
Paul Conrad25-Jul-12 17:02
professionalPaul Conrad25-Jul-12 17:02 
GeneralRe: how to convert java code to c# code Pin
jschell27-Jul-12 12:04
jschell27-Jul-12 12:04 
GeneralRe: how to convert java code to c# code Pin
Paul Conrad27-Jul-12 14:00
professionalPaul Conrad27-Jul-12 14:00 
AnswerRe: how to convert java code to c# code Pin
BobJanova29-Jul-12 22:44
BobJanova29-Jul-12 22:44 
GeneralRe: how to convert java code to c# code Pin
kianfong27-Sep-12 21:26
kianfong27-Sep-12 21:26 
QuestionNEED GOOD JSF VIDEO TUTORIAL Pin
Gaurav Sharma from Bangalore, India24-Jul-12 20:41
Gaurav Sharma from Bangalore, India24-Jul-12 20:41 
AnswerRe: NEED GOOD JSF VIDEO TUTORIAL Pin
TorstenH.24-Jul-12 22:00
TorstenH.24-Jul-12 22:00 
AnswerRe: NEED GOOD JSF VIDEO TUTORIAL Pin
Richard MacCutchan24-Jul-12 22:38
mveRichard MacCutchan24-Jul-12 22:38 
GeneralRe: NEED GOOD JSF VIDEO TUTORIAL Pin
Neo1010129-Jul-12 10:08
Neo1010129-Jul-12 10:08 
QuestionHow can I call doGet method? Pin
Nuha IT24-Jul-12 12:34
Nuha IT24-Jul-12 12:34 
AnswerRe: How can I call doGet method? Pin
Richard MacCutchan24-Jul-12 22:36
mveRichard MacCutchan24-Jul-12 22:36 
AnswerRe: How can I call doGet method? Pin
Andrei Straut25-Jul-12 9:34
Andrei Straut25-Jul-12 9:34 
QuestionHow to parse this XML by using SAX parser, I have no idea about parsing...Plzzz Help Me Pin
Gaurav Sharma from Bangalore, India24-Jul-12 7:30
Gaurav Sharma from Bangalore, India24-Jul-12 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.