Tuloncz » Blog

blog

My 42Prague Piscine experience

One morning on my way to my day job as Senior SW Engineer (actually SDET combined with SW Safety/Raliability), I saw a billboard advertising a free coding school in Prague – 42Prague.com. It aroused my curiosity. I snapped a photo to remember the URL later – and forgot about it.

When I remembered and scouted the website, my curiosity was aroused once more. Part of the admission process for that school was an online “programming aptitude test”, a.k.a. IQ test for programming. So I took the online logic test out of curiosity – after all, it’s not some fake test of the social network snake oil advertisers, but a respectable Coding school aptitude test.

At that moment, I didn’t mean to sign for it at all – I have a firmly established IT career, a family to feed, and my programming my language of choice is my beloved C#.NET.

But I succeed in the test and was invited to the C language Piscine, it got me thinking. Since I got only the basics at the school and have self-learned the rest, I’ve never considered myself to be a good programmer – I critically think I have poor programming style and I consider my programs to have sub-par structure. I could definitely use a real coding course. I wanted to attend a C# coding course to become better programmer anyway, and this Piscine thing is a free C coding course…

So I took a week of vacation and I went for it incrementally: I will stay a week and the decide what to do next. And at the end of Piscine Week 1, I was hooked. It was such a great experience that I wanted more. So I took the rest of my vacation for it (ofc besides the family vacation, family comes first). And then I’ve actually asked my boss for an unpaid leave just to be able to stay and finish the 42Prague C Piscine (thus changing it from free course to a kind off an expensive course.)

That should tell you that the 42School really is something. And it is. I don’t regret a single minute or dollar spent – I’ve learned a lot and had the best fun in years.

In the beginning, I was trying to help others as much as I can to take off. I didn’t want to give them ready-made solutions, but guide them so that they can walk on their own feet. I was very active in the Piscine Slack and when I saw someone struggling with a technical topic, wrote an explainer. I even started a Prague42 Piscine Blog. First two days were Linux Shell to get to know GIT and utilities, then C begun. And already on the 2nd C assignment – Level 1 of my worst C Pointer nightmares came to fruition:

Well that was a shock therapy – but I had to overcome this to move further:

Afterwards, my fear of C pointers has decreased. I have only hoped that they wouldn’t give me Level 2 Pointer Nightmare – the “pointer on the array of pointers”. (They did, but only in the final exam).

This was symptomatic for the 42School. Occasionally, they gave us assignments which were almost beyond our grasp, but when we mastered them, it has shifted our understanding of C a lot.

To guide us in our understanding of C, 42School uses a whitelist-of-functions approach. Most of the time, you cannot use anything, or only unistd.h write(). That’s so that the students cannot make any shortcuts and have to really understand and bend the C capabilities. If we used malloc() for dynamic memory allocation, everything would be too simple and we wouldn’t understand enough.

First days, I tented to write “overkill code”. Sometimes even with watchdogs. I soon realized I cannot afford that, and started writing more efficient.

Then The Norm has forced me to stop using explicit typing from int to char and back.

Then I started doing Test Driven Development. And improved the structure of that in several iterations, until in the very end of the Piscine, I’ve had a separate .c file with the tests, void test_cXXexYY() method containg all the tests definitions as inline C strings, and void test_run_cXXexYY() method to execute the tests, usually comparing my code either with char/int value, or with output of GNU C Lib utility doing the same.

The others have spared that effort and used pre-made unit tests called Mini-Moulinette, but then they were struggling on the exam where they didn’t have MM but I was able to quickly recreate mine TDD.

I became something of a local curiosity for the passers by, always having longer code than the others. But then one more proficient C coder, reviewing my code, said something that appeased and delighted me. It was regarding function to convert integer input to string, and then in the advanced version, converting integer input into any base system. He said –

Your basic functions is much more complicated than the others, but then it was very easy to add the convert-to-base functionality. While the others had much simpler and shorter base function, but then struggled to make the base conversion work with it.

That is just my style, caused by my professional deformation – always attempting to write robust, future-proof code, right.

The Exams were great. Since in the 42School system, it doesn’t matter how you succeed or not, it’s just for you… I had no fear, almost no stress, and only my pride to satisfy. So the morning before, I always went through all the assignments before and took notes what I didn’t know how to implement, and talked about it with my peers. That has provided a profound leap of my knowledge.

Same way, when I got an assignment on the exam which I didn’t understand yet, I didn’t give up and I was just trying and trying like a stubborn donkey. Most of the time, I’ve learned an awful lot. And even if I failed, I learned a lot – eg. I wrote myself a function to iterate through memory and dump it address by address to try and debug my code and memory… Which was one of the exercises further down the line.

And then on the last exam, I did 66% (which I’m told isn’t bad at all) and got stuck on using malloc to allocate double-pointer char array. I thought C is stupid and doesn’t manage memory, so I’ll just allocate the total memory needed using malloc and then assign that to the beginning address of the double-pointer-char-array. No, SEGFAULT. So after the exam, I asked around and as a consequence, finally defeated my Level 2 C Nightmare, the pointers-to-array-of-pointers… While incidentally, finally truly understanding C arrays.

Leave a Reply