What is clean code?

I’ve always really wondered what people thought when they hear the term “clean code”.  I often hear people say it is commenting your code, while others say object-oriented programming, and some just say “no spaghetti code”.  While I agree with all those, I tend to lean towards object-oriented programming the most.  In fact, I don’t even believe commenting your code should necessarily be a function of clean and legible code.

Lately, my team and I have been tackling a goal I set to clean up our code, to make it faster and more reliable. Prior to starting this project, we had just over 200k lines of code.  Had a lot of duplication of functions, a lot of code that could be simplified by turning into more generic functions and a bunch of functions that existed but never used.  200k lines of code is a lot, but we are also building a very complex system and we do use some open source libraries like Mootools that add to the total.  However, given that JavaScript has never been particularly nice with OOP, it is difficult to make nice clean extensible code and save on lines of code.  We’ve built hacks into our JavaScript to mimic OOP to our best abilities, but it still isn’t as perfect as you’d find it in languages like Java.

As you can probably tell, my approach is to cut down on code by making functions and existing code more modular and used by more sources, as opposed to living in the cache as a one time use function.  Granted that the function is clearly written, declaring variables in plain text and using variable names that make sense for what they do, commenting becomes much less relevant, especially when the functions themselves are less than 30-50 lines of code (including line breaks). Commenting is something I felt was always added to help another developer understand one developers sloppy writing.  Yes, creating code is like writing.  If you cannot properly outline your introduction (declarations), your content (the main code) and the conclusion (clean up and return statements), then no one will understand what you are attempting to carry out.

Continue reading…

The Power of Social

Over the past years, we’ve all become more social.  Many will argue that this has lead to our lives being more public and having less privacy.  In theory it may be true, but like anything else, you must be conscious of what you share and who you share it with.  Social networks, the majority of them, provide you the tools you need to manage your privacy.  This post isn’t about privacy, it is about how the world has changed since the web has become more social.  Early in the social days, websites would mainly function with users hiding behind a pseudonym.  Later, we moved to sharing content with friends, to now implicating friends into our activities.

When I started on the web, I’ve basically used it as a tool, to do my homework and so on.  Not long after, I began using content sites for the games I played (and loved).  But I quickly began posting on fan sites and soon enough was helping manage some of those sites.  It eventually lead me to creating my own sites.  My sites were popular in the day, not the size of Facebook or Myspace today.  Just over hundred thousand users and over two million pieces of content (posts, comments, downloadable content, etc) created in a little over a year.  The sites however lacked on key aspect… the ability to drive new users (or at least our users’ friends) to the site.  Which is why sites then focused on retention and we did that extremely well, I retained the majority of my users quite well.  But we also didn’t have to fight for the user’s attention with many other games, apps, or sites.

Sites slowly moved to making users less anonymous and reveal their real identify.  I can’t quite say who started this movement, but Myspace was a big player in this field, as it started to become popular.  Myspace focused on users sharing posts together and gathering attention with fancy layouts.  Facebook was not far behind, but focused on sharing pictures between friends with the ability to tag pictures.  Soon college students all over North America were sharing pictures of their drunken adventures from the night before.  What many didn’t know was that around the corner was the revolution of the web, where one could monetize social activity.  These sites still focused heavily on retention and continue to focus on retention, though partly giving way to virality in order to grow the sites (or networks), apps or games out.

Applications and games began to use social networking sites to share content between users and their friends.  Some of the things shared were as silly as “How are you in bed”, but were extremely popular in their early days.  It was simple, users wanted to see the results of them completing the activity and comparing it with their friends.  That is why quiz apps ruled the Facebook platform when apps initially launched.  People wanted to see what Movie Star they resembled the most, or what Harry Potter they were like, or what year they would die.  Soon we had the games where users would share the activity on their levelling up, their completing of challenges, and harvesting of crops.  But those were mostly in the context of being virtual, rarely implicating the users in real situations, like lifestyle events.

Today, we are seeing the shift of social on lifestyle events and things users do outside of the virtual world, going back to getting users to get off their computers and enjoy their lives in different ways.  People are rewarded for sharing the places they’ve been, people share all the music they listen to, users share what they discover while shopping, or their experiences on vacation as they are enjoying it.  Those applications are heavily focused on virality, much less on retention.  Many products seem to focus on the product being stellar enough that users will come back to it or their friends will bug them to come back.  This is where I find social has done a complete 180 from users being anonymous to being pressured to come back.

What lead me to this post was not the history of how we got to where we’ve gotten today, but the power of social activity.  We’ve likely all heard the concept of “word of mouth”, I like to think the social experience is a derivative of that.  People see an activity that was shared, being curious as we all are, we will check it out to see what it is about.  Take me creating a radio station as an example.  I create a radio station in Spotify, people are either curious to see what I listen to or like what I listen to, which leads them to subscribing or at least trying it out.  I will also do the same with my friends and see what they listen to, often subscribing to their activity.  It helps me discover music and keep myself entertained.  The same can be said about any other variety of applications or products out there, pimping out your friends to help you discover new experiences, though really what they are trying to do is get more people using their product.

What continues to fascinate me is how these applications, games or products that now focus on the viral aspect of social activity do so at the expense of other core values, such as retention.  Retention was always a core to any product and continues to be in games or applications that have no up front costs but have a micro-transaction economy.  Using products like Spotify, Nike+, or Yahoo News, I was never really asked to come back or even given the a notice that coming back may result in me getting something out of it.  Instead, I am reminded through my shared activity that those were great products which benefitted me and I should go back to it.  In a way, I am shocked that they aren’t trying to get me back, but also happy they aren’t annoying me either.

Today, most of the products I use are social.  I like they are social.  Not for the fact that I am giving away all of my privacy, but because I can express myself, share my experiences with others, and review my friends’ social activity that allows me to discover new amazing things.  Social has brought me to real life events that appealed to me (like Camaro Fest), has allowed me to discover new amazing products that made my life easier and better, and also allowed me to have some more variety in how I go about to my daily activities.  Of course, there is a very large flow of content, the tools to curate this content is becoming more popular, but in the meantime I am watching what I share with others and what I subscribe to.

Data driven design

Data driven design is a rather rare term that gets tossed around these days.  I often find those suggesting they are making decisions based on data are doing so on a limited set of data, unable to show the entire picture.  As I mentioned in my last post, data may not have been something I could easily query or find the answers to all my problems, at least not until we’ve launched our latest platform.  Having this platform has transformed the way I think and react to events happening within games or applications.

It is great to have a large amount of reports, often a good set of pre-defined reports will cover the majority of questions regarding the general health of your application, game or website.  However, digging deeper and finding the answers necessary to making the correct changes require a unique set of questions that will help fetch data to analyse different results or falloff points.  That’s to say, in order to be successful with a data driven design model, you need someone capable of asking the questions, a system to produce the answers, and someone capable of analysing the answers.

Asking the right questions I’d say is likely one of the toughest parts of this design model.  Often a question like “why is my revenue down? Are users not buying items?” is far from an adequate enough question.  You need to ask questions like, what levels are my core spenders in?; what is the break down of my daily active users?; how well do new items sell?; what are the top selling items?; and so on.  I’ll use this example throughout this post, as it is a good question, often difficult to answer.

Common problems found in trying to figure out problems with revenue is that the first place one looks is the item sales performance.  Many times, the breakdown of the top selling items seems to be relatively the same as a high spending day, but simply less users spending.  Some may mistake this as a sign of someone being bored of items and order more items to be developed.  However, a proper analysis would be to look at the break down of spending users by level as well as a break down of daily active users by level and compare those on high selling days versus lower selling days.  Other places to look at is the game economy (a currency imbalance in the economy?), break down of spenders by source, look at the user’s inventory amount, see if the users have room to build. These breakdowns would identify problems.

The system for finding answers is crucial.  A proper system will allow an analyst the ability to find the answers he needs without asking developers to run queries on data.  As such, it makes the model more efficient and begins to set clear boundaries for what an analyst, a developer, a designer, etc. should do.  A system capable of fetching data, processing it and graphing it in a clear concise way will likely lead to finding out the proper answers and making fewer judgement calls.  Judgement calls, in my experience, are often guesses (including educated guesses) on why certain events exist.  This isn’t a shameful plug for our platform, but ideals of any designer or analyst or executive who wants to know answers.

Analysing data retrieved can often be tricky.  Sometimes, one will be required to process through events (like bugs or marketing events) to see if the data is part of a trend or whether something affected the data.  The analyst will also need to identify whether the data they now have is useful or whether they need to dig deeper.  Taking my previous question of “why is my revenue dropping”, we  found that core spenders were often within a range of levels in the game, keeping those spenders happy will result in higher sales.  The users need to have more buying options, room to build those items, space in their inventory to buy the items, incentives to buy them (cool looking) and of course money to buy them items (must be priced properly).  The data would show whether those are addressed, by ensuring there are no sharp drop-offs in the break down of daily active users by level, seeing something like that would often mean the users are missing something at that level that makes them want to continue paying or even spending.

Data driven design, I think, is relatively new and underused.  Larger companies use them and the results are clear.  But looking at smaller or medium sized companies, it is clear this simply isn’t done.  In many cases, likely due to the lack of staff / time or expertise.  This is something I hope everyone could do or use, without someone with a PHD in stats or without needing a team of developers a year to build.

Algorithms vs the world

[EDIT: For some odd reason, WordPress decided it wanted to delete the rest of this post… so here’s to writing it again]

Haven’t you ever told yourself while in school : “I won’t ever use this again, why am I learning this?”.  Well I do all the time, being that I am fresh out of university, those are still thoughts that continue to come to me. However, recently I’ve discovered that I am beginning to use concepts learned in school in order to adapt them to real world scenarios.  More importantly, I am using algorithms.  There are two algorithms I am using primarily these days, that revolve around Tree Structures and Statistics (as in that really confusing class you need to take when enrolled in Computer Science).

Continue reading…

New chrome bezels and UPS frustrations.

Firstly, I have to say, as much as I love my Camaro, the one thing I wished Chevrolet would have done is get rid of all the plastic.  However there are solutions in doing that, but will require you to look around or spend a few extra bucks.

In my case, I was really looking for ways to get rid of the flat black plastic bezels on my Camaro.  At first I didn’t think they looked too bad, but it has become more and more of an annoyance to me since changing to chromed rims (which I love by the way!).  I bought a set of chromed bezels from carid.com, supplied by Defender Worx.

Continue reading…

Internal launch? You don’t say!

I’ve gotta say, the past few weeks have been tough, but exciting all the way through.  The questions we’ve asked ourselves were how to be innovative, but fun at the same time.  Often that is a mix that doesn’t go well together, which has lead to a lot of work massaging the user experience and making the game fun.

I still can’t quite tell what this game is, but I can assure you, it will all be known in a matter of days as we await the final word from our partners. I can’t wait to blog and write about this game.  By far one of our greatest games, the technology under the hood is very unique and the game mechanics are ones you’ve never seen in a social game before.

In the meantime, enjoy an image of squirrels being annoying around some golfers attempting to make their putt.

After Day 1 of Camaro Homecoming

I must say, I was shocked at the event’s first day.  It was nothing short of amazing.

The event started at 9:00 am that morning, yet I was there at 9:05 am, thinking I was early.  But, upon arriving at the event, I was in a line of about 20 Camaros, waiting to go through registration.  As I got out and walked towards the registration tent, I noticed a few hundred more Camaros already parked in the mosaic formation.  I rushed along to get my papers taken care of, went back to my car to get in line to park my car in the formation.  As I was driving along, I was greeted by GM Employees, event organizers and police, all seeming to be thrilled to be a part of something so big and full of energy.


Upon placing my car (near the very back of the formation), I got out to great my fellow Camaro owners and ask about their drive.  A few of them from Quebec, though a large portion of those around me were from the US, particularly Indiana.   I then buffed my car a little, since it was quite dusty there and I had driven in a puddle along the way.  It must be perfect you know. Continue reading…

First day of the Camaro Homecoming

I’ve been looking forward to this event quite some time.  I have spent the better part of the past few days cleaning and polishing every inch of my car.  Boy is it ever shiny!   I can’t imagine what the event will be like, but coming home after work yesterday has basically left me in shock, driving by Camaros at nearly every intersection, some sounding so godly that makes mine sound like some mediocre4 banger.

Nonetheless, here is my car, ready to go out and meet hundreds more of its brothers and sisters, at the Camaro Homecoming, hosted across the street from where the Camaro is built.

Beta beard after 3 days

Say welcome to the beard

Our latest project at Social Game Universe has been extremely exciting.  Excited because we are innovating and creating something totally unique and fun in a social game.  I look forward to announcing what this project is, in the meantime, I will talk about this growth I now have on my face.

Unfortunately I was blessed with unusually fast growing facial hair.  As you can see in the picture, that is only after 3 days.  You can only imagine what it is now at 6 days.  If  you cannot imagine it, pay attention to future posts.

As much as I hate this beard, it is my commitment to the project and the team behind it.  This thing is irritating, itchy and I can’t stop getting food pieces stuck in it! I want to get this shaved off fast, any delays will result in my irritation increasing.

Needless to say, the date is set and I will do anything within my capabilities to ensure no delays!

Scaling – boy I’ve matured

Sometimes I like to think of the past as a good example of how much I have learned.  Scaling is a particular domain that I have learned a lot over the past year.  2 years ago, I had always assumed that scaling merely consisted of upgrading servers.  The concept of putting servers together to work side by side was baffling to me.

I do like to poke some fun at my past, only because today I am proud of my accomplishments, proud to say I have scaled a product that can easily handle hundreds of thousands / millions of users with a very small pool of servers.

However, the point of this post is not so much to poke fun at myself, but to teach some of the places I have made mistakes and how to get around them.  Of course, without giving some of my secrets or the key to making extremely responsive APIs, like igapi.

Continue reading…