Menu

#7 Check design

open
nobody
New classes (2)
5
2004-04-14
2004-03-28
No

1. I propose that all protected class attributes should be made private. Some of them are accessible by public methods. Would you like to add some inline get and set methods?
Example:
http://wefts.sourceforge.net/wefts-apidoc-0.99b/classWefts_1_1Thread.html

2. How do you think about to extract most public interfaces into abstract base classes?
Example:
http://zthread.sourceforge.net/html/hierarchy.html
http://www.refactoring.com/catalog/extractInterface.html

3. Should the exception "Wefts::InitError" (RingBuffer constructor) by "std::out_of_range" or "std::range_error"?
Do you catch the exception "std::bad_alloc"?

4. Would you like to offer factory classes?
http://industriallogic.com/xp/refactoring/creationWithFactory.html
http://industriallogic.com/xp/refactoring/classesWithFactory.html
http://www.refactoring.com/catalog/replaceConstructorWithFactoryMethod.html

Discussion

  • Giancarlo Niccolai

    • status: open --> closed
     
  • Giancarlo Niccolai

    Logged In: YES
    user_id=360482

    1) No because some of them just must not be published, but
    made accessible to the subclasses.
    2) why?
    3) no. If the calling program wishes it may catch those error
    by itself; doing it in wefts would just add more unseen and
    uncontrolled code and hide some informations that the calling
    program may be willing to access, or (equally wrong) treat
    some informations that the calling program would not desire
    to manage at all.

    4. Again, why? If the target application is wishing to create a
    thread factory, it can do it in no more than 3 lines, and it can
    do it with it's own specific settings. Generally, factory driven
    creation should be taken at application level, not at library
    level.

     
  • Markus Elfring

    Markus Elfring - 2004-04-14

    Logged In: YES
    user_id=572001

    2. It is a design pattern.
    You need only to reference the public interface of a class to
    do something useful.
    Example: STL containers

    4. Some objects might be created so often that it is more
    convenient and safer that their creation is a service of the
    library.

     
  • Markus Elfring

    Markus Elfring - 2004-04-14
    • status: closed --> open
     
  • Markus Elfring

    Markus Elfring - 2004-04-14

    Logged In: YES
    user_id=572001

    3. Can a bad_alloc exception "escape" from your own code
    because an internal data structure is allocated with "new"?

     
  • Markus Elfring

    Markus Elfring - 2004-04-17

    Logged In: YES
    user_id=572001

    5. Would you like to integrate techniques from the article "A First Look at JSR 166: Concurrency Utilities"?
    http://today.java.net/pub/a/today/2004/03/01/jsr166.html

     

Log in to post a comment.