Climbing that tree

This is a discussion on Climbing that tree within the C++ Programming forums, part of the General Programming Boards category; I've hit a snag with my VM. The idea was to have something like this: Code: VirtualMachine / \ / ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Climbing that tree

    I've hit a snag with my VM.
    The idea was to have something like this:

    Code:
                VirtualMachine
                /            \
               /              \
              /                \
          VMMemory            VMCPU
    (Each branch is a "has-a" relationship. I need to learn UML)

    Trouble is, the VMCPU may need to call VMMemory::Write or VMMemory::Read, depending on the instructions it's executing.

    I'm thinking the answer is really simple.

    Would it be "better" to work VMCPU into VirtualMachine?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,667
    Make VMCPU a friend of VMMemory?
    From now on a large part of your life will be spent finding and correcting your own mistakes.
    And if you are lucky and land yourself a good job, a whole lot more time will be spent finding and correcting other people's mistakes.
    That has to be good, no?

    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    ... Oh yeah.



    (Thanks).
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,667
    In the case you only need those two member functions, you may only need to declare them friends of VMCPU. Instead of the whole class.
    From now on a large part of your life will be spent finding and correcting your own mistakes.
    And if you are lucky and land yourself a good job, a whole lot more time will be spent finding and correcting other people's mistakes.
    That has to be good, no?

    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Tree Search
    By C++Newbie in forum C++ Programming
    Replies: 7
    Last Post: 04-05-2011, 02:17 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 06:59 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 11:45 PM

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