I am a Lego fan and a software engineer. I work on engineering problems in daytime and build Lego models at night. I occurs to me that there is a subtle continuation for these two types of activities.
What do they have in common?
Start with basic components and build an edifice. From Millennium Falcon to Bugatti Chiron and from Taj Mahal to Hogwarts castle, you can build almost anything with Lego bricks. People create complex software systems with basic built-in types and control/loop statements.
Break things down to small components or subsystems. When building a complex software system, engineers break the design down to components. That’s also how most Lego designers figure out their design details. They start with a vision of a model and seek solutions or heuristics to achieve the desired effect.
Be careful of making mistakes in a minefield. Lego experts know when they should slow down to double check some crucial steps. Those extra time help prevent expensive tear down and rebuild work afterwards. Experienced software engineers think carefully of any change that might cause unexpected breakdowns. A piece of sloppy code could become a source of problems when adding more features on top of it.
Roll back to a stable version if issues occur. A note for an App update often says bug fix. New issues may occur when adding new features to complex software systems. If we could detect the issues but could not resolve them, roll back to a previous stable version is the safest way. This practice would make sure that online services are not interrupted. Likewise, when you are building Lego models with thousands of pieces, you may find some parts don’t fit. And you know that the problem is not due to the current step. To prevent failing to complete the model at the end, you should promptly “roll back” to the step for that part.
Completing a challenging project makes you proud. Working in an Internet company that serves millions of users per month, you’re likely to deal with issues cause by high load. It takes hard work, persistence and intelligence to solve these problems. Similarly, nothing compares the feeling when you complete the 7541-piece Millennium Falcon set.
Sorting is a prerequisite for a large group of algorithms in computer science. For instance, a sorted array possesses a set of wonderful properties. With these guarantees you can devise clever algorithms. Modern Lego sets comes in bags with numbers, which correspond to major steps. This consideration reduces the pool size you need to search for a particular piece. Yet, your building speed is still limited by how fast you can locate pieces (and put them together). Experienced Lego builders tend to sort the pieces in each bag by shapes or color before they start. You can spend the saved time appreciate the design and building techniques.
Don’t judge the functionality of a piece of code by the number of lines. Some code are so redundant that the same functionality could be achieved with one third of the number of lines. Readability could also improve with fewer lines. A lot of People decide whether it is worth buying a Lego set using the pieces per dollar ratio. They think that the higher this ratio, the higher value the set has. Nothing could be further from the truth. To represent complex shapes, Lego manufactures ever more complex-shaped bricks. Large and complex pieces are much more expensive to make than regular pieces. And the functionality they achieve are not possible with simpler bricks. Thus pieces per dollar ratio is not an ideal way to determine the value of a Lego set.