fbpx
Call us +1-231-421-7160

A Programmer's Insight: How to Shoot Yourself in the Foot

Have you ever wondered what happens when you click on one of the shiny buttons in the Cloud Control Panel™(CCP)? I know what you’re thinking - you’re directed to a page where you can perform an action to help manage your application. But have you ever wanted to find out more about the technical processes behind the actions?

By clicking on that button you set in motion a series of interrelated events that send a ripple down our platform. The processes in our CCP allow you to perform complex actions very quickly. If done manually, they would take several hours each and three times the caffeine.

CCP features are primarily coded with an ensemble of markup and scripting languages to make application management easy. These languages provide the necessary zing so the user experience is functional and memorable. By nature, the markup languages lack the flexibility to be full blown system by themselves. Instead, they pass the heavier buck to the backend language utilizing Ajax, web development techniques that allow web applications to send and receive data.

The backend language is primarily responsible for validating requests, figuring out where they should be redirected, obtaining the response and finally passing a readable message to the frontend language, which ultimately informs the clients of the status of the request. Working as a facilitator, the backend language reads the requests and dispatches them to another low-level service which is programmed in yet another language.

The low-level service, or “daemon” as we call it, runs eternally seeking new requests to fulfill. In return, it enjoys complete control over all of our resources so it can do all the monotonous grunt work. It’s quite a fair agreement.

In our simple system, we have three entities who need to communicate with one another in order to do your everyday chores: the frontend program, backend program and the daemon.

Shooting Yourself in the Foot

To illustrate the process and to stay true to the programmers' culture, we'll play off of the commonly used expression “shooting yourself in the foot” as an example request made by the front end user. To keep the illustration PG-13, we’ll spare you gory end user details and focus on the internal process.

nishblogfoot

To begin, the client would log into the CCP and click on the “Shoot Self in Foot” button. The front end program would immediately gather all the client details, make some nifty fades and swipes, summarize the request and pass it on to the backend program. Meanwhile, the client would get the customary status screen while they eagerly await their request.

When the backend program receives the request, it validates whether or not the client is allowed to possess a firearm and has a valid foot to shoot. Then it makes a call to the low-level daemon to verify the availability of a firearm. Finally, the backend language instructs the daemon to procure the best firearm for the client’s needs.

The daemon service picks a firearm with low recoil and high accuracy, assigns it to the user for the day and does all the necessary paperwork. It also allocates all the necessary ammunition and secures the foot so the action does not interfere with other clients also wanting to perform shoot themselves in the foot. Finally, it returns control of the request to the backend program with the details it has selected.

The backend program then parses the assignment details and prepares a fancy invoice for the gun, the bullets, the security, and the complementary bandages and applies the one time discount for the hunting season. The client is billed for the invoice and the backend enlists a message letting the client know his order is complete.

If the procurement has failed for some reason, the client is informed through the user interface. The message clearly states why the request was denied or if there was an error in securing the foot. It most cases, the interface displays a message letting the client know his order was processed successfully. The message also contains a loaded firearm pointed directly at the foot with instructions: “Click the shiny button to shoot yourself in the foot.”

Disclaimer: No foot was harmed in the process of writing this blog.

Site Sanitization: Cleaning up a Hacked Website
Diagnosing & Fixing PHP Fatal Errors