Week two and three

Hello world!

The first week was easy enough, but the second week was rough, really rough. In the classes I barely understood  anything the teacher went through and it took quite a while to learn and understand it. The 20 exercises that we had for the second week were difficult and took me until the middle of the third week to complete, so that put me back quite a bit. I started studying after the classes with some of the other students instead of going home as being in school with other people who were studying helped focus and also some of the other students helped me whenever I got stuck.

Week two we learned about functions, references, arrays, string data type, pointers and dynamic memory.
Lets start with functions. In addition to the main function, one or more functions are usually used to make the code shorter and make it easier for the programmer. Any function can be called multiple times within the main function for any kind of use, letting the code to use for exampel a certain formula several times without the need of rewriting it, also making the code easier to read. The functions can contain as many parameters as the coder wants and has no restrictions to its length.
References allows a second variable to both read and modify the data of the variable it is referencing to. This is good for wanting to reuse a certain formula several times but for example with different values, this requires then only one variables that references to the original variable within the formula.
An array is a variable of any data type that has several values tied to it. The values does not have to be defined with at the compile-time, but the size of it must be.
The data type std::string contains instead of numbers characters and words as value. Used whenever the code requires a word or a sentance from the user.
Pointers hold the memory address of a variable that is of the same data type.
Dynamic memory is when the coder has to manually allocate and deallocate the memory of those variables. So far I have only used dynamic memory when working with arrays.

Week three we out teacher went with a new teaching style, instead of powerpoints and just talking we had live coding sessions where he explained the code as we all wrote it. This way in my opinion was better in some aspects, but as I am bad at taking notes and also there was no time for notes, sometimes it was hard to remember how the code worked. So the lack of notes was really noticable. We went learned about classes, heritage and using header files. Header files are seperate files in a project that is used for functions other than the main function. This has no real importance other than that it is easier to read and navigate through. As you can for example make a header file for the projectile in a space shooter game. This file then contains only information about that and makes it easier to navigate through the whole code. It is in these header files that classes are used. Classes are basically used for all the objects in a game, to describe and code the different projectiles, walls etc.

It is not the end of week three and I am still a bit behind on the exercises for week three. But it has gotten a bit easier to understand now. I hope I will be able to catch up soon and it does look like I will.

Week four, here I come!

About Ara Mohammad

2014  Programming