Author Topic: Class attribute and LET GET pair  (Read 2657 times)

Miroslav Fris

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
  • That's me!
    • View Profile
Class attribute and LET GET pair
« on: August 11, 2002, 01:44:02 pm »
I am still looking for the optimal way to document VB classes and I am not able to do:

1. Aproach
For a property of a class I enter one private attribute and 2 LET GET public operations. It exactly describes the class and it enables to use code generation/ reverse engineering. But it is very hard to read class's interface especially when the class have many such  attributes.

2. Approach.
Write just one public atribute a describe the directions OUT or/and IN and describe it as a whole. It is much more readable, but it disables the use of code generation.

I am beginner with EA, so my question is:

Is there any possibilities to see the trio "attribute and LET GET operation" as one entity and to describe it as one entitity still having possibilities to generate code ??

Thank you

Rene

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Class attribute and LET GET pair
« Reply #1 on: August 12, 2002, 06:50:44 am »
Wouldn't want it any other way! Since the three are completely unrelated  ;D (well not entirely - they are associated).

As an example, I have a property ComPort and a private variable mComPort (which, you guessed it, stands for the serial port over which communication takes place). mComPort only holds a non-zero value if the port is actually open. The property get ComPort returns either the ComPort that was configured (through other means) or, if the port is open, the port that is actually being used. The property let Comport always configures the comport and if the port is currently open, it closes it and reopens the new port. As you can see each has different behavior and should therefore be described differently.

Now what would be nice is some nice method to quickly glance over the association of this triplet.

Miroslav Fris

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
  • That's me!
    • View Profile
Re: Class attribute and LET GET pair
« Reply #2 on: August 12, 2002, 10:17:46 pm »
Yes, of course, I understand, that LET GET is interface for the attribute and can have code and own behaviour.
What I want is to have two views.
One view is each of this triplet described separately if this is required - like in your example.
The second view is to see it as one entity. Imagine you have class Person, which can have tens of attributes and LET GET pairs for those attributes. The behavior of the LET GET is simple - just to pass the info to the attribute and sometimes to manage the info (E.G. limit number of chars, UPPERCASE etc.).


Someone can say - make the attributes Public without LET GET,but this is not good practise in OOP design and I am trying to keep this basic rule of OOP - encapsulation of attributes and beahaviour of the object.

In the current version of EA - Where would you recommend to document the attribute - the purpose of it and how it is managed. To be exact I would have to place the notes in all three parts - but, if you come to this  model after half a year you have to go over three separate notes to understand purpose and behaviour of one entity.
And what more, the field for attribute note is very narrow.