Monday, December 13, 2010

A year break from C/C++

Not practicing any C/C++ code for half a year has really made taking
OOP344 difficult. I had forgotten some of the most basic syntax, and if
it weren't for visual studio's intellisense, I would have tons of error
each time I tried to compile. It wasn't until near the end of semester when
I remember that you use & to pass pointers. When reading people's code, it
takes me a second to understand some the common programming tricks, like if (!!done) or
return (!done) etc.

The most difficult aspect of learning C++ is the sense of object orientated.
Each class or function would call a function in another class, which I
would not 100% understand what exactly the function does when I call it.
The first part of text was to call the border class to draw a border, and
when it didn't work for me I had a headache trying to follow values that
were passed. Text sent some arguments to label class, and label sent some
to border.

The latest code I have written was a text class. The most difficult part
was the edit function, whee I had to code enter, backspace, up, down key
presses. I had to call a function another team member had written previously.
I wasn't sure how the function worked, so I had to check many times what
was happening. I also had to use another class, a two dimensional array class,
as well, which I also wasn't sure what exactly the functions do.

At first I didn't know how to approach the enter key in edit. I thought
I had to insert a newline character in the next position where the cursor was,
but then I would have to create a new array and copy up to where it was, insert
and copy the rest, send the array to set to reorganize it. Turns out
the class that held the two dimensional array already have a function that
do that, insert a new line.

I've tried to do programming outside of class, but I have a hard time
applying it to everyday life. I can only think of using it for math
related problems. C# and Java can be used to make websites or programs
where other people can have easy access.Overall it's been a tough time getting
back into the C/C++ world.