Re: "call to super must be first statement in constructor"

From: Paul Chapman (paul_at_igblan.free-online.co.uk)
Date: 02/07/05


Date: Mon, 7 Feb 2005 21:56:46 -0000

Mark,

> This sounds more like an interface than a subclass to me.

I'm starting to find out some weird things about Java -- well, they seem
weird to me. :)

One thing is that interface members must be public. This seems to me an
unnecessarily narrow use of interfaces. I started off using interfaces as a
way of "declaring" the methods that objects of other classes might want to
use. But that doesn't help define contracts between classes in the *same*
package.

The package seems to be too large a unit of subdomain development. Of
course, I come from Smalltalk, where everything is "public", so I shouldn't
worry.

Another thing was "protected", which I slowly discovered doesn't give any
"protection" within a package at all. Nor, for that matter, does "default"
access. What seems to be missing is C++'s idea of "protected", ie
accessible only within subclasses.

I am thinking about reorganizing my app into more, smaller packages, to
provide more compile-time protection from my own stupidity (and to increase
the extent to which contracts are self-documenting). But when I look at how
huge some of the standard API packages are, which have presumably been
written by expert Java programmers, I wonder if I'm missing something.

Cheers, Paul



Relevant Pages

  • Re: package and jar files
    ... > What is the difference between package and jar files and do you use them? ... The Java Tutorial describes jars, ... "A collection of related classes and interfaces providing access ...
    (comp.lang.java.programmer)
  • Re: Return flexible number of data structures
    ... Well we have far more COBOL programmers here than Java ones, ... COBOL is more maintainable. ... and a PrintJob and a Doc, all Interfaces in package javax.print (since java ...
    (comp.sys.ibm.as400.misc)
  • Re: Command-line arg
    ... Throughout this book we refer to classes and interfaces drawn from the Java and Java 2 platforms. ... Whenever we refer to a class or interface which is not defined in an example in this book using a single identifier N, the intended reference is to the class or interface named N in the package java.lang. ...
    (comp.lang.java.programmer)
  • Re: UML - Modeling Interfaces in "complex" systems
    ... So we modeled ERP, PBS and APBS as 3 Packages ... I can buy APBS as a package since it will be third party software. ... In a Component Diagram you can provide associations between the subsystems and the Interfaces to indicate which interfaces are paired with which subsystems. ...
    (comp.object)
  • Re: Is this the DIP confusion?
    ... > implementation package? ... The dependency referred to by the DIP is usage dependency, ... You DIP when you create the interfaces and use them instead ... and have the functionality providers expose ...
    (comp.object)