Four Down, One to Go...

So I've completed 4 of my 5 finals for the semester. Three of the courses I'm taking right now are for upper-division accounting. Horrid, horrid stuff folks. Though perhaps this is what school is all about.

Up until this point in my college career, I've felt relatively comfortable with studying for maybe an hour just before a final for most any class. Thankfully, I've managed to do pretty well with that strategy thus far, even in the 400-level classes. Granted, most of the classes I've taken seem to be about computers in some way, and computers really interest me. That makes the material a lot easier for me to remember and use on the final.

These accounting classes though... man... I'm not doing so hot in them. I'll be happy if I have a B in a few of them when all is said and done. That will damage my GPA, but I think it's a worthy sacrifice. I don't want to have to put myself through those classes ever again!

On a slightly more positive note, my Advanced Excel (an accounting class) final only took 10 minutes. I hear the average for the "good" students is about 45 minutes. I got a 96% on it. w00t. I got some pretty nasty looks when I got up and left after only being there for 10 minutes, but that's what happens when you take a final that's mostly about programming in a language that you started using 12 years ago (and most other people in the class never programmed a day in their life before the class started).

So now I just have one final left. Tomorrow morning at 7:45 I will take my networking final. I think I'll probably have to study a little longer than an hour for that one, but I also think I'd have to do pretty poorly to get anything below an A-. All of the labs were extremely straight-forward if you actually read the material, and being on time to class everyday seems to help too :)

Hooray!

Another Semester Gone

This summer semester, I took a single class--managerial accounting. It was a good class, and I learned a lot, but it took a lot of time. When I began reviewing everything for the final exam, I was surprised at how much I had _forgotten_ over the course of the semester. The more I studied, the more nervous I became.

Anyway, at some point this morning I decided I was comfortable with my understanding of the course material and decided to stop studying. Not too long after that I found myself in the testing center staring blankly at the exam questions. Most of the questions were relatively familiar, but all of the recent studying just confused me so I wasn't sure if I was doing anything right.

It took me just over an hour to finish less than 50 questions, but by that time I had had enough and just wanted to get out. Usually I will spend a few minutes reviewing my answers to the questions, but not this time. I just stood up, stuffed my pencil into my pocket, cleared my desk, and turned in the exam.

I looked at the monitor just outside the testing center, both excited and dreadful of learning how I had performed. I have to say that I'm quite satisfied with my score--89%. I can't ask for much more than that!!

After I finished that, Mindy and I drove straight over to the "black market" of university bookstores--you know, the little car at the end of the parking lots with big signs that say, "WE BUY TEXTBOOKS" in big print. Yeah, those guys. Anyway, Mindy and I decided that we wouldn't be using any of our textbooks from this semester (and several from previous semesters) ever again, so we decided to get some money back. We brought in $81 off of 9 textbooks! Not too bad considering that we probably wouldn't get that much from the university bookstore if they would accept our books back in the first place.

And now I'm free. Relatively.

Finally!

So this semester is finally over and done with. I only have two more courses to take before I am done with my major, but I still have quite a few classes before I complete my minor (I chose one very late). I will still be in school for another year or so.

This has been a particularly frustrating and busy semester for me, so I think it will be nice to only take one class over the summer and work/play the rest of the time. I have a lot of really fun projects that I want to work on this summer, so hopefully my site will be a bit more active that it has been for the past month. We'll see how that goes.

Why I Like Python

For the past 8 years or so, I've been very much involved with programming using the PHP scripting language. It is a powerful scripting language that suits building websites very well. PHP has a huge set of useful built-in functions, and more recent versions support object-oriented programming. I first started teaching myself PHP when I got tired of having to build each and every web page on my site manually. I hated having to change dozens of web pages just because I added a new link to my navigation. All sort of reasons like this prompted me to investigate PHP. Little did I know then that this language would occupy so much of my time in the future.

I rapidly learned that PHP offered much more than just allowing me to update one part of my website to change all pages. I started tinkering with all aspects of what PHP offered, and I'm still learning about it. After many years of searching, I finally found a programming language that was easy, fast, and efficient for my needs.

Through the years, I continued to develop various applications using PHP. I attempted to write my own forum/bulletin board software while I was still in high school. If I may say so myself, the forum really had some awesome concepts behind it. But my problem was that I lost interest too fast. I also built a very large application that reduced a 1.2GB MS Access database down to less than 15MB using PHP and MySQL. The new application offered many enhancements over the previous system. For one thing, it was much faster. Second, it allowed multiple simultaneous users to modify the database. Three, so far it has lasted more than 3 years, compared to the 1 year maximum that the MS Access solution always seemed to hit before it crashed.

Using PHP, I helped revolutionize the way one of the companies I work for developed websites. I built a simple in-house web framework that supposedly reduced development time by allowing us to forget about the mundane details involved in virtually every website and just get to the developing. In a matter of two weeks (with a full class load and another job), I managed to write an e-commerce solution for the same company using PHP.

Basically, PHP has treated me well over the years. But this post is not supposed to be about PHP. If that's the case, why have I rambled about PHP this whole time, you ask? Well, it's mostly to demonstrate that I have a lot of experience with the language. I have a pretty good feel for what it's capable of and how I can accomplish most anything I need.

With all of that in mind, I've encountered my frustrations with PHP. They may seem petty and moot to most people, but they have turned out to be the determining factor in what scripting language I prefer. Here is a short list of things I now despise about PHP:

  • dollar signs ($) to signify variables -- while this is a useful feature, it becomes quite bothersome when you're programming all day long (at least it does for me). I'll get to why later.
  • using an actual arrow (->) to access attributes -- most other modern programming languages simply use a period (.) for this functionality. I'll comment more on this and why it frustrates me later as well.
  • lack of true object-oriented constructs -- in other object-oriented languages, like Java, if you have a string and you want to determine its length, you call the length() method of that string. In PHP, you call a function such as strlen($var). This sort of behavior plagues the language.
  • too many unnecessary keystrokes -- as I mentioned before, all mutable variables are preceded by a dollar sign ($). That is 2 keystrokes (shift and 4) every time you want to refer to a variable, wheres most languages nowadays have none). Likewise, accessing attributes of objects in PHP uses an arrow (->), which is three keystrokes (minus, shift, and .). Most other object-oriented languages only require a period (one keystroke) for such functionality. The main reason I make such a big deal out of the number of keystrokes is simple. The more keystrokes a program requires, the more likely you are to have bugs. The fewer keystrokes a program requires, the less likely it is that your program will be broken. It boils down to maintainability. Also associated with the number of keystrokes is the pure laziness within me and most other programmers.

These frustrations have been bothering me for several years now. I continued using PHP mostly because it's so widely supported, but also because I could not find a suitable replacement for it. I investigated a few others, but they apparently didn't have a great influence on me right now because I don't remember any names.

When the whole Ruby on Rails bandwagon was rolling through town, I decided to hop on to see what all of the hubbub was about. I started studying the Ruby script language, and I found that it had some really neat things about it. It uses a more solid approach to object-oriented programming, which I really liked. I also noticed that it employs some intriguing structures for accomplishing things in ways I've never seen before. Despite these things, Ruby still didn't seem like a viable replacement for my PHP. It didn't come up to snuff in performance in many cases, so I essentially abandoned it.

For at least a year now, I've been interested in learning Python. I've heard a lot about it over the years, but I just never seemed to make the time to actually sit down and study it. That is, not until about the beginning of August of 2007. After I made my decision that Ruby and Ruby on Rails weren't quite up to par for my needs, I stumbled upon the Django Project, which is a web framework similar to Ruby on Rails, only built using Python.

I decided this was my chance to actually sit down and learn a little about this "Python" so I could see what it had to offer. I mostly used Django as my portal to Python. As I started learning Django, I became more and more familiar with the way Python works and how I work with Python.

At some point in time, I decided that I actually liked Python, and my wife let me buy some really cool books to help me learn it. By the beginning of October 2007, I had convinced my supervisor at work to let me start building websites using Django instead of our home-grown PHP framework.

And here comes a story. This is the main reason I blabbered about my experience with PHP so much at the start of this article. Again, after all these years, I feel very confident that I can do just about anything I want efficiently and elegantly with PHP.

Back in October of 2006 (after using PHP for some 7 years), I was asked to write a PHP script to parse some log files and output various bits of information in a certain format. After maybe a week, I had a script that did the job fairly well. Most of the time it worked, but there were occasions when it didn't and I had to fix it. The script turned out to be 365 lines of code with very few comments scattered throughout. It's also a maintenance nightmare, even for me.

In October of 2007, I rewrote that same script in Python. After only a couple days, the script seemed to be perfect. It did its job, and it did it well. With comments for just about every single line of code, the Python version of the script took up a mere 118 lines of code. Take out the comments and it is 56 lines of code. The script is several times more understandable and maintainable than its PHP counterpart. I also believe that it is much more efficient at doing its task. Keep in mind that I had only been using Python for about 2 months at this point in time.

It's been through various experiences like the log parser that I have decided I prefer Python over PHP. Obviously, I'm not quite as comfortable with it as I am with PHP, but I don't feel too far behind. Now, less than 6 months after deciding that we'd use Django at work, I don't think my supervisor could be happier. Building a typical website with our PHP framework takes between 1 week and a couple months. Thanks to Python and Django, most of our websites can be "ready" within just a few hours. That time assumes that the website's design itself is ready for content to be put into it and also that the client does not require custom-designed applications.

Python and Django have helped revolutionize the way we do things at work, and I can hardly stop thinking about it. Python fixes nearly all of the frustrations I had with PHP. The frustrations it doesn't take care of are worth the sacrifice. Python is capable of object-oriented programming. It uses a period (.) to access object attributes. Variables are not preceded by some arbitrary symbol.

Also, the fact that Python code can be compiled to bytecode (like Java) is enormously beneficial. Each and every time a PHP script is executed, the PHP interpreter must parse the code. With Python, the first time a script is executed after an edit, the program is compiled to bytecode and subsequent executions are faster. That is because the bytecode is processed directly by the Python Virtual Machine (as opposed to being compiled to bytecode _each_ time and then executed). Python also offers a vast amount of standard library functions that I would really appreciate having in PHP. But from now on (at least for the foreseeable future), I will try to do all of my scripting in Python and leave PHP for the special cases.