Dream Journal Sinatra App

 In terms of programming, building this project was probably one of the most challenging things I have done so far. Even though I managed to build all of the project requirements, there were still a number of things I would have liked to change if I had had the time to do them. Nonetheless it was still a blast to work on, despite the challenges. 


Some things I enjoyed about building this Sinatra app was getting to see first hand what changes were being made to my app as I was refactoring, debugging, and building. Having that visual aspect was definitely a motivating factor to keep going. I’m also incredibly thankful for the corneal gem, amongst others. If I would’ve had to build the directories manually it would’ve taken so much time out of the actual project building mode. Just like in my previous CLI application, having that skeleton laid out was certainly helpful in terms of visualizing where my files needed to go and also allowed me more time to brainstorm ideas for what kind of app I wanted to build.


Before I even got to build my app, the first thing I did was add notes files, where I pretty much mapped out the entirety of my program including all of the attributes I wanted my models to have, what classes I thought I would need, their relationships to each other, and I even wrote the routes I thought I would need. Writing down the routes came in handy once I started building my app since I could eventually just copy and paste these into my controllers. 


Once I finished on my notes, I started working from the back to front. I started off by building my model classes and having these inherit from ActiveRecord so that all the methods from ActiveRecord would be available to them. Once I had my config.ru and the relationships between the classes properly initialized, I began by writing out my Usercontroller, giving it the ability to sign up first and leaving the login route for later when I would tackle that via user authentication. While I began the Usercontroller I also wrote a file in views for the ‘/users/show’ route which would eventually turn into the main menu that the user is directed to after logging in. Next came the Journalcontroller which was a bit more extensive, considering that the controller handles more methods and has more functionality. I incorporated the CRUD functions in the Journalcontroller, allowing it to create, update, and delete instances of journals and save these to their respective sessions. Meaning only the journals created in a user's account would be available to that user. Trying to debug how to prevent all the journals from showing up in every user's account was the trickiest bug to solve, but I eventually did it by iterating through all the journals in my Journalcontroller and selecting for the journals with the user_id matching the current sessions user_id.  User authentication was one of the last things I tackled.


Comments

Popular posts from this blog

Why Did I Decide to Choose Software Engineering

Navigating Stateful and Stateless Components in my Final React Project

My Rails App