Category Archives: Programming

I just shipped a single-page application without any frameworks and I feel fine

This past week I built a tool for a freelance client’s website that allows their visitors to find the nearest dealer for their products.

The previous version of this tool was written in Classic ASP (which I also maintained) and pulled its data from an MS Excel spreadsheet. Yes, you read that right, an Excel spreadsheet was the backend data repository for a live website in 2016. I suspect this approach is still out there more than us modern web developers would care to admit.

Anyway, my first job was to move the Excel data out to a real database, MySQL in this case simply because that’s what the web host supported. It ended up being pretty easy thanks to Excel’s ability to export to CSV.

Next, I built out a basic search class for sending queries to the database. I needed to be able to filter the data by any permutations of the available fields (think business name, city, province, etc.). A few simple 5–10 line functions later and it was done.

The API was even easier, I just checked $_GET for my trigger argument and called the associated function in my new search class, returning the result as a JSON payload. This made implementing the client JavaScript super simple.

Other than jQuery (simply for the XHR abstraction) the client-side was built with vanilla JavaScript. I had a few functions for drilling down in the filters, for example, if you selected a province I would only show ‘city’ options that were in that province. There was also one for rendering the HTML of search results. None of these were more than 15 lines of code.

I’m quite happy with how it all turned out and so is my client since they understand the code without having to learn some framework. They’re also able to make some changes on their own without having to involve me, which quite honestly I’m ok with.

Don’t get me wrong, I’m not against web frameworks, I find them quite useful when they’re appropriate. I do firmly believe that not all web things are in need of a framework. Next time you’re tackling something small, see what it’s like to write it by hand. You might just surprise yourself with how easy it can be and how simple the result ends up.

Looking forward to 2014 (late post)

Oops! I wrote this back in December but somehow forgot to post it. It’s a bit late, but I think it still has value.

Early this year I put up my list of developer goals for 2013. Here’s a quick summary:

  1. Learn Git
    • I’ve been using Git exclusively for source control for 10 months at Wattpad. I wouldn’t classify myself as an expert just yet, but I’m very comfortable using it and most commands I use are built into my muscle memory now.
  2. Launch an app that generates money
    • While I haven’t created and launched an app of my own that charges money, earlier this year I was heavily involved in a new project at work that required integration with Stripe for processing transactions with customer cards. I’m going to consider this a 50% success.
  3. Publish some open source code
    • I haven’t actually published any code yet, but lots of time has been spent learning the tools that I would need to do so (Git, GitHub, BitBucket, Markdown).
  4. Write automated tests for most of my code
    • I write more tests for my code than I did a year ago, but I don’t think I’m at the point where I’m more likely to have tests for my code than not. At work we’re pushing very hard towards TDD, and I’d say we’re getting close. I’m confident it will get there.
  5. Find a mentor
    • 100% complete! Very early in the year through the magic of Twitter I was connected with Jeff Carouth, a PHP dev. out in Texas. We’ve had a number of online chats and even a few Skype calls to talk about various development topics. Our discussions often turned to Domain Driven Design (DDD), a concept that I was familiar with in name only, but now understand much better. I’m currently working on applying DDD to some Javascript projects that I’m working on.

Looking back at the list I’m a bit surprised to see that overall I have done decently well. Far better than in previous years where I didn’t end up touching any of my goals throughout the year.

It’s not your employer’s job to keep you at the top of your game

This past weekend I attended the TrueNorth PHP conference, hosted by the GTA PHP user group. It’s the second year that the event has been held and I attended last year as well. Based on my experience it’s a great event, and the only PHP focused conference that takes place in the Toronto area.

As with most conferences, sometimes the most insightful things come from the hallway conversations that happen outside of the scheduled talks. This conference was no different. There was one specific conversation that got my attention. I was talking to a couple of guys that were lightly complaining about how their employer doesn’t send them to any conferences, and that the were only able to come to this one because it happened to be in the neighbourhood.

My opinion on this is that as a developer, you need to take responsibility for your own professional development. Your employer hired you to perform a specific job, so as long as they are providing the tools required to get the job done and paying you your agreed salary, they’re holding up their end of the bargain. If you want to learn new skills, experiment with new technology, sharpen your saw or whatever, that’s up to you (although don’t be surprised if you later get canned if you never attempt to get better at what you do). Your company being willing to foot the bill for these things is a perk, not a term of employment. It’s a little different if there’s a course or conference that your employer asks you to attend, in this situation they have decided that there is some business benefit to be had by you attending, so I do feel they should cover your costs.

For me, my employer probably would have paid for my conference ticket to True North but I didn’t ask them to. I wanted to go because I have a strong connection to the PHP community and I knew that there was going to be the possibility for some great conversations. It’s the same reason that I watch lots of online tutorials, listen to podcasts and reach out to others on sites like Stackoverflow. I need to constantly be in a state of growth, otherwise I quickly start to feel like I’m stagnating or falling behind and that’s just not acceptable to me, and it shouldn’t be acceptable to you either.

So take ownership of you skill development, you’ll be happy that you did.

Update (Nov. 15th, 2013): So it turns out that through absolute serendipity a friend of mine that I met through the PHP mentoring community just happened to post a similar post on his blog a bit over a week before I wrote this.  I think he’s managed to distill the idea better than I have, so you should check out his post over at http://carouth.com/blog/2013/11/03/its-your-career/

My ToDos for 2013 (or resolutions, if you’re into that)

I like having a roadmap, it’s a great way to focus your mind towards a goal.  Personally I find that it’s also a great way to practice brainstorming, scope management, estimation and execution.  So, here’s my list of developer type things that I plan to achieve in 2013.

  • learn git
    • I’ve used both Subversion (SVN) and Mercurial (HG) for years, and I don’t regret my time spent with either of these systems.  However, it seems that at the moment git is the cat’s ass in terms of version control, especially for open-source projects.  I have very minimal experience with git, having only really used it to check out a copy of an open-source project for use in an application that I’m working on.
  • launch an app that generates money
    • Building an application is easy, and I truly believe that anybody with access to a computer can do it.  Building an application that other people use, and are willing to pay money for, is a whole different bag of rice and requires a different set of skills.   By building something that generates actual dollars, I’ll bet exercising skills that most developers that are working at a job don’t get a chance to do, which will make me a better overall developer.
  • publish some open source code
    • As DHH just recently said on the Giant Robots Smashing into other Giant Robots podcast, “If you limit your exposure enough, anybody can be the best at anything” (or something like that).  I now strongly feel that by putting my work out there for other smarter than me people to see, I’ll become a smarter and better developer.  Or, I’ll learn that I actually am the smartest developer out there… (incredibly unlikely)
  • write automated tests for most of my code
    • 2012 clearly indicated to me that automated tests add a ton of value to a codebase, both in terms of overall design and maintainability.  For code that I now have tests for, I’m so much faster at making changes with confidence, allowing me to get more done than I have ever done before.  In 2013 I want to keep this going,  so that in the end I can get more done.
  • find a mentor
    • At GrantStream Inc. I am one of the most senior developers on the team (7 years).  In order for me to continue to grow and learn, I feel that I need to learn from developers that have both more and different experience than I do.  As a start, I’ll be adding my name to the list over at phpmentoring.org.

Do you have any developer-focused goals for 2013?  Anything you think I should add to this list for myself?  Let me know in the comments.

Temporary Burnout…

For two weeks recently I suffered from a significant lack of sleep. All of it completely self imposed by projects I decided to take on.

As I sat there about to go to bed at a normal time (11pm) for the first time in weeks, I took note of some of the side-effects I’ve noticed while I kept pushing.

  • it’s hard to concentrate, especially for long periods of time
  • Almost impossible to work through even medium complexity code in my head
  • It’s actually hard to go to sleep, maybe adrenaline kicking in?
  • Very little creative thinking, more like a drone
  • I suck at conversations, and I probably sound like an idiot
  • I can’t plan anything more than 20 minutes in advance
  • I experience random, dramatic outbursts of energy, and it’s a bit creepy for people around me
  • My co-ordination stinks, I keep stubbing my fingers
  • I feel achy and sore
  • It feels like my heart is beating faster (a weird thing for me) I did check it and it’s normal, just feels faster
  • Time goes by faster (perhaps explaining the heartbeat)
  • I can’t be bothered to listen to podcasts or any of the other sources of information that I usually do

Kind of like this guy:

I think this all means that I suffered a temporary burnout. It’s a very bizarre feeling, almost like I didn’t have complete control over my body and mind.

I’ve heard some people say that in order to successfully run a startup, you need to be putting in 60-80 hours a week to get things off the ground. After these two weeks, I full-heartedly have to disagree. I don’t see how that sort of schedule can lead to any sort of creative thinking, unless you’re looking for hallucinations, which depending on your goals, you just might be! I suppose in short bursts like this (ie: a week or less) for a deadline might be necessary, but working at this pace as a long term strategy just seems silly to me.

After this craziness I’ve decided to go back to a more regular schedule and already I’m starting to feel the side-effects I mentioned above fade away. I’m really looking forward to feeling more normal again

[UPDATE: Apr. 28th, 2011]: I just wanted to confirm again, I’m feeling fine.  I found this period to be a very interesting experiment.  I feel like I learned quite a bit about myself and specifically the type of person that I don’t want to be.