Matt Ambrogi

Recurse Center Weekly Recap #4

Slowly, and then suddenly, the first month of RC has passed by. I'm happy to have two more ahead. I'll do a reflection of broader scope when we hit the six week mark. For now, I'll just reflect on the past week.

This week I want to do something a bit different here and share exactly what my day to day looked like. The week looked something like this:

Monday: Spent a lot of time focused on wrapping up the blogging platform, my first project with a React frontend and Django Rest backend. I paired with a few of my batch mates who helped me figure out how to add routes for individual profiles. I'm starting to see the appeal of React with how we implemented this in SPA fashion. I added a number of little features: back buttons that are conditional based on which page you just came from, only displaying the 'insert post' button when a user is on their own profile or the main feed, put all my API calls in one component. While pairing we also discussed ways in which you might improve the efficiency of the API calls in the future. As a toy app, I'm simply getting all posts up front and filtering for profiles when necessary. Of course this isn't very scalable. I might in the future only get the first x posts and load more as a user scrolls. It would also be wise to create API calls for each user's posts so that I can grab those when needed as opposed to filtering down.

Tuesday: Finished the blogging platform. Updated some stuff on GitHub; trying to get in the habit of using it daily. Set up and had a first meeting among a group of us interested in ML projects. We'll meet weekly going forward to discuss ideas, resources, questions, etc. We talked about transformers and NLP. I went to the gym. Had a great coffee chat with one of the RC facilitators, James. We discussed approaches to learning. Specifically, the right balance between depth and exploration, which I'm forming my own philosophy on. We spoke about how to use time well without fearing it's scarcity. On both points, we repeatedly came back to the importance of working on projects you are excited about.

Wednesday: I wanted to start a new project with Django and React, thought of a simple one I was excited about, and built most of it. The project is called Dating Questions. It's a simple app that displays cards with fun questions couples, partners, or whoever can ask each other on a date, or just to pass time. The UI simply displays a card with a question, a button to get a new card, and three options for levels. A user can select level one, two, or three and get questions of increasing deepness. I implemented most of this but got distracted but an interesting question: could you build this as an SPA with just Django, no React? Talking with a batch-mate, Colin, about this, I discovered htmx, which allows you to access server sent events directly in html. I spent some time researching that and decided to implement the app both ways: with React/DRF and Django/htmx.

Thursday: Added the level selection functionality in React. Cleaned the UI a bit. I re-made the skeleton of the project in just Django. Paired with Colin, we added dynamic classes to the level buttons so that the currently selected level will display as a different color. We spent the majority of our time discussing how the htmx implementation might work. I wasn't feeling great and didn't get much done after that.

Friday: Read up on htmx and implemented the core version of Questions for Couples that way. It was very cool to explore that approach. The total file size of the Django htmx implementation is 100x smaller than that of my React/DRF implementation. With just a few lines of code on the Django side, I can replace the question displayed, making the game have a nice SPA experience. Without HTMX, the full page would have to re-load for each new question. Even making it so that the URL wouldn't change (i.e. question/1) would have taken some finesse. For quickly spinning up an idea, I can see how htmx with Django could be a superpower. Not having to think about any of the overhead of React, communicating between a separate frontend and backend, or the heavy frontend reliance on state management. The last point is an interesting tradeoff. REST is stateless, so in React we have to manage the state in the frontend. For certain things, like authentication, this is inconvenient. In this care, the only state I care about is what level is selected, and it's actually nice to maintain that locally. In the Django implementation, how to manage which level is selected and filter information displayed accordingly feels a bit messier, or at least requires greater separation of logic. I'll implement that next week before moving on. I'd like to actually deploy this at some point during RC. I think people would enjoy using it.

For this coming week

  • I want to finish the htmx implementation of Dating Questions
  • I want to start a new project. I'm very interested in doing something with ML. I feel an excitement to start down that path. So maybe I will. But I have enjoyed learning more and more about React and keeping that up could be good too.
  • I'm going to start spending 45 minutes everyday on computer science related work. I'll start my finishing chapter 2 of Composing Programs. Then I'm going to move into practicing and studying algorithm problems - probably next week. I'd like to figure out a balance between LeetCode and a book I want to read, The Algorithm Design Manual.

- 2 toasts