sid.me

Home Blog Projects About

What I Learnt This Week part 1

Week 1

This is my brain dump for this week on things I learned, tech-related or otherwise.

Tech

  • Django uses an object-to-relational mapper (ORM) to map the model defined in Django to the relational data structures used by the underlying database. The database is configurable so this strategy ensures dynamic mapping while keeping the object model consistent. To perform this Django has to run database migrations every time there is a change in the data model to syncronise all changes made to the underlying database.
  • Taking into account slower connections and low bandwidth is important and often overlooked during app development and production. With a focus mainly on optimizations, the edge case of slow connections is often overlooked. A slow connection can render the app unusable. A great example of this situation is having a hard-coded time out for WebSocket connections, which would mean that someone on a slow internet connection wouldn’t be able to access any parts of the website. Consider having a more resilient strategy for this, like dynamic timeouts and reusing open web sockets.
  • Django.TestCase extends SimpleTestCase which in turn is a subclass of the Python unittest framework. The SimpleTestCase class can be used for tests that do not require creating or querying of database models, while Django.TestCase runs all tests within a transaction and involves flushing the database, which adds overhead that can be avoided for some tests.
  • async in Rust is handled through Runtimes. These executors are responsible for the efficient scheduling and running of futures. Although there isn’t a built-in runtime, Tokio is a popular library for runtimes.
  • overheads of optimizations are sometimes so costly that the simpler approach is more efficient
    • two ways of handling threads: stackfull and stackless. Stackful threads incur memory overhead since each thread would have its minimum stack space requirement.
    • the overhead of setting up everything necessary for performing parallelism isn’t always worth it, and a single-threaded solution might suffice

Otherwise

  • While learning to cook this week in preparation for living by myself I learned the importance of tadka in Indian dishes. Most Indian dishes, including rasam, dal, and most vegetable preparations require the flavor enhancer of tadka. Tadka is the process of infusing hot oil (or ghee) with spices like cumin, coriander, sesame, mustard seeds, as well as curry leaves. A variation of this is the 5 spice “Panch Phoron Tadka” which is a mixture of jeera, mustard, methi, kalonji and saunf seeds in oil. This is mostly popular in the West Bengal region of India.
  • I think the design of IKEA stores is super clever, with the counterclockwise one-way layout going through each category. The pre-built rooms were also fun because they showed the practical application of these products which you would normally see on a shelf and probably not buy, but since you can see it being “used” in the room it incentivizes buying.