Bridging the Gap With Params
As I continue my dive into the world of software engineering I find myself searching for a balance between the real world I live in and the digital world I am so often lost in. Where is the common ground between the digital world and reality? Where and how do humans interact with computers these days? Well the most common interaction today comes in the form of browsing the world wide web. The world wide web, commonly referred to but not to be confused with, “the internet”, is the gold standard for human computer interaction. The oldest grandparents to the freakiest youth are constantly online, surfing the web for whatever their hearts desire. So what is the difference between the internet and the world wide web? To be very brief the internet is a physical network of cables actually connecting all major land masses on the planet to one another! Or more simply put the hardware side of things.
The world wide web on the other hand began in the late 1980’s with the invention of Hypertext by Tim Bernes-Lee. In Bernes-Lee’s own words:
“HyperText is a way to link and access information of various kinds as a web of nodes in which the user can browse at will. Potentially, HyperText provides a single user-interface to many large classes of stored information such as reports, notes, data-bases, computer documentation and on-line systems help.”
Simply put hypertext, or what we most commonly refer to as HTML, sits on top of the internet and is the language our computers use to interact with one another via the internet.
Nowadays with a few remote exceptions, humans around the globe are able to pull out a mobile device or open a laptop in their home or local cafe and interact with the world wide web. No matter their regional dialect or local language they are able to pull up a web browser and surf the web freely. HTML is a very broad explanation for how the world wide web works, looking closer a more specific tool truly bridges the gap between an individual user and how they are able to interact with the world wide web. Welcome params!
So what are params as they pertain to the world wide web? Technically params is an abbreviation for the parameters method and specifically refers to the parameters being passed to your application router via GET or POST requests. Simply put params is the information being passed to a website’s servers by a user interacting with the website’s URL. When I purchase birds on my favorite e-commerce site (cacklehatchery.com) or search for my favorite college basketball team on duckduckgo.com, I am sending param requests to the servers belonging to duckduckgo.com/cacklehatchery.com. Those websites servers receive the requests and query their database to find matching results, eventually sending them back as a new view in the web browser. Params can be broken down into two categories:
- Query String Parameters which are represented by everything after the ? in your URL when performing a duckduckgo.com search.
- GET/POST Data Params which come from an HTML form a user fills out on a given website (ie uploading an image or logging into Tiktok).
Looking closer at GET vs POST param data requests we see that there are quite a few differences between the two. In short GET requests will display the user values being passed to the servers in the URL. GET requests can only retrieve information. For these reasons GET requests are not used for passing secure information such as bank logins. POST requests on the other hand do not display the user values in the URL and also support many different data types while GET requests only support string data.
When a user is submitting a form online or typing a search request into duckduckgo.com a database is being accessed on the server side. The most commonly use form for Client Server relationships is the Model View Controller form depicted here:
In the below example there is a simple Rails application that has an object of Scientists that a user can create update and destroy. When a router sees the user params passed in via the web URL the Rails router sends these params along with a param :id to a controller.
The Scientists controller then confirms that the params are permitted via a strong params action and if permitted they are passed to other controller actions such as (new, create, update, destroy).
The controller actions are then sent to the model which communicates with its corresponding database via SQL to create update or destroy any matching results.
The database is then queried to either get or update information about the scientists object. The interactive flow of
User - Router - Controller - Model/Database/Model - Controller - View - User
is the same if a user passes a website server their user_name and password to login. In that instance the user_name and password are the params! Params are the tie that binds, the bridge over the gap, and finally the key that gives a user access to the world wide web. Params in many situations also undergo validation, authentication, and authorization. These three actions due to their complexity are deserving of their own blog posts, but they can only exit with params.
In conclusion I now understand the immensely important role that params play in our modern day lives. The overwhelming majority of human interactions with computers rely on params. Thank you params for all that you do :)
Resources: