How do you manage things?

This is a discussion on How do you manage things? within the C++ Programming forums, part of the General Programming Boards category; How do you manage C++ classes for reusable-code purpose? Since performance is the top priority for me, there is duplicated ...

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    Question How do you manage things?

    How do you manage C++ classes for reusable-code purpose?

    Since performance is the top priority for me, there is duplicated class names for their special purpose, for instance:
    - Node, with single link.
    - Node, with double link.
    - Node, with multiple link (a.k.a. Vertex).

    As well as String:
    - String for appending (back only).
    - String for appending (front/back), and insertion.

    Thanks in advance.
    Just GET it OFF out my mind!!

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Nothing wrong with having different classes with different trade-offs. If you can write these trade-offs as template policies, it might increase your implementation code reuse, but that's a different issue.

    The important thing here is concepts. For example, define what it means to be a string. Define the essential operations that all strings must support, and exactly how these things are done. Then you can write template functions that can take any string - as long as it conforms to these requirements.

    The STL is founded on this principle. Compare deque and vector - they're both models of the Random Access Container concept, but with different trade-offs.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tool to manage programming task, ideas, test
    By Kempelen in forum Game Programming
    Replies: 4
    Last Post: 04-15-2009, 09:54 PM
  2. Suggestions for things to study
    By Mastadex in forum Windows Programming
    Replies: 5
    Last Post: 08-18-2008, 09:23 AM
  3. How does strtod manage to parse?
    By seedpress in forum C Programming
    Replies: 4
    Last Post: 03-23-2005, 05:03 PM
  4. Help with these three things...
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 08-26-2001, 07:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21