Research Homework and Maths

Programming: Class Diagrams

My efforts to find a simplistic explanation about class diagrams haven’t been as fruitful as I’d hoped. I’m keeping my fingers crossed that, as I continue to read about them, I’ll gain a better understanding of how they’ll be applied in our classes. From what I understand so far, these diagrams are an overall view of an application, software, game, etc. They’re typically made before creating your application to aid in visualisation, description, and documentation all the aspects of the system, especially in more complicated builds.

There are three main parts to the basic classes diagram symbol, represented by rectangles divided into: attributes, operations(), and responsibility. The best example I could find of this online was the following illustration:

class-diagramHere, the name of the class is at the top of the rectangle and should centred, bold, and capitalised. After that the attributes should be listed in its own division, then the operations that are associated with the class, and finally the responsibilities.

The only difference for the active classes (which initiate and control the flow of activity) versus the passive classes (which store data and serve other classes) is that the active ones have a thicker border in the diagram.

Two other things I’m going to take note of about building the diagram are the visibility markers and the associations. There are other things to look at, but they seem it a bit further beyond what I’d like to focus on for now while still just learning about the class diagrams.

Visibility markers show who can access the class information, so the following image will explain it a lot better than me writing it out:

visibility

  • Public : allows other classes to see the marked information.
  • Private : hides information from anything outside the class partition.
  • Protected : allows the child classes to access the information from parents.

Meanwhile, associations show the relationship between the classes. The name of the association should be put near the arrow. A filled arrow will show the direction of the relationship and the roles (the way two classes see each other) should be near the end of the association.

association

After all this, I went looking for examples of filled-in class diagrams. The best (simplest) one I could find was the following:

uml_class_diagram

I’ll make a separate blog post as I continue to research into class diagrams, but I think I’ve made good progress for now.

Maths: Trigonometry

I haven’t done high school level maths for 15 years, so I’m a little rusty on most of the topics we’ll be covering, however I know it’s essential to refresh my memory if I want to do programming seriously.

Interestingly enough, the clue of what it’s all about is in the name: trigonon is Greek for “triangle” and metron is Greek for “measure”, it’s all about the lengths and angles of triangles. Hipparchus (from 140 BC) is credited as the father of trigonometry, since he was the first to compile a trigonometric table of sine values and used it to solve mathematical problems.

Trigonometry is comprised of three trigonometric functions: sine (the ratio of the side opposite the angle to the hypotenuse), cosine (the ratio of the adjacent leg to the hypotenuse), and tangent (the ratio of the opposite leg to the adjacent leg). Overall, it would look like this:

trig

As described on the wiki page, this right angle triangle would have the following:

  • sin A = a / c
  • cos A = b / c
  • tan A = a / b

For now, I’ll leave the research here and continue to develop it as I read into it more and how it can/will be applied in out lessons.

Other Maths

Outside of looking into the above research topics, to further progress our knowledge before our next class, we were also introduced to a number of maths topics that we’ll be looking into before our exam and to use for more advanced programming. Some of them are topics I remember from my school days, others I wasn’t familiar with beforehand, but I’ll outline them for posterity:

  1. Basic arithmetic : this will be addition, subtraction, multiplication, and division.
  2. Discrete and continuous numbers : the former is constrained to a finite number (such as a shoe size range) while continuous isn’t.
  3. Trigonometry : all about the measurements of triangles, including their edge lengths and angles, using sine, cosines, and tangents.
  4. Rational and irrational numbers : a rational number can be written as a fraction, while an irrational number (such as Pi) can’t be.
  5. Pythagoras’ theorem (a2 + b2 = c2) : to quote an online pythasource “It states that the square of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides.”
  6. Vector maths : we’ve already been using vectors in class, where the numbers define direction/rotation/scale, via the x, y, and z.
  7. Dot product (Scalar product) : again, from an online source, it’s “an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number.”
  8. Cross product (Vector product) : this is an operation on two vectors; it’s where “the cross product of two vectors produces a third vector which is perpendicular to the plane in which the first two lie.”
  9. Probability/randomness : the two words are fairly straight-forward, where it will be the likelihood of some happening or calculating the random likelihood something can happen.
  10. Mean, median, mode, and range : these are all averages where mean is the average number of a set of numbers (1+2+3+4 = 10 / 4 = 2.5), median is the middle value of a set of numbers (1, 2, 3, 4, 5, 6 = 3.5), mode is the number that appears most often in a set of numbers (1, 1, 2, 2, 3, 3, 3 = 3), and range is the difference between the highest and the lowest numbers in a set (4, 5, 6, 7, 8 = 8 – 4 = 4).
  11. Standard deviation and variance : the former is a measure of how spread out the numbers are and it’s the square root of the variance, while the latter is the average of the squared differences from the mean (so for each number, subtract the mean of the set and then square the result to work out the average of those squared differences).
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s