Keep Your Cowboys Out of the Future

Keep Your Cowboys Out of the Future

How to Keep Code Organized

Featured on Hashnode

A "Hole" New World

DisneyWorld's Magic Kingdom has a lot to offer - rides new and old, themed lands, 3:00 pm sugar crashes that can tear families apart, and even a chance to meet some of your favorite Disney characters!

These character “Meet and Greets” happen all over the park and at different times of day. Yet you will never see a character walking from one “Meet and Greet” location to another - or any other part of the park for that matter.

How is this possible? Did Walt Disney fund teleportation technology prior to his death as some claim he did with cryopreservation? Possibly! But that is not the explanation here.

When you are standing on Main Street in the Magic Kingdom you are actually over a story above ground level. By the time you are at Cinderella’s Castle you are three stories up! And what is below you the entire time? A nine-acre series of interconnected tunnels called the “Utilidor System.”

Utilidor.jpeg

Legend has it that soon after DisneyLand opened Walt Disney saw a cowboy walking through Tomorrowland to get to his job in Frontierland. To Walt this destroyed the magic each distinct “land” was meant to convey. So when he planned DisneyWorld in Florida he created the Utilidor system to keep things in their proper place and make sure that kind of mixup never happened again.

The physical Utilidor tunnels provide a solid structure but the real system is what takes place inside them. Today I want to talk about how that system is used to present character "Meet and Greets" flawlessly* and how we can apply a similar mindset to our code.

It takes a lot of organization to maintain the "magic"

There are several spots throughout the Magic Kingdom that host character “Meet and Greets.” Behind each of these is a hidden access to the tunnels below. The schedules for these "Meet and Greets" change often - both in terms of which times they happen and which characters are present. A five-year-old that waited an hour to meet Elsa will have a meltdown if Goofy is there instead. How does Disney prevent that?

giphy.gif

There are three main Teams that work together to make sure things run smooth and keep those kids’ tears dry: the Character Team, the Logistics Team, and the Costuming Team.

The Character Team houses a database of all Disney characters. Within this database every character has a rigid set of Character Specifications which include its costume, how it walks, which gestures it makes, how its signature is assigned, a list of ways it responds to specific guest interactions, etc. The goal is to make sure a guest meeting Tigger twice will see the same character even if different actors are portraying him.

The Logistics Team is a hub that handles communication between the Character Team and Costuming. Logistics has a Master List of plans to set up the “Meet and Greets.” Each plan in the Master List sets the number of meets per day, how long they will last, schedules for all related actors and assistants, which characters are being presented, a list of all costumes and props needed, etc. Each accounts for different circumstances.

Logistics Managers do analysis to see which characters are most popular so they know which the guests want to see. They then assess the anticipated number of guests for a given day, the park hours, expected weather, and various other factors. Based on these they choose the right plan from the Master List which schedules all necessary elements for each “Meet and Greet” to occur.

The Costuming Team receives all those elements and instructions, costumes the characters and returns them to the Logistics Team. The Logistics Team then sends them to the correct “Meet and Greet” location based on the plan.

"Magic" in action

Let’s see how this works in practice:

The Logistics Managers get a report that guests want to see more Buzz Lightyear:

1.png

They tell the Logistics Team to look at the Master List and find which plan works best:

2.png

Based off that plan, Logistics tells the Character team it needs a Buzz Lightyear actor:

4.png

The Character Team goes into the Character Database and makes sure the actor knows the right walk, signature, gestures, and responses:

6.png

It then sends the actor back to Logistics:

7.png

Which sends him to Costuming to get a Buzz costume:

8.png

Costuming returns him to Logistics and Logistics gets him to the “Meet and Greet:”

9.png

So how does this relate to coding??

Many developers start out with poorly organized code. Things are hard to find and end up in the wrong locations. This compounds when multiple devs have different perspectives on where things should be kept. Disorganization leads to code breaking. Then the devs cry worse than the little kid who got Goofy instead of Elsa.

giphy (1).gif

What if I told you there is a way to apply DisneyWorld’s flawless “Meet and Greet” structure as a coding paradigm that will keep things clear and understandable?

What if I told you it already exists and is called MVC?

And in fact I have already been teaching it to you!

Ta-Da:

tada.png

In MVC the Controller is like the Logistics Team - it contains the logic for how our app functions and communicates between the Model and View components.

The Model component is like the Character Team - it contains the Database which stores information and Models with schemas that set the structure for how that information is organized.

The View component is like the Costume Team - it adds the styling on top of the displayed elements.

With this understanding you can now see how an MVC structure like the one diagrammed above would operate:

A user interacts with the browser. The type of that interaction sets off a route:

mvc-step-1.png

That route connects to a specific Controller:

mvc-step-2.png

That Controller connects to a Model:

mvc-step-4.png

The Model goes into the database and pulls data:

mvc-step-6.png

The Model places that data in its specific schema and gives it back to the Controller:

mvc-step-7.png

The Controller connects with the View which adds styling and gives it to the Controller:

mvc-step-8.png

And the Controller provides the fully-styled data in the correct schema back to the browser:

mvc-step-9.png

I hope this helps shed some light on the MVC structure and makes it easier to understand. Embracing coding paradigms like MVC pays off quickly as it becomes easier to maintain organization and clarity. Anyone reading your code will surely thank you for the effort!

a-whole-new-world-aladdin.gif

  • * Some of the Disney-related processes and terms have been altered to make the analogy to MVC clearer. This is a work of fiction. These opinions are mine and mine alone. I invoke all magical and legal powers to bind the Walt Disney company from taking legal action against me.