23
Oct

Coding as Computer Science Student (reviewing my code after 5+ years as professional)


I just found some very old data from my
university time. I’m a professional software engineer since more than five years and I found some really interesting data which is from my university time when I
was in the second semester. I have no idea if this is still running. I want to try it
out and look at the code. I’m just interested in how the code is looking
and how it is compared to my knowledge that I have now. Yeah I remember just in
this time I was struggling so hard to get this project running. it was so
difficult for me at this time. I mean I already could program a little bit, I
already did programming before when I was in school. I did some small homepages
and everything and I teached myself a little bit of coding but this project in
the university was like my first real coding project or bigger coding proj ect.
The goal was to program a small game. So let’s create a new project. Why does it not run? So sad… Lot of german comments, nice. Text field… Text file… Oh nice! I even wrote a playing field rendering functionality. Where you can draw a map in a text file
and it will be parsed and based on the input it will generate a playing
field. But it seems not to work. Why? No such file… But it ist there. What you want from me? Okay let’s just use the full path. J Bomberman. oh man oh man
whoa oh. Oh nice. Ha ha ha Is that nice. It works. It fucking works! Let’s see if I can kill the other guy. Stop stop man. He’s dieing! He is dead. What? He did… He reappeared. oh man.. yeah I can kill
him but he instantly spawns again. let’s see if I can kill myself.
Game over! That works at least, so nice. yeah and there’s also some AI involved
in this game and I remember that I implemented some very basic search
algorithm I think I don’t remember exactly some basic I think it was a star
algorithm i implemented for the other opponent so he’s not really fighting
against me his goal is to find walls that he can destroy. Let’s look into the
code for how this was really done. yeah there’s this AI player. oh man the code
is so bad where is the algorithm? oh there it is,
nice. Find a path to explodable wall via A* algorithm. Find a path to a safe
spot via A* algorithm. So the AI guy is finding a wall to
destroy and then he’s placing a bomb and after he has done that he is also using an
A* algorithm to find a safe spot so that he does not destroy himself. So I
think that’s mainly the logic. Oh man but the code is so bad and there’s also a
lot of debugging output directly printed into the console. There are a lot of
strange comments. Oh nice also yeah there’s some kind of basic animation I
copied some stuff from real bomberman game like this bomb for example.
Different sizes and then if you place a bomb there’s just loop running, showing
the different images and then it looks like the bomb is animated. Very hard
coded. So for bomb and explosion there is some very complex stuff going on. Multiple for
loops inside multiple if statements and then again another for loop. So many IF statements I have never seen. I’m really wondering how I could understand what I
did back then because I have no idea what this code is doing. Nice. Very interesting. Cheers
I am driving to my workplace and there is some traffic jam so it’s the perfect
time to do a small recap about my code that I saw yesterday from my university
project. Time for my cool sunglasses. So a lot of stuff that could be done better
back then but I’m still wondering… In the end the project somehow was successful
from the requirements. The problem is in the end if you just look at the outcome,
yeah it was successful. It was a good project, I did the right thing,
the game worked, requirements met, everyone happy. This is one of the main problems during software development. If no one is looking at
your code and is challenging your code then it can’t be successful but as a
developer today I would say it should be really your personal goal to write good
code. If I’m really honest and if I think about
the time back then, I was really convinced from my point of view at this
time. That I was writing really good code. And that seems to be a problem. I
didn’t know that I could have done better because there was no one who told
me it wasn’t good. And that’s interesting. Maybe that’s a good learning point
to take away because I think still today if I’m writing code, I’m also at
this point where I think my code is really good. Because I’m a professional now, right? But there’s probably
also still a lot of stuff that I can improve I mean back then I didn’t know
anything about good code, good writing code, readable code or anything. I just
hacked something down and it worked in the end.
But over the years how have I learned and improved my coding skills?
And if I think about it, it was I think mainly or at least 80 or even 90% of my
learnings we’re not coming from reading books studying something. It was mainly
coming from other people. If you want to make good progress and fast progress,
look for people where you know they are better than you.
They have a lot of experience, they know how to build stuff. Try to find those people
and try to learn from them. The most learning happens if you let someone look at your own code and be open to do things different. I think that’s the main point we can
take away from this small and crazy idea that I had. To look at my old code. It
really opened my mind again. And that’s a good point maybe for myself also to
pick this up again. Try to catch the other guys and try to learn from the other guys.

Tags: , , , , , , , , , , , , ,

There are no comments yet

Why not be the first

Leave a Reply

Your email address will not be published. Required fields are marked *