2014/09/06

The fall of little empires: A short guide on destroying your business

Look back over the past, with its changing empires that rose and fell, and you can foresee the future, too. (Marcus Aurelius)

This short guide, inspired by a few stories I've heard, or some purely hypothetical situations, is meant as a support for making all the decisions right, so you are more likely to put your early-stage company down and waste investor's money.

Never listen to anyone


First of all, never take the technical guys seriously. All they are really interested in is hacking and making things as difficult for you as possible. Each time they say something is too complex or simply makes no sense, ignore them. It’s mostly because they are lazy and not willing to do a great job. Or perhaps they are just seeking excuse for not working hard. Anyway, you are the only one with the vision, and the only one who really takes care, so trust your guts and get rid of them as soon as possible. Especially, if there are cheaper replacements available. After all, why would anyone be able to do more in eight hours? What, are they smarter? More experienced? Of course not! Experience doesn't matter, it's overrated.

Increase complexity


It doesn’t really matter you are not earning any money. The idea is great and that’s what matters. However, there are also the customers, that have their own vision on how your product should look like. After all, they are the ones that are going to pay for it, so why not to agree? It’s extremely easy, don’t be afraid. Just go to the meeting and every time they ask if you have that functionality, answer: “Yes, we are just working on that”. Another potentially satisfied potential customer? Great! Good job! Preferably, keep adding new features on a daily basis, so your technical team will get lost in complexity of a product that does everything and you will have a good reason to fire all of them. Also, meeting all requirements means your market is virtually limitless, therefore: you will earn even more money than you ever expected!

Presentation equals quality


Things must look good. No, good is not enough. They must look perfect. For example, look at iPhone. Why was it such a great success? Because of integration of services? Intuitive user interface? Number of applications and great SDK? No, of course not! People wanted to have one because: 1) it was glossy and modern, 2) it was trendy and innovative. Why was it trendy and innovative? Who the hell knows and why would that matter anyway? So, don’t bother with code quality, stability, documentation, test coverage or any other stuff you were never interested in. It’s yet another excuse for those technical lazy guys, so they can spend more time with their families and friends.

Engineering? Be "agile"!


The argument, that an average skyscraper has lower complexity than simplest Web application, and therefore building it without any documentation is not a smart approach, is itself one of the most stupid ideas I’ve ever heard. It’s software, it’s easy. How many times you see these guys you just ask to move things around the screen or change button labels, and they do that in seconds? Why adding new roles or changing user workflow would be different? Changing software is simple, everyone knows that. Also, if you create documentation, people will start asking why to do something that you previously said was wrong. Don’t waste your time explaining that.

What to do next when you eventually reach the goal


Now, when you applied those hints, you can go out there, stand in front of the startup crowd and tell the moving story of a rise and fall of an empire, that could be one once, if not a bit of luck and perhaps some more hard-working people. You earned it.

2014/04/22

Python tests using a mocked socket object

The problem was: how to test the whole process of retrieving data from a remote machine, if it starts inside a Django management command, goes through several packages, executes Celery tasks requesting and accepting data, that eventually ends up being validated against an XML schema and saved in the database?

2014/03/21

Python 79 characters obsession is more harmful than cigarettes

Recently this somehow turned out to be my favourite topic when discussing programming style in Python. Or, perhaps, not the one I really like to discuss, because I feel there is not much for discussion left for me, but the one I find extremely important when working with other people on the same code.

To put it shortly, I believe that obsessive obeying of the 79 characters maximum line length in Python is more dangerous than smoking pack a day. Why? It's just too stressful, too frustrating and actually has huge impact on others people health, too. Well, at least on mine. But you know what is really wrong with this? It costs a lot of money. But that's a different story.

2014/03/19

DOs, DON'Ts and some good practices in Python and Django

Here is my little collection of things I found in Python code over last three years or so. I believe this might be helpful addition to well known PEP 8 programming recommendations or at least inspire a little bit.

First, learn more about Python and conventions

DON'T

object_select_id = ''
for i in range(len(object_name) - 4):
    object_select_id += object_name[i]

DO

object_select_id = object_name[:-4]

DON'T

def DjangoFunctionView(request):
    if request.GET['email']:

DO

def django_function_view(request):
    if request.GET['email']:

2014/01/12

Yet another approach to Django permissions

django-permissionsx is an alternative to Django permissions system. The main difference is that this package does not store authorization logic in database, but instead allows defining permissions on the view level using concise syntax (similar to complex lookups using Q) and performs authorization checks against HttpRequest object. You could think of it as a wrapper around common patterns such as @login_required decorator or checking request.user.is_authenticated().

You will find that defining permissions is similar to filtering QuerySets and complex lookups with Q objects. For example:

P(user__is_authenticated=True) & P(P(user__is_staff=True) | P(user__is_superuser=True))

means that the user will be granted access if is logged in and is either a staff member, or a superuser.

The goal of this project is to make authorization related code as much reusable and consistent as possible. Therefore, permissions can be easily used for multiple views, inherited, used in templates or for building mobile API using django-tastypie.

If this sounds fun, check out the Quick Start section. Also, any support, testing and opinions are greatly appreciated!

2012/09/13

You can't win. You can't lose.


We had one of these late night discussions with a friend of mine, during which things tend to wander around life in general. Sitting at a bar, having a few pints past no one knows when and how, and then he suddenly said something like: "You know what, I really want to achieve... Something. To create something successful." We are both programmers, so I thought he was talking about a software product and a business around it. But it turned out he wished to achieve just whatever was final, perfect, or appreciated by others. And then I realized these terms are just empty - there is no success, there is no perfection, and no failure either. Nothing is ever finished, as there are always ways to make things better. (By the way, this conversation inspired me to write the post on reasons for losing motivation.)

2012/09/09

Evolutionary explanation for a boring job


If people seem less than motivated, it may not be about the money they earn. They might be just bored with the job you have to offer.

The fact you are able to read this blog post is a side effect of the same evolutionary mechanism that helped our predecessors build first stone tools. The most popular explanation for these exceptional skills is that it helps in getting food more easily. This is true, to some extent.

It has been proven that chimpanzees using tools are able to get even ten times more nutrition from the same source, compared to individuals that don't. But does is really explain why some of them demonstrate such extravagant behavior like using a rolled leaf to have termites consumed in a more stylish way? Is it really necessary for increasing their chance of survival?