Everything becomes complicated eventually

How simple software becomes complicated?

Developers use the word crud to describe a very simple project. For example, Stackoverflow is just a crud, I can build it over the weekend. Facebook is just a crud, I can build it over the weekend. Even Snapchat is just a crud, I can build it over the weekend. In a sense, it is true. But as the project grows in importance, so does its complexity.

CRUD is an acronym for Create Read Update Delete. Typically, a blog is a crud. The engine that runs it allows you to Create a blog post, Read it when it is displayed on the page, Update it if there are mistakes, or Delete it from the blog entirely. From that list, if you take Facebook, that's exactly the four features it offers. It allows you to create read update and delete posts, likes and settings.

In the beginning, everything is simple. Add one table for posts, one for users, one for settings and you have something to start with. But as any experienced programmer knows this is not where it ends. You don't need to be an expert in database design to add any of these features to your own social network. In fact, there is a one to one mapping of crud commands to SQL commands.

CRUD SQL Command Example
Create INSERT
INSERT INTO post VALUES(NULL,:myUserId,'My Opinion',NOW())
Read SELECT
SELECT * FROM post
Update UPDATE
UPDATE post SET content=:content WHERE userId = :myUserId
Delete DELETE
DELETE FROM post WHERE userId = :myUserId

But as soon as you start getting an interesting amount of users, your service becomes very slow. Now you have to revisit every query you have on your website and optimize the database tables with indices. And you also have to include it into your development routine. Any time you change a query, you have to review the site performance to see if you need new indices.

At the early stages, it is acceptable to change the design and functionality as often and as irregularly that you need to. But then, one day you change the design and huge number of users complain. When people are new to development, they don't even use version control, and this comes as a painful reality when they realize that they can't revert their code back. Now you have to make sure your code is on version control.

Having one server that handles the database, the application, and the static files, is a sure way to make your server crash and burn. You will have to separate concerns to make your application survive. This means restructuring your product to allow for this separation.

It's easy to write code that only you can understand. But as your application starts growing, eventually you will start sharing your code base with other developers. And it is a painful experience to see someone else read your code and not understand anything. Now you will have to improve the legibility and quality of your code to allow for a team to work on it.

Adding features is no longer a matter of coding it. You have multiple people in your team, and they will make their voices and concerns heard whether you like them or not. If you ignore them, your users will make their voice heard too. Making any modification means meetings, designs, A/B testing, focus group. It's no longer as simple as it used to be.

Nowadays, a perfectly usable and understandable feature will not see the light of day because of unforeseen ramifications. I can't help but think about the ability to edit tweets on twitter. It seems like a nobrainer. Just add the Update from CRUD and we are set. But it is not as easy as that. Twitter is not a single database that gets updated once and served everywhere. Once a tweet is published, it is copied to multiple streams that distribute all over the world. This process is established. Adding edit means revisiting all these streams once more to make sure they get the latest version. Technically they can do it.

But the problem has become more then technical. For users it adds a whole new experience. A user may write one thing, instantly distribute it to followers who would comment on it. Then, this person can now edit the tweet to be something completely different, now the comments will be out of context. Sure other social networks have the ability to edit. But no other social network is used in the same way twitter is used. The twitter developers have to think about the ramification of this feature before they implement it.

Deep down it is only a crud yet there are so many interactions, policies, and people tied to it. Making an update no longer means simply making an update. Running a delete command on facebook no longer means deleting a record in the database, it means censorship. Running a select command, at this scale, sometimes mean filtering and silencing.

It starts as a crud, but as it becomes important, it quickly turns into a very complex machine.


Comments

There are no comments added yet.

Let's hear your thoughts

For my eyes only