From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7ee10ec601726fbf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-15 13:35:30 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!drn From: Robert*@ Newsgroups: comp.lang.ada Subject: Re: is Ada dying? Date: 15 Oct 2001 13:03:22 -0700 Organization: Newsguy News Service [http://newsguy.com] Message-ID: <9qffea02r59@drn.newsguy.com> References: <3BC30674.BA88AAB6@brighton.ac.uk> <9pvv3t$ves$1@news.huji.ac.il> <9q42jo$lu8$1@news1.sunrise.ch> <9q95lm$b4l$1@news.huji.ac.il> <3bca9c74.1660187@news.demon.co.uk> <9qedg903km@drn.newsguy.com> <3bcb08bc.29380186@news.demon.co.uk> NNTP-Posting-Host: p-787.newsdawg.com X-Newsreader: Direct Read News 2.90 Xref: archiver1.google.com comp.lang.ada:14593 Date: 2001-10-15T13:03:22-07:00 List-Id: In article <3bcb08bc.29380186@news.demon.co.uk>, john.mccabe@emrad.com.nospam says... >I can understand that and, often, a record can be replaced by a Class >with no behavioural aspects (i.e. no methods). The problem is that the >overhead (possibly just in syntax) of a class can be a nuisance and >confuse the issue and, certainly in Java, there is no way to define >the representation of elements in a Class (unlike Ada with its very >powerful representation clauses). To me this shows a great difference >in the target audience of the languages, and their history. yes. In Java, if you have an empty class it will have a size of 24 bytes. a class which has nothing but an 'int' in it, is 32 bytes. A class with nothing in it but one String reference (null) is 50 bytes. So an object ref byitself uses 26 bytes overhead. So, you see, Java add a 'tag' information next to each field in the class (this is used by the reflection facility of the language, i.e. there is a field in the class that describes each other field). This tag field can be 4 bytes byitself (per field, for primitive fields) or more for class reference fields. (you need more info to describe a class than a primitive field). so it is clear you can't use Java as is to map it to a C or Ada type struct or record becuase of this overhead. that is why Java has serialization as a way to write the object out to disk and read it back and reconstruct it in memory as it was. Serliazation is also used to ship the object as is over the network as stream of bytes, and deserliazed on the other end to reconstruct it. This also ofcourse means that Java use for same sort of applications where ada representation clause is needed will be not practical to say the least, but I do not see Java being used for those types of applications (java programmers will look funny at you if you start talking about representation of records and stuff like this).