I’ve done a ton of programming over this last week. I worked on my portfolio page, and did some work on my own personal projects as well. Sometimes with programming, I feel like I learned something I could do differently to make things easier for me for the next time. Other times, something unpredictable happens that is completely baffling, and it can be pretty frustrating. This week, I experienced both feelings. I’ll tell you the good things first.

Working on my portfolio went well. One thing I learned is that it may have gone a bit better if I hadn’t have used a template. Don’t get me wrong, templates are awesome. They allow you to get your page off the ground much faster than writing it from scratch, and they give you a great place for you to start putting your thoughts and ideas onto the screen. However, I feel like because I was using a template, it actually slowed me down from coming up with my own ideas. Instead, I would end up just changing how one small part of the page would function or appear. If I had of just written the page from scratch, or used a very simple template, I feel like I would have had an easier time coming up with new ideas. They would have started popping up into my head as I was creating the different elements of the page.

Another thing about using a complex template is that it makes it such a huge task to change anything on the page. Rather than just building the different parts of the site as the way you imagine, you have to sift through hundreds of lines of someone else’s code before you can find the part that does what you think it does. I think that next time, I will either write the page from scratch, or use a much more basic template. Maybe something with just a navigation bar and a footer. It would probably inspire more creativity, as elements of the page would mostly be my own creations, rather than just being recycled from the template. Who knows though, we’ll find out! That’s what working on these types of projects is all about. I could end up being completely wrong, and that’s okay because I’ll have learned for the next time.

As for my personal programming projects, I’ve been toying with my programming language, trying out some new ways of increasing efficiency. While I was testing some things like loops, I found an anomaly that is beyond my scope as a software programmer. Apparently it is faster for my compiler to transform the source code into a bytecode file, and then run the resulting file – Than it is to just run the previously compiled bytecode file. It is not just a small time difference either, the second scenario was taking around 30 seconds whereas the first would take around 15.

computer-wizard

A wizard, doing his wizardly things with a computer.

After testing this many times, I found that it isn’t just a coincidence. It’s some sort of wizardry.  At first I thought that the first scenario was faster because the file was fresh in memory. However, after numerous tests, I still could not beat the time of the first case. I tried many things such as loading the old file into memory, copying it into another file and then executing the resulting file, but no dice. This problem has me completely perplexed, as theoretically the second scenario should be the faster one. All this tells me is that there is probably some greater being out there that has it out for me, and does not want me to work on this project.

7 thoughts on “Computers Are Black Magic”

Eric Lortie Eric Lortie says:

You make an incredibly valid point about how working with other peoples code can be way less efficient than writing your own. I’d like to counter that with the fact that you’re likely going to encounter a pile of scenarios in your future where you’ll be required to fix, or validate, the other peoples code. Imagine everything you just went through only some of the elements you were working with didn’t work properly. And you didn’t know that.

I’m looking forward to checking out your programming language at some point down the road. That is very, very exciting stuff.

That’s a totally valid point, using things like templates does definitely train your eyes to look through other programmer’s code. That’s something that I wasn’t even thinking about when writing my post, but if I had thought about it, I would have mentioned it!
About a month ago, I agreed to help someone debug their code because it was past the due date for a project. I didn’t know how much of an undertaking it would be, as I was expecting it to be a small program for a beginners class… It took me a few hours, but I was able to figure out what the issues were. I was expecting it to take maybe 15 minutes. It just showed me how much my eyes are trained to read my own code, and how tough it actually is to get your brain to switch into somebody elses mode of thinking! It’s a valuable skill for sure.

David Hachey David Hachey says:

I had the same idea Andrew, at about midnight on Wednesday evening when everything about the materialize template I had chosen was making no sense after hours of navigating through it. I kicked it to the curb (“it’s not you, it’s me”) and tried a bootstrap template and by midnight Thursday we were going steady.

I’m not sure it wouldn’t have been better/easier/funner to have done it from scratch.. six of one half dozen of the other… semi-painful either way.

I remember you mentioning that in your presentation! It definitely feels a bit crazy when you’re scrambling to finish a project for a deadline and things aren’t quite coming together. Sometimes, the best option is to just completely scrap the whole plan and do it differently, like you did. What’s awesome though, is that now you know you’re capable of pushing through and getting the project done, even if things aren’t quite making sense in the beginning. Much better than just giving up just because it feels like you’re out of time. It really proves that anyone can accomplish their goal when they’re motivated!

Rob Myers Rob Myers says:

Very good points Andrew, some people find it easier building from the ground up than working with somebody else’s project. However, like Eric mentioned, it’s good exercise to look over somebody else’s code from time to time, as it enhances your ability to read code and provides you with valuable experience reverse-engineering somebody else’s solution, a scenario you’ll encounter a lot in the real world!

Can’t wait to hear about your programming language in the future, you’re doing some really cool stuff!

Thanks Rob, I admit that I hadn’t even thought about that when I was writing the article! As soon as I saw that Eric brought it up, I wished that I’d mentioned something about it, because it’s definitely a great way of practicing reading other people’s code.
I usually like building things from the ground up anyway, just to learn about how they work and understand them better. A lot of things I’ve made are reinventions of the wheel. I see a lot of discouragement for that type of stuff on sites like Stackoverflow. I’ll see a post about someone’s re-implementation of part of a standard library looking for review of there code or suggestions. Those posts are usually coupled with comments such as “oh, just use boost for this!”, or “this already exists in such and such library”, et cetera.
To me, I guess I can understand where those commenters are coming from. If I was creating an app for Android, I certainly wouldn’t want to design my own user interface for the app from plain draw calls. But on my own time, I would absolutely try to make my own UI for Android! Why not? I’d learn more about what’s going on behind the scenes of the actually UI library by doing so.
It just puts me off when these people are being so negative to the original poster, discouraging them from learning more about the things that they use every time they code.

Rob Myers Rob Myers says:

Absolutely, there’s no better way to learn the nuts and bolts of a technology than to re-create it from scratch! I find that when some people post about those things, they post purely from a ‘save as much time as possible’ standpoint, but for learning exercises, sometimes the time of execution isn’t really relevant because you’re learning something.


Leave a Reply