Designa en webbplats som denna med WordPress.com
Kom igång

Partial Reflection 2

I really like the way this course has been taught so far. Since the first partial I’ve gotten a much better understanding of the use and importance of design patterns and UML diagrams. We’ve had many interesting lectures and discussions . I really appreciate that we got the opportunity to talk to the one and only Kent Beck. He had some really interesting things to say both about his personal life and his thoughts on software design. I have to be honest though, because of all weekend trips and projects in other courses i haven’t had as much time as i would have liked to research and write about these topics.

However let’s get into what i have learned and covered so far. Let’s start of with Design patterns.

This was definitely the most interesting topic for me. Before I took this course i knew nothing about design patterns. To introduce and explain this topic out teacher used the classroom design as an example. Our classroom and many others have their doors placed in the front of the classroom. We got told that this design can be seen as a general design solution for classrooms. The solution helps the teacher to see when students leave and enter the classroom, which could be useful in some situations.

In Software design these kind of general solutions are called Design patterns. They are defined as standardized solutions for solving commonly recurring problems in a software design. In the beginning i thought this was the same as algorithms because their definition sounded similar. But they’re actually different. Design patterns consist of a more abstract description of problems and solutions rather than the actual solution.

The patterns normally consist of:

1. an Intent of the pattern which describes briefly the problem and the solution.

2. a Motivation that further explains the problem and how the pattern can solve it.

3. a Structure of classes which shows each part of the pattern and how they are related.

4. a Code example in one of the popular programming languages which makes it easier to grasp the idea behind the pattern.

There are three main categories:

  • Creational patterns, Example:The Singleton pattern which is used to ensure that ”a class only has one instance, while providing a global acess point to this instance”
  • Structural patterns, Example: Composite pattern that lets you compose objects into tree structures, and then use the structures as induvidual objects.
  • Behavioral patterns, Example: Chain of Responsibility pattern in which you pass request along a chain of handlers, where each handler can decide to eighter process the request or to pass it to the next handler in the chain.

Unified modeling languages

During these past few weeks i’ve also done multiple post about unified modeling language diagrams (UML).

I see UML diagrams as an efficient and simple tool for communicating ideas while designing software. They give a visual representation of the software architecture, which helps developers and other stakeholder get a deeper understanding of the software without having to read all the code. I would also argument that they can be used to discover and analyze problems with the code in earlier stages when they are easier to resolve, even before the actual coding.

Here are some of the interesting diagrams i have covered:

Class diagrams

I’ve personally used this diagram many times for programming object-oriented. It’s a structural diagram that displays attributes and methods of the classes in a software system. I believe this diagram is useful for both large and small software systems. They can be used to avoid problems such as code duplication and redundancy by making it clear which class or object should do what and which variables they should store.

Sequence Diagram
This diagram can be used to display the interactions between objects or classes in the order in which they take place. They describe how and in what order the components in a system function. I think these diagrams are very useful for both business professionals and software developers. They can be used to document and understand all important processes and requirements for new or existing system.

Object Diagram

In my opinion this diagram looks very similar to a class diagrams. The difference however is that object diagrams also displays instantiated classes (Objects). This means that the classes can be displayed with their values and names at a particular period. This is very useful for example when there are recursive relationships involved with the classes.

GRASP

In order to create a good software design you need to know if and how the objects and classes are obligated to perform some tasks or know certain information. I’ve learned that there is a good guideline for this called the General Responsibility Assignment Software Patterns known as GRASP. It contains a set of 9 patterns and responsibilities that I think every programmer should be familiar with. If you don’t know about it then i definitely recommend checking it out!

Converting Class designs to tables and code

Converting classes to tables in a relational databases such as SQL can be bit hard if you’ve never done it before. With this kind if database structure you really need to think about the relationships between the classes before you implement them as tables in your database. The first step of doing this is by creating a so called Entity relationship diagram(ERD). The ER-diagram can be used to visualize and understand the relationships between the tables and attributes.

In order to create a functional and efficient SQL database you want to be able to modify the database without causing redundancy and database anomalies. The next step therefore is to normalize the database. Normalization is a technique of organizing the tables and columns in the database to enforce data integrity and reduce reduncancy. This process requires you to identify functional dependencies for all the given relations so you can remove all partial and transitive dependencies.

When it comes to converting a class design to code i personally think that it’s a much simpler process. The hardest part is figuring out how the syntax for the preferred language works and what functional advantages and disadvantages the languages have. With the help of google you can easily find documentation about this.

Final words

There aren’t many mastery topics left now, we’re getting closer to the final deadline. My courses are getting more intensive now as all the projects have their deadline now in November. Writing these post will probably become a bit harder but i will try my best. I can’t guarantee anything but I really hope that I will be able to complete all the blog posts, that is my goal. See you in the next post!

Annons

Lämna en kommentar

Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com-logga

Du kommenterar med ditt WordPress.com-konto. Logga ut /  Ändra )

Twitter-bild

Du kommenterar med ditt Twitter-konto. Logga ut /  Ändra )

Facebook-foto

Du kommenterar med ditt Facebook-konto. Logga ut /  Ändra )

Ansluter till %s

%d bloggare gillar detta: