The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Annotations are great ! Really ?

Good post on the java endgame in metaprogramming.

And there is no way that in 6/7 years we will end up coding this:


class Animal extends Creature (

@SequenceGenerator(name='ANIMAL_SEQ', allocationSize=25)
@GeneratedValue(strategy=SEQUENCE, generator='ANIM_SEQ')
@Column(name='ANIM_ID') private String id
private Owner owner

static void deprecatedMethod() (...)

Hay getPreferredFood() (...)

void intercepts (...)

@PreDestroy void useDeprecatedMethod() {...}

son of parnas
Friday, July 21, 2006
Well, .NET has had attributes from the beginning, so there's almost six years, and, no, most .NET code doesn't look like that so Java should probably be safe.
SomeBody Send private email
Friday, July 21, 2006
And his example is very misleading.  A few lines of attributes/annotations don't look so bad taken in the context of full source code and not with big chunks of code replaced by "{...}".
SomeBody Send private email
Friday, July 21, 2006
If not abused they could be useful. I would like to see some Vault like features implemented with annotations.


interface IO {
  type FILE;
  tracked($F) FILE open_read(string)  [ new $F @ readable ];
  tracked($F) FILE open_write(string) [ new $F @ writable ];
  char read (tracked($F) FILE)        [ $F @ readable ];
  void write (tracked($F) FILE, char) [ $F @ writable ];
  void close (tracked($F) FILE)      [ -$F @ _ ];

with Java annotations

interface IO {
  @after( assert($return instanceof FileInputStream) )
  InputStream open_read(String name);

  @after( assert($return instanceof FileOutputStream) )
  OutputStream open_write(String name);

  @before( assert($1 != null && $1 instanceof FileInputStream) )
  void write(InputStream f, char value);

  @before( assert($1 != null && $1 instanceof FileOutputStream) )
  char read(OutputStream f);

  @after( assert($1.isClosed() )
  void close(Stream f);
Dino Send private email
Tuesday, July 25, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz