Tuesday, May 27, 2014

Day 12: Advanced sorting algorithms and CSV

This morning lecture was just a quick demonstration on how to write PHP more accurately and with minimal bugs. Ultimately you write out all your code to get a good idea of where the repetition occurs so you know where to put in loops. Another important thing that was noted was to make sure that you work on one feature at a time. A lot of times when we're coding we get really ambitious and work on a bunch of features and then all of a sudden our code doesn't work. If we were working on one feature at a time it would be much easier to figure out what we did wrong. I'm personally still working on it because a lot of times when I'm coding I'm almost certain that every thing will be fine. To be fair it usually works out great when I do that. However the times that it doesn't and I end up spending hours trying to figure out my code is not worth it.

As I made steady progress through the PHP, there were some optional assignments for me to work on. They were sorting algorithms which were more advanced than what we had. We had the usual selection sort, bubble sort, and insertion sort, but there was one in particular that took me at least 90 minutes to get working with all cases: the Radix Sort.


Although it took me an incredible amount of time to figure this out, this is all about "paying your dues". Every great programmer has taken their time to figure out these algorithms to train their brains to think like a machine. These algorithm-type challenges seem to be very common during interviews and I want to make sure that I am a beast when it comes to these.


The learning platform wanted us to post these solutions up on github. I know one day I'll become a great programmer and look back and laugh at how I used to solve these algorithms.


After figuring out the 4 algorithms above and writing them in PHP, Ruby, and Javascript, I was off to working on additional optional assignment. On the top-right, you'll see a CSV file. Although they aren't commonly used by developers, once in a blue moon you might run into them and Coding Dojo wants us to at least have an idea of where to look when dealing with these types of files. The code listed below shows how I pulled data, line-by-line, from the file and echoed the HTML with proper formatting.

What's interesting about this assignment as well as some of the others recently is that there wasn't much guidance and I think it's all intentional. When we leave Coding Dojo and enter the workplace, we aren't going to have a learning platform that has a list of the necessary functions. The places that we look are the documentation as well as google. It seems like great developers are extremely good at using search engines to solve bugs. 

There is a lot to be learned with PHP and I feel a lot of my classmates are getting exhausted. I heard Michael Choi say, "Wow you guys are all working on the optional assignments? I think that's a first!" We are all probably very exhausted because we are extremely determined. I get a sense that as a class, we have a culture of over-achievement and are perfectionists. When I'm not "plugged-in", I glance around the room to see classmates practicing algorithms over and over again on the white board. On the other side of the room, a pair would be having a discussions about cryptocurrency while another pair would be reviewing each other code.

Although my brain is fried at the end of each day and the amount of learning can be overwhelming, I'm glad to be a part of this experience. It's so easy to quit when you're learning all this material on your own, however being with all my classmates and having this culture of perfectionism really keeps me going every day.

No comments:

Post a Comment