When Tim Peters was working on designing Python, he wrote his beliefs down in 20 brief sentences, known as
The Zen of Python. These can even be found built into Python itself by typing “import this”. Lines 3 and 4 from this passage always stuck with me:
Simple is better than complex.
Complex is better than complicated.
The first is pretty self-evident. The second line threw me for a loop. I didn’t understand the difference. What did it mean, and how did this relate to Python, and programming as a whole?
Complex or Complicated?
It comes from a more discrete meaning of the words. Complex means a bunch of interlocking, working parts that come together to form a system. It refers to one concept that can be seen as a composite of smaller, independent pieces. Complicated, on the other hand, refers to the one concept that is large, and often confusing. To put it another way, a building is complicated, where a city is complex.
PHP and Python
By looking at Python and PHP, you can see the differences in how the languages are put together. Both have a large number of tools for a variety of purposes. in PHP, all of these functions and objects are in the global namespace, and can be called from anywhere. in Python, the language includes hundreds of modules that perform a lot of the same things, but require them to be imported. Python is complex where PHP is complicated.
The benefit of thinking about building complex systems instead of complicated ones, is the ease of understanding and changing these systems. In a complicated system, you run into issues where you have to keep a mental model of the entire system in your head to effectively work on it. This also means that making changes to the program is difficult, as the effects of the changes can be much harder to predict. By breaking down large problems into several smaller problems, it becomes much easier to solve. Let’s say we have a complicated web application, with various code doing various things are mushed together. If we take one part of the system, lets say database access for example, and we re-work it so that this is all handled by its own independent module. We’ve made the system more complex and less complicated, and there are several benefits to this:
- Now, when we have to do any work that pertains to the database, we don’t have to worry about how that data is going to be used, we only have to worry about a smaller problem.
- When we are using this database module, we only have to worry about how we interact with it, and not about it’s inner workings.
- If we were to ever change databases, now we can just replace this one module instead of changing code in several different places.
- We now have a database module that we can use in other systems.
So, by favoring being complex over being complicated, you can build more flexible, maintainable, and useful systems.
Simple, right?
Lucas Lopvet
Project Management
Lucas was born and raised in France and became a US citizen in 2007. He started at JHMG as a web designer back in 2010 and progressively added managing projects and company operations to his role.
Those 12 years of experience working at JHMG have given Lucas the knowledge that it takes to manage projects closely and thoroughly, by planning, organizing and managing resources for a successful result. As a front-end developer, he has extensive WordPress knowledge and experience, he has been involved in hundreds of development projects by designing, developing, deploying, maintaining and repairing sites for small/medium businesses, non-profits organizations, and more.
His lifelong interest in visual art began during early childhood, his areas of expertise include graphic design, web design and logo design as well as children’s book illustrations. He keeps drawing on a daily basis for fun and sometimes painting.
Lucas and his wife have 2 kids and have been living in northern Argentina since 2017 surrounded by the Andean cloud forest and colorful Toucans.