Progressive Learning in Coding: The Elevator Approach

Learning new skills can be hard and when working with complex technology like coding it can be confusing. Over the years as I have learnt more technologies, I have found an approach that has helped keep learning simple. This is something I was taught before when I first started and continue to pass on to my mentees as a senior. The approach is the elevator effect and in this post I will breakdown the process.

The Elevator

The simple concept is to start small then build upon the idea.

Create

Start by creating a basic script, like PowerShell, for an elevator with two floors. You call the elevator on floor one and it is on floor one, then it opens. You call the elevator on floor one and it is on floor two, then it moves from floor two to floor one and opens. With this concept you can create the script with floor integer inputs to print the actions depending on the values.

Output

From this simple start you will be thinking of skills with inputting parameters, if statements, variable naming and printing content which are all the parts you need for writing most scripts. Even at this point you can learn so much about the language that you will get the basics. Working with you mentor, you can take into consideration code quality, security and validation, to ensure a complete script.

Next Level

However, once learnt the first level you can keep building upon this concept to make it more complex but following the same story. For instance, what if there were more floors, like 10? Why stick with a static number of floors? This could be part of the configuration to have the floors configurable, meaning you need to prepare for X floors and how it would react to different floor requests. With changing one factor and making it more complex you bring in the complexity of loops, switches, dictionaries, and more attributes to learn about. Throughout this you should be looking at refining the code quality and readability of the code as you go so that it is an evolving script of new skills, rather than a spaghetti of incremented code.

Keep Going

The complexity can keep going with this concept, like you can have multiple people call for the elevator at the same time, so you need to calculate out optimal route for the elevator to travel depending on where it is starting. Then what if there are multiple elevators that could offer the services with multiple people calling the elevator. Again, you could have a maximum run before it need maintenance and so on. At this point you can see how complex this can get, which is the point where most people normally try to start at when learning a new language. As you can imagine this can get very confusing code that is unmanageable, inflexible and incomprehensible. Whereas starting from the beginning, and checking in with your mentor, you can keep refining your code and finding new ways to improve it ensures you know the principals and basics that mean you can adapt to any request for a script.

Beyond

This process doesn’t just need to apply to coding languages, as the basic idea is to just start simple understanding the little things before moving on to the more complex parts. For example, as a DevOps Engineer I would use this pattern with Terraform and Azure as you need to know both the language and the technology. Following the concept you start with, is a simple design like a Website hosted in Azure, to learn from and build upon it.

The Beginning

From the design below we have an Azure Web App pointed to an Azure MySQL Database with an Azure Storage Account connected as well. To make it easier to demonstrate it working, the website hosted can be a WordPress site as we can use the public Docker image from Docker Hub which works with the MySQL database to validate build.

This design shows how a website can be setup, connected and hosted in Azure, but it also gives the learner the time to think about security of using the database connection string securely. There are also minimal resources to start the learner on Terraform building, but has all the concepts of remote backends, connected resources and handling secure values.

You could spend a good time on this basic design just improving code and understanding the complexities of the resources, but we take it to a point then look to move the complexity. Even this simple setup as a lot of new skillsets and technologies to master, before moving to the next stage. You could even mix in CI/CD at this point as well.

Stepping Up Security

Taking this design to the next level, we can think about the security with networking and identity. This design is an advancement of the previous design, incorporating virtual networks, private endpoints and subnetting. These architectural decisions will be a lot to take into account, plus also the understanding on how to implement it. Another part of this, if they haven’t already, is not using the admin username/password and instead using the System Managed or User Managed Identity to authenticate. They would then need to look to validate that the calling resources are private and has a secure connection to the Web App.

Again, there are a lot of new parts to this design, especially someone new to networking and understanding how these parts connect. Don’t forget to keep reviewing the code quality as well. As we add new code you will see the need for Terraform Modules, secure values and DRY coding style. These are additions that will be good to factor into the learn, rather than just being stratified the design works.

Bringing Flexibility

We now have the website hosted, running and securely connected, but when working with larger solutions you need to consider a flexible design that can handle influx of traffic and even disaster recovery. To start this design, they would need to consider the repeatability and deployment methods of the secondary environment, which would lead to refactoring of the code. There are then multiple disaster recovery methods for the user to read into with Storage Accounts using built in and MySQL having a Read/Write replication pattern. These are then headed by a CDN using Azure Front Door, which can be used to trigger an example disaster failover.

Although the design doesn’t look like it has moved a lot, there are big changes in the code with duplication to handle, difference in environment configuration and additional resources that have a lot of new parameters. This is where the code and the solution can get very complex.

Conclusion

As you can see this started simple and got complex fast, but it enables users to build up the understanding of the technologies and best practices for coding. It builds upon the design so the learner can see the progression of the design as you take into account further considerations of the solution and understand WHY you do these actions as a senior engineer.

As demonstrated you can use this practice and process of the elevator on any learning type. I recommend working with your mentee to break down their learning process using this process, which gives them simple goals to work from and rewards them frequently to keep the spark of learning alive.

Published by Chris Pateman - PR Coder

A Digital Technical Lead, constantly learning and sharing the knowledge journey.

Leave a message please

This site uses Akismet to reduce spam. Learn how your comment data is processed.