Native Applications or Web Applications?

One of the things I’ve been contemplating most from my recent trip to MIT is the hypothetical decision of, for any given software application, should I write a native application that runs directly on the phone or PC, or should I write a web application? Our instructor, an accomplished software developer, pointed out that the web applications he built nineteen years ago are still running just fine, while he doubts that any native mobile phone applications written today will even be usable, much less running, nineteen years from now. And on top of that, it’s usually much more complicated to write a native application than to write a web application that does more or less the same thing.

After investing a fair bit of time into learning iPhone development, that hurt a little to hear! But further consideration leads me to the same conclusion. For all of the hours I’ve poured into iPhone programming, I’m still pretty disgusted by it. I wince when I envision the drudgery involved in making even modest changes or additions to an iPhone application. Web applications have always felt pretty streamlined overall.

But what about making money? Isn’t it super easy to make money on the iPhone App Store? I’ve recently been making some designs for a music education program that I planned to develop as an iPhone application. Yesterday, a friend showed me her new iPad, and asked what I thought about running GarageBand on it for basic music tracking. I said it’d be hard to go wrong with that option, as it only costs five dollars.

I seriously doubt that my planned music education app would have 10% of the overall functionality as GarageBand, so maybe I could offer a good value on the iPhone App Store if I just gave it away for free!

At least with web applications, you can justify time and resources spent hosting and maintaining the application, and charge money accordingly. Big companies might think it’s a good idea to build iPhone applications just so their marketing departments can say that they have one, but for an individual software engineer, maybe it’s not only more technically pleasant to write web software, but potentially more profitable…

Relational Database Programming Class at MIT

IMG_7207I started reading Philip Greenspun’s database-backed web application books and articles around 2005. While I had previously seen database development as the droll, boring corner of computer science, as I realized how useful it could be to route a database through a web site, I became intrigued.

I shortly dove in and tried building some database-backed web sites of my own, more or less following along with Philip’s curriculum for his semester-long class at MIT. I was pleased with what I had learned, but was aware that my self-taught understanding of the database side of things was somewhat superficial.

In January 2012, I had opportunity to take a three-day (all-day) intensive class at MIT, led by Philip, specifically focusing on relational database systems.

Class Format

Perhaps one of the most novel aspects of the class was the overall format. From what I’ve seen, most computer science classes consist of an hour-long lecture in which students are more or less read passages from a textbook, and then given homework assignments to go off and do by themselves.

In this class, Philip gave a mini-lecture of a half-hour or so, then gave the class a short programming exercise based on the lecture material. We were all to bring our own laptop computers to class, and (thanks to the power of Virtual Box, we were all running the exact same software configuration) complete the assigned exercises right there in the classroom. Philip along with a handful of teaching assistants were available to help, and roamed about amongst the students asking us how were were doing if we appeared to be stuck.

After a half-hour or so of letting us churn through the exercise, we pasted our (attempts at?) solutions into a shared Google Docs document, and Philip reviewed and discussed our solutions in front of the class, followed by showing us his own solutions. Then he moved on to the next topic, and the process started over. The pace was fast, and reminded me of the time I spent on the Cornell College block schedule, only more so.

How did this approach work? I think very well. Nearly all of the material we covered in the class was taken either directly or indirectly from Philip’s online SQL book, which I had perused many times while working on my own database projects. But even though I had access to this knowledge, my depth and breadth of study was limited to what I thought I needed to know in order to solve my immediate problem. Being “forced” to work through all of the material in class, even if it appeared too boring or too challenging from a distance, prompted me to learn things that I had never bothered to learn before.

Web Clients vs. Native Applications


While the class focused on databases, we also took some brief excursions into making end user-facing applications that connect with the databases, both a small web application and a small Android mobile phone application.

What did we learn? It’s much easier to make web applications, and much more cumbersome to make native applications, that do more or less the same thing. Philip wisely pointed out that the web applications he built nineteen years ago still work fine, while he doubts that any mobile phone applications built today will still be usable nineteen years from now.

Which makes more sense to work on?

But Are Relational Database Systems Still Useful?

On Tuesday afternoon, database expert Michael Stonebraker gave a fascinating guest lecture in which he proposed that the standard big-name database systems like Oracle and MySQL might not really be what you want to use.

Modern database usage can be divided into three general areas: online transaction processing, data warehousing, and a variety of other specialized niche uses. Online transaction processing demands high availabilty and fast performance on short, simple queries. Data warehousing demands huge amounts of storage space and running complex queries. Quantitative analysis (such as that done on stock market numbers) demands access to data more like a two-dimensional array than rows of columns in a traditional database.

Systems like Oracle and MySQL can be used to model the data in all of these situations, but they aren’t optimized for any of them. Instead, if your application needs more than Oracle can muster, it is better to use specialized database systems: VoltDB is optimized for online transaction processing, and works as much as 75x faster than Oracle. Vertica provides a 25x performance boost over Oracle for data warehousing applications. For array-based processing, SciDB offers superior performance.

So is Oracle just a worthless piece of junk? Not exactly. There are plenty of applications that do not require a high-performance database. If you don’t need high performance, then Oracle might be a fine choice. An even better choice would be an open-source database system like Ingres or PostgreSQL, since they offer features comparable to Oracle without the hefty licensing fees.

In addition to recommending that we explore diverse kinds of database systems rather than assuming that one size fits all, Dr. Stonebraker admonished us to become well-versed in linear algebra and statistics, as he believed these skills will be increasingly valuable to database developers.

Additional Topics

Ollie the Border Collie

After the final class session, several of us stuck around to chat with Philip and hear his views on sundry other topics, such as startup companies.

Many young programmers today aspire to launch a successful startup company. Of course, many more startups fail in obscurity than strike it rich, but the allure is strong. The recent trend has been to try to acquire some sort of funding and go to work on your startup full-time.

Philip asked, why would you want to work at a poorly-funded startup, working potentially very long hours and always wondering when the horizon of money is going to run out? Wouldn’t it be better to get a job at a well-funded company and work on your product idea in your free time? If your project takes off, then wonderful, but if not, you haven’t put yourself at financial risk.

What about deciding which technologies to learn? All other things being equal, it may be better to develop experience on expensive proprietary technology than on freely-available technology: if a company has the money to pay for the proprietary technology, then (ostensibly) they also have the money to pay you well. Many proprietary software vendors offer free demos; download the demo, build something with the software, and add your newly-acquired skill to your resume.

But even more important than having a laundry list of technologies on your resume is being able to list projects completed. Being able to point to a software product (or a distinct sub-component of one) and say “I built that” is a strong indicator of engineering ability.

Outside of the Class

It seems that different parts of the world are somehow more conducive to certain fields of endeavor than other parts of the world. If you’re into science and engineering, the Massachusetts Institute of Technology is simply an awesome environment to be in. As I roamed the corridors, hung out in the student center, and bought tea in the lobby café, it was as if innovative technological ideas were just floating around in the atmosphere, available to grab and make your own.

Bonus Points: An MIT Hack

MIT students are well-known for performing hacks on campus, and we had opportunity to witness a small one during the class:

IMG_7228 IMG_7313

Final Thoughts

The knowledge I gained in the class was sitting right before me in book form for years. Probably had I only read all of the material, and made a solid effort to work through all of the examples, I would have been much further ahead earlier on. This surely holds true for other areas as well: if a good educator has taken the time to write a good book on a topic that you wish to learn more about, then read the book.

That said, the class was a great experience. The interactive nature lets you learn more easily than through reading alone, and the class structure helps you to stay focused and get through the material.

Not only did I learn more details about database systems, but I feel professionally recharged, and eager to continue on in my career as a software engineer.


Will I Ever Use This In The Real World?

This month saw the publication of Don Knuth’s Art of Computer Programming Volume 4A. In eager anticipation of receiving my copy in the mail, I was reading some of Knuth’s writings on number theory. This ostensibly had nothing to do with anything I was working on in the real world, but I was enjoying it.

Today I was trying to solve an odd programming problem for a project I’ve been consulting on. The program was supposed to receive a series of (X, Y) coordinate pairs and process them, but for some reason the processing of the Y coordinate was consistently off, while the processing of the X coordinate was perfect. Moreover, the larger the Y value, the worse the processed result became. I presume that something was going wrong in the processing, but exactly what was eluding me.

While I did not have this matter in mind at all during my reading of Knuth, I was inspired by some of the number theory concepts to find an approximate pattern in the faulty processing and then find an acceptable value to multiply our Y-coordinate by, such that the modified Y input would offset the problem. I still didn’t understand the underlying cause of the problem, but the software was supposed to ship today, and this made it work acceptably well.

My fix was not particularly an application of number theory; at most, it was basic algebra. But even though number theory itself wasn’t involved in my solution, studying number theory prepared my mind to think in the direction of seeking patterns in numbers, something that I probably wouldn’t have thought of otherwise.

So to the question, “will I ever use this in the real world?”, the answer may well be no… but even if not, the study of the material forms new connections in your thinking, which may help you in real world situations.

A Compiler Bug

I was converting an avionics subsystem from Ada to C. It was a client application that had to talk to an Ada server, sending and receiving rather huge chunks of data, large, deeply nested, intricate structure types. The C structure type had to match the Ada type exactly, or else it wouldn’t work.

I got it working fine on our desktop simulation, but running on the actual hardware it was consistently off. After extensive testing, I realized that it was a bug in the compiler for the target hardware, such that a very particular type of structure (something like, {int, char, float}) was being packed incorrectly, resulting in a 2-byte pad that shouldn’t be there. If I reordered the structure elements, it was fine, but that particular grouping and order refused to work correctly.

It was GCC, so we could fix the compiler ourselves, right? Not very practically, as, for avionics systems the compiler has to be thoroughly qualified for avionics use, and changes equal requalification. I “fixed” it by storing the float as an array of characters, converting it to and from a real float type as we needed to use the data value.

Trivial, perhaps, but I was very excited to resolve the problem, after spending days barking up wrong trees. One usually expects that the problem is not in the compiler…

A Check from Oracle

Today I received in the mail a check for $190 from Oracle Corporation.

I graduated from high school in the summer of 1998. As a graduation gift, my grandfather gave me $500 to invest in the stock market, in hopes that I would learn something about business and stocks. I had spent the past year becoming very seriously interested in computer programming, and the hip new programming system at the time was Java, produced by Sun Microsystems. So, without knowing much about the stock market, or even about the financials of Sun Microsystems, I decided to put the whole $500 into Sun stock, on the basis of liking their products. I was able to buy ten shares.

I asked for the stock certificate to be mailed to me personally, and, like Balki Bartokomous on Perfect Strangers, I framed the stock certificate and hung it on the wall. I was not particularly interested in making money through the stock, but rather, was delighted to be a part-owner of my favorite company.

About six months later, in December of 1998, my grandfather very unexpectedly passed away. I knew he had not been feeling well, but he was generally a very healthy person. There is much I could write about how my life changed after this (in short, I became much more aware of spending time on things that are long-term important), but the relevancy to the present story is that I suddenly no longer saw my stock as just a symbol of company ownership; it was now the last gift that my grandfather gave to me.

A few weeks later, I happened to be browsing a newspaper, and looked up in the financial section the current value of Sun stock. To my surprise, it had doubled since I bought it, and my ten shares were now worth $1000. Months went by, and Sun Microsystems, a major provider of networking hardware during the dotCom boom, continued doing very well. They went through several stock splits: my ten shares turned into twenty, then forty, then eighty. Eventually, my $500 investment was worth around $6000.

I imagine that if my grandfather had still be around, he would have advised me to sell the stock. But I continued to view it more as a cherished gift than as a way to make money, and held onto the stock.

Years passed, and the dotCom boom morphed into the dotCom bust. The value of the stock sank and sank and sank, eventually getting down to around the same price that I originally paid for it.

In 2008, I received a letter from Sun, stating that they were initiating a reverse stock split, and I was advised to send my shares back to them, in exchange for a smaller number of shares at the same value. I complied, but rather than getting another certificate, I received a notice that I would not be getting a paper certificate, but electronic-only shares. It was disappointing to lose my physical stock document, but I still owned the stock itself.

In 2009, I learned that Sun was being bought by Oracle Corporation. Another disappointment. Oracle may be a great company, but there would surely be changes; some product lines may continue on, but the company that I thought was so neat in 1998 was coming to an end.

Not reading much of the details of the transaction, I assumed that I would get stock in Oracle now, but this wasn’t the case. Instead, I received a check from Oracle, with a note explaining that Sun stockholders were being given $9.50 per share of Sun.

So now I have $190, which, in some sense, is what remains of my grandfather’s gift. He wanted me to learn about business, and about investing, and about the stock market. I like to think I’ve learned a lot about these topics over the past twelve years, though you couldn’t tell it by looking at my $190 check. I held on to that stock despite common sense, because I valued it more sentimentally. I suppose there is nothing wrong with doing that, if that’s what you want to do, though I now realize that it wasn’t the stock itself that I cherished, but rather memories of my grandfather.