Files
cpp-membot/RUBRIC.md
2026-06-30 16:16:17 -07:00

3.0 KiB

Rubric

Use this project rubric to understand and assess the project criteria.

Compiling and Rule of Five

  • The code is functional: The code compiles and runs without errors.
  • Class design meets the Rule of Five guidelines: In the chatbot.cpp, changes are made to the class ChatBot such that it complies with the Rule of Five:
    • Memory resources are properly allocated / deallocated on the heap and member data is copied where it makes sense.
    • In each of the methods, a string is printed to the console so that it is possible to see which method is called in later examples (e.g., ">>> Rule of Five Component: ChatBot Default Constructor <<<").
    • Because these messages will be injected in the chatbot's messages, to increase readability use the pattern ">>> Rule of Five Component: [method] <<<"

Exclusive Ownership

  • _chatLogic is an exclusive resource of the ChatBot class: _chatLogic an exclusive resource to class ChatBot using an appropriate smart pointer. Where required, make changes to the code such that data structures and function parameters reflect the new structure.
  • The GraphNodes in the vector _nodes are exclusively owned by the class ChatLogic: In file chatlogic.cpp, the vector _nodes are adapted in a way that the instances of GraphNodes to which the vector elements refer are exclusively owned by the class ChatLogic. An appropriate type of smart pointer is used to achieve this.
  • GraphNode ownership is not transferred when passing instances: When passing the GraphNode instances to functions, ownership is not transferred.

Moving

  • GraphNodes exclusively own the outgoing GraphEdges and hold non-owning references to incoming GraphEdges: In the files chatlogic.cpp, graphnodes.h, and graphnodes.cpp
    • All instances of GraphEdge are changed in a way such that each instance of GraphNode exclusively owns the outgoing GraphEdges and holds non-owning references to incoming GraphEdges.
    • Appropriate smart pointers are used to do this.
    • Where required, changes are made to the code such that data structures and function parameters reflect the changes.
  • Move semantics are used when transferring ownership from class ChatLogic into instances of GraphNode: In the files chatlogic.cpp, graphnodes.h, and graphnodes.cpp , move semantics are used when transferring ownership from class ChatLogic, where all instances of GraphEdge are created, into instances of GraphNode.
  • Move semantics are used correctly with ChatBot: In the file chatlogic.cpp, a local ChatBot instance is created on the stack at the bottom of function LoadAnswerGraphFromFile and move semantics are used to pass the ChatBot instance into the root node.
  • ChatLogic has no ownership relation to the ChatBot instance: ChatLogic has no ownership relation to the ChatBot instance and thus is no longer responsible for memory allocation and deallocation.