Tag Archives: job

Did a small startup and quitted again – what I learned

A little over a year ago I quitted my day job as a fullstack webdeveloper at a small company in Copenhagen. I did this in order to work fulltime on a startup with two friends of mine.

The startup company (now known as simply “startup”) is doing LIVE events (video recoding and streaming) and hosting the videos/audio clips afterwards, for shareholding companies in Scandinavia.

The project was already running live when I started fulltime on it, as I had started coding on the system about 6 months before in my freetime.

At first we where 2, with a consultant, then we got the last buddy to join and we were 3. We worked from our homes, and used a lot of time doing work, brainstorming and coming up with new things and ways to do the same – only faster, easier and more simple.

We were 3 different people, with different trades and backgrounds:
* One sales person
* One technician
* One developer (me)

We have since grown (by a lot) and are now 6 fulltime workers and 2 student workers. We also lost one of the original partners a few months ago, so a lot changed in the company since we started.
I am still the only developer in the company, and this is where the chain broke for me…

As many people know, working from 8-16 is not a problem. I had recently become a dad, so that life suited me perfectly. But when doing a startup, you are not expected to work only from 8-16 anymore. Time is consumed heavily, and if something crashes, you are expected to fix it right away.

What I learned.

I have spent a lot of time doing Linux server setups. More time than coding i’d say…
I had some experience with Linux servers, but that was in simple environments, with low traffic.

It’s odd that when first starting out, you are “hired” to do coding, but end up fending hacker attacks and handling server stability and server load issues instead.

Before doing the startup, I had mostly worked with PHP and Apache.
I had some experience with Ruby On Rails (rails), which I liked, so I decided to choose this stack for the startup.

Rails helped speeding up the coding – a lot. Of course, rails is a large framework, which has a lot of contraints and rules you have to know and follow – or you will die.
I chose rails for all the gems out there, the community and documentation. I also loved what ruby in general looked like.

That is also what I generally hear about rails: “lots of gems, just pick a lot of those, and you are done!”

But let’s face it, that’s not the whole story. A year into the startup, and I’m using only 10 or 15 different gems (besides the rails ones), 5 of them are dealing with deployments (capistrano)… So i’m using 5-10 gems? not a whole bunch.

Rails have also bitten me in the arse a lot of times. I know that if I was properly schooled in rails, I might not have done a lot of things the way I did it. But that’s just me… “Learn as you go”.
But as rails is as large (and complex) as it is, you cannot just: “Learn and go”.

I have spent a lot of time refactoring code, learning new things, handling odd issues, only to find an odd gem, that handles the exact same thing (which i didn’t know about until later). And why did the rails core team deprecate the ActiveResource lib? It was so easy to use… (I’m using the gem now though)

Scaling rails was easy enough though.
I had a load balancer in front of my servers, which made horizontal scaling easy enough.

However, this wasn’t always enough…

Our systems should be able to handle at least 1000 requests per second, for 1 hour or more in a row (during LIVE events, to listen for changes in the player).
This might not seem like a lot, but if you have a server that can handle a given request in 100ms, that same thread can only handle 10 requests per second.
That meant, that at one time we had 6 servers, serving the same content, and they still couldn’t keep up with the number of requests coming in.

I then started using Redis as a page caching mechanism, and we can now handle around 14000 requests per second (in theory), using only:
1 load balancer
2 redis servers
2.5 web servers

Would I choose rails again for a startup? Properly not… The reason being, that I really don’t use most of the things rails offers, and it’s just so hard to do things differently.

PHP on the other hand, lets you do a lot more. And with composer (e.g. using packagist) being more and more adopted, code snippets are shared more and more.

I’m not saying that PHP is perfect – far from it! But it suits me a lot better.

What I’m taking with me from rails is:
Automated deployments
(and a lot more…)

It should be said, that I’m not a big fan of frameworks though. This goes for both Ruby and PHP. I cannot conform and tend to use bits and bites from different frameworks to handle my stuff.

I just quit, now what?

I have just said goodbye to the startup, leaving roughly 18 months of thoughts and code behind.

I am returning to the PHP world, after having left it behind for a long time. And I am actually returning to the same job I had before starting my startup.
This (new/old?) job has other developers and designers, that know what they are doing, which will be nice to get back to.

I feel a lot older and wiser though, having spent time doing all the developing, server handling and project planning myself. I feel like I have a lot more to offer now.

I also think that every developer should try to do a startup. I had often thought about it, but never dared venture into it. It seemed way to risky.

And it is…

You cannot make mistakes, especially if you have something to loose. That being a house, a car… or more importantly: have a family to take care of.

But you somehow grow with the experience… and become better. Perhaps not at coding, but at taking responsibility and at thinking about decisions.

Technical stuff

For those interested, this is what I used to develop and design. And the server software.

Software used (on the Mac):
* Firefox Developer Edition
* Google Chrome Canary
* Pixelmator (Graphics app – it’s dirt cheap, and works very well)
* Sequel Pro (SQL app)
* Sublime Text (2+3) (Lots of modules)
* Terminal

Server setup:
* Ubuntu (very easy to use, lots of updated packages etc)
* Nginx, with passenger (played around with puma + nginx in the end as well – just not in production)
* Redis (as a general cache and page cache)
* RVM (very easy when upgrading servers to new ruby versions)
* I also used Nginx as a load balancer, and it works very well.
* The VPS servers are from digitalocean.com (referral link)

Please note: This is not meant as a PHP vs Ruby blog post, but simply my experiences with it.

Switching coffee and PHP testing

Whoa, long time since my last post.

Anyways, what has happened recently?

I’ve switched jobs and are now working at a small IR firm in Denmark, which is located on Amager.
We do webcasts / Quarterly reports for firms in Denmark.

Saying “We do” is a bit off though.
I don’t, that is. I help out if we are missing a technician, else i’m creating webapps to help the business complete daily tasks faster.

And how is that going?
Well, I’ve completed a few systems already, and within one month the first system was deployed to the wild. It was fun to create a whole new system, especially because I am on my own.
Roughly speaking, i’m the only developer there, so I don’t get a lot of sparing on the code i’m writing. Only the designs and the general “look and feel” of an app.
It’s fun, it’s different and I like the pace.

An other thing i’ve been working on, is moving the old and new sites to new virtualized servers.
I’ve been managing a few servers for the last 6 years, but not anything on this scale. But it’s fun. It takes a little time from the programming though, but after it’s configured, it mostly runs smoothly.

I developed an SSO system and deployed it to the wild a few months ago. So far i’ve only had minor problems with it, and all things are running great.

And yes, I code in PHP. It was by choice actually. On my last jobs I’ve coded Bash, Perl, C, C++, then Java and then Ruby on Rails and on the new job I was given a free choice.

So I chose PHP.

“Why?” you might ask, when there’s soo much hype about Ruby on Rails these past few years. Without starting a flame wall in the comments, let’s just say, that while Ruby is a beautiful language, I just couldn’t get accustomed to the Rails frame work. So many rules, so many conventions. So little time. (The testing was nice though.. but meh)
I might return to Rails someday, but for now, it’s PHP controlling the battle.

The webapps i’ve created at my new job are all created using my small github project called php-mvc-base, which basically is just a structure I use to get started on a PHP project. It gives me “nice urls”, but other than that, the rules are pretty basic.

The structure outlines as follows:


And all controllers (ofc) go in the app/controllers folder.
So let’s say, that we want a new controller at the URL http://localhost/my_projects/ there is basically two things that can be done:
* Create a folder in the app/controllers folder, called my_projects. Place an index.php file there, do the controller code.
* Create a my_projects.php file in the app/controllers folder. Do the controller code.
Both options give the same path.

Simple and clean (well, at least in my world. And I use the folder approach btw, if you wanted to know).

(You can find the project at http://github.com/jimmiw/php-mvc-base along with a simple example.)

I’ve also released a few javascripts to CodeCanyon and I’ve had a few purchases already. It’s nice knowing people can use your stuff. I mostly coded them because I had a problem they could solve, but releasing them there, made the code so much better. This was mostly due to the javascript approval team on CodeCanyon (Thanks Jeremy McPeak for the patience and help).

You can see my profile on CodeCanyon here: http://codecanyon.net/user/jimmiw

I’ve also taken over a small project with a designer friend of mine called Janus C.
The project is familielivet and is a danish page the centers around the family. It’s free to use and hopefully easy to understand and use for all ages.
I’ve not actually released any code to the system yet, but we a doing some design changes and a total rewrite of the codebase, and it will hopefully be released soon.

After switching from Ruby to PHP I missed the easy testing that Ruby offered. Thank god for phpunit btw, this lovely tool simply makes testing fun again. Be sure to check it out when you are writing tests for your webapps (As you should be!).

On an interesting side note, Rails offers the ease of different environments for you to use.
E.g. Test, Staging and Production.
I actually found a simple way of doing this with PHP as well, but it requires that you have access to the apache configuration files (which you at least have on your development machine).

Roughly speaking, all you need to do, is to add a variable to your apache config, and then use the $_SERVER variable in PHP to test what environment your are currently working on.
Nice and simple.
A small example is this (taken from my development machine):
Just add the following piece of code to the bottom of your httpd.conf file
SetEnv APPLICATION_ENV "development"

And in PHP you can do the following when initializing the database connection:

  // development machine
  if($_SERVER['APPLICATION_ENV'] == "development") {
    mysql_connect(HOST, USER, PASSWORD);
  // add as many environments as you want
  // the ELSE part is used for production. On shared hosts you cannot edit the
  // httpd.conf file, so if nothing is set, assume it's Production ;)
  else {

I have a “unit” environment as well, which I use when testing database models using phpunit tests. This makes it easier to wipe database tables when starting tests.

And I switched from black coffee to Lattes.
No idea why, but after drinking black coffee for about 10years, they suddenly seem a bit boring…