Hey guys! We thought some of you may be interested in an occasional peek into our dev process and the tech that powers your websites. Today, I’ll be walking you through a brief overview of how we structured V6 to be both more powerful and more efficient than V5.
V5 was mostly written in a coding style that’s known as a monolith - there are a relatively small number of large files that contain most of the code necessary to print each page. This is the easiest and quickest method to initially develop, but it becomes difficult to expand upon. The same segments of code get repeated, the files get too big to read easily, and you tend to code yourself into a corner. From a performance perspective, it’s also not ideal, because you have to load all of the content before you can print anything to the page - kind of like having to go and run all of your errands before you can get anything done at home.
V6 was developed using a style of coding called object-oriented programming (OOP). Essentially, each aspect of the website (categories, products, customers, etc) is segmented out into individual files, and only functions that relate to those aspects are included in that file. These functions tend to be small (think “give me a list of items” or “add a customer” for instance), which means they can be effectively reused across the entire platform. When developing, that means that instead of rewriting sections of code across multiple parts of the platform, we can simply call the function we need and pass in any relevant parameters.
V6 also uses this style to gain performance benefits over V5. For most pages, we can print only the minimum necessary HTML at first and fill in content using calls to our built-in APIs. If V5 is akin to you having to run errands, V6 would be more like planning out your errands, then sending out other people to run them and finishing tasks as they get back with the things you needed. And we’re already seeing the benefits – even though we have plenty of ways that we’re still planning to optimize the performance of V6, our most complex V6 sites are still faster than even our best-performing V5 sites!
Let me know if there are other topics you’re interested in or would like to hear about in the future!