Building on Sinatra
It has been roughly a month since I had wrote that blog on my first project. I remember the first project pushed me to mental extremes. This was such a foreign world to me just a few months ago. This Sinatra project really started solidifying my understanding of this world. The “black magic” that made no sense to me just a few months ago is starting to make sense. The idea of this being some sort of magic has wained and that void has filled with an insatiable curiosity. I always found myself admiring different websites I’d visit but now I am understanding the method to the madness.
This project was inspired by my tenure in the service industry. I always complained about position of service computers or better known as just POS the service industry. They always seemed to be error prone and lacked functionality that a user wanted. So many establishments need unique features that a software engineer can’t plan for. I used this as a way to create a basic version of what essentials I would have needed at one of my previous jobs. This didn’t always go to plan though.
The first huge hurdle I faced was grasping what sessions were and how to link that up with my SQLite database. I understood how active record was able to communicate with my database to create update read or delete my data I created. I began to understand how to create the belongs to and has many relationships. Thinking in terms of a restaurant, it was easy to think that a drink belongs to a server and that server can have many drinks. Having a server be able to ring a drink(create it) and have that created drink be assigned to them made sense. In older bars you will notice a server hand write your order and turn it in with their name on it. This is only saved in the mind of the server, the mind of the bartender and on paper. The black magic that I never thought too hard about was how I could ring in a drink and it would save it with the data I selected and send it to another user for them to complete. Whether that user was a bartender or the kitchen, the ability to create those relationships didn’t make much sense to me. My project had it’s major hurdle when I was trying to understand how a user can use sessions to allow them to log in, make it so each item that was created was only attached that user in that session. This took an entire day of research and coding for me to actually understand how it operated. This would be no different than me working behind the bar and ringing in table 23’s food under my clock in ID which would inform the kitchen I rang this in and would allow me to cash out this user when they were ready to leave. It wouldn’t allow the next user to log in and send through food orders as me if they didn’t know my log in. It also would prohibit drunk patrons from trying to log in and ring in stuff in our POS.
The recurring theme of this program has been to use my past career to explain my current work. I have had a lot of time to reflect on my days working behind a bar or in an office of a restaurant. I never took enough time to understand the technology that was at my disposal. Just saying POS to a service industry worker would raise our blood pressure and give us flash backs of terrible shifts where they failed us. It was black magic to most of us. The more time I have dedicated to learning how their basic functions work, the more I am seeing that maybe the technology didn’t fail us, we just didn’t understand how to use it correctly.