Hi Chriss... I didn�t read Bruce Eckels Book, so I don�t know how inflexible is he about the use of interfaces...
But... You don't have to look on Interfaces like super-classes. You have to look to Interfaces, like plug-ins. Looking at the example which you give us.... java.sql.* is all based on interfaces (except java.sql.DriverManager). The DriverManager (as the name says), will manage which implementation will we use, to connect on a specific Database... This way, when you need to Connect Oracle, DriverManager will return an implementation of CallableStament which will care about Oracle Store Procedures (Java or PL-SQL). Using polimorfism here, you can implement a lot of Classes, calling JDBC whithout know what kind of Database they will need to use. You can produce your own Interface, to act as plugins between classes, adding functionality dinamically... Using the same Idea, you can produce Listeners which will hear events between classes. (You can also look at this as plug-ins)... Well... Let me know if I could help you... Regards.... Clebert Suconic ----- Original Message ----- From: Chris Adams To: EJB GROUP Sent: Thursday, February 21, 2002 12:02 PM Subject: [enterprise-list] Interfaces (English) For those out there who know English - I'd like your opinion... This is more a Java question than EJB, but relevant nonetheless... If you are familiar with Bruce Eckel's Java Bible (http://www.mindview.net) Thinking in Java - you'll notice that he is quite adamant about the use of interfaces as a contract for those who implement it - and that it doesn't carry any implementation. Its purpose is to manage new subclasses and stating to the world that if you implement an interface, you will have at least your own implementation of those interface methods. THis, of course, is the mechanism that gives us the power of dynamic binding. Given this... I was digging through the java.sql.* package and found several classes - INTERFACES - that HAVE implementation defined. java.sql.callableStatement for example. I can understand we would want to override methods in callableStatement if we want to make our own subclass of it ...but I would expect this to be a normal class and then I would extend it with my own. More so, I didn't think you could even compile a class defined as an interface if it contained method implementation. Going to start some of my own tests now to prove this, but anyone know why CallableStatement and others would be interfaces rather than normal classes. And is this more common than I thought? Thanks, Chris --------------------------------------------------------------------- Para cancelar a subscri��o, envie mensagem para: [EMAIL PROTECTED] Para comandos adicionais, envie mensagem para: [EMAIL PROTECTED]
