Skip to main content

Topic 2

Topic 2 has 3 parts: Frameworks, Unit Testing, and UML Class Diagrams


Framework Classes Collections

We already know that objects can "know and do things" from topic 1.

  • Each object can/will perform a given role

  • Common roles occur as different programs will have similar objects

  • Because of this, reusable classes were made available as libraries.

    • An example of this is the System library in C#

    • These are known as collection classes

  • Different collection types have different features

    ListDictionary
    Array
    Index based access
    Hash map
    Key based access
  • Data frameworks provides access to databases and files

  • Use classes from a library so you don't have to unnecessarily reinvent something

Unit Testing

  • Unit testing is used to automate the testing process of your project

    • Instead of manually inserting variables and watching errors pop up, we can create unique tests with expected outcomes. These tests can be kept and re-used throughout the development of a program.
  • We use the xUnit framework, x representing something else, for example, we have:

    • NUnit

    • JUnit

    • ...and so on

  • Each test should relate to a specific part of the final program. This could be a singular object's method, or a sequence of actions with multiple objects being used as once.

For help with creating unit tests, visit my guide here.

Basic UML Class Diagrams

The purpose of a UML diagram is to communicate ideas in a uniform and detailed way.

Class diagrams showcase the static structure of a program or a portion of a program.

For basic help with reading them, you can refer to my guide here.