/Best Practices

Write Clean Code To Reduce Cognitive Load

- Andrew Trenk tl;dr: Cognitive load is often higher for other people reading code you wrote than it is for yourself. The key to reducing cognitive load is to make code simpler so it can be understood more easily by readers. Andrew elaborates on the following: (1) Limit the amount of code in a function or file. (2) Create abstractions to hide implementation details. (3) Simplify control flow. (4) Minimize mutable state. (5) Include only relevant details in tests. (6) Don’t overuse mocks in tests.

featured in #463


How To (And How Not To) Design REST APIs

- Jeff Schnitzer tl;dr: "In my career, I have consumed hundreds of REST APIs and produced dozens. Since I often see the same mistakes repeated in API design, I thought it might be nice to write down a set of best practices. And poke fun at a couple widely-used APIs. Much of this may be "duh", but there might be a few rules you haven't considered yet."

featured in #462


Use Abstraction To Improve Function Readability

- Palak Bansal Mark Manley tl;dr: The team at Google compares two functions and highlights how one is easier to follow due to its consistent level of abstraction, providing a top-down narrative of the code’s logic. createPizza is a high-level function that delegates the preparing, baking, and boxing steps to lower-level specialized functions with intuitive names. Those functions, in turn, delegate to their own lower-level specialized functions (e.g., heatOven) until they reach a function that handles implementation details without needing to call other functions.

featured in #460


Improve Readability With Positive Booleans

- Max Kanat-Alexander tl;dr: (1) Name your flags and variables in such a way that they represent the positive check you wish to make - the presence of something, something being enabled, something being true - rather than the negative check you wish to make - the absence of something, something being disabled, something being false. (2) If your conditional looks like “if not … else …” then reverse it to put the positive case first.

featured in #458


Authorization’s Spookiest Problem: Data

tl;dr: Between the dynamic nature of your application’s data model and the amount of application data needed to make authorization decisions, it’s no wonder data management is authorization’s spookiest problem. Join Oso's virtual event on October 31 where we'll share our best practices for building scalable and effective authorization systems, with a focus on storing, accessing and modeling the data.

featured in #458


Git Commit And Commit Message Best Practices

- Justin Joyce tl;dr: Justin shares best practices for git commits and commit messages. Commit best practices include: (1) Commit often: Save work at incremental steps. (2) Keep commits self-contained: Ensure each commit represents a distinct piece of work. (3) Keep commits small: Commit frequently to maintain smaller changes. For commit messages: (1) Keep messages short: Aim for a one-liner, ideally under 70 characters. (2) Be descriptive yet concise: Summarize the commit's essence succinctly. (3) Be specific: Clearly indicate the nature and location of the change.The author emphasizes clarity and specificity over strict adherence to tense or voice in messages.

featured in #456


Common Authentication Implementation Risks And How To Mitigate Them

- James Hickey tl;dr: Data breaches are more common than ever. Ensuring a secure authentication system is critical to your trust with customers. Whether you build or buy your auth solution, this article offers insights into secure practices that can help keep you and your customers safe.

featured in #450


Best Practices For Collecting And Querying Data From Multiple Sources

- Zoe Steinkamp tl;dr: In a data-centric era, efficiently collecting and querying data from diverse sources is paramount. Zoe Steinkamp emphasizes the importance of best practices in data collection, such as optimizing ingestion pipelines and advanced querying. With varied data streams like IoT and cloud computing, single-database storage is outdated. Instead, strategies like effective data modeling and understanding data sources are vital. Tools like InfluxDB, a time series database, and Pandas, a Python library, facilitate data management and analysis. Leveraging multiple data sources optimizes cost, efficiency, and user experience.

featured in #449


Moving From IC To Engineering Manager

tl;dr: Best practices for transitioning from an IC to an engineering manager. Good reasons for the transition include a love for solving people problems and managing projects, while bad reasons include seeking more authority or escaping boredom. Necessary skills include communication, durability, technical competence, patience, and urgency. The article warns against the "Team Lead" role as a transitional step, as it often leads to failure, and advises starting new managers with "training wheels" to guide them through difficult situations. The emphasis is on ensuring the right motivations, skills, and support for a successful transition.

featured in #441


How We Roll – Avatars

- Colin Sidoti tl;dr: This post emphasizes the importance of avatars in authentication, often overlooked in app development. It details how Clerk uses social sign-ins like Google and Facebook to ease avatar selection, offers beautiful default avatars, and integrates avatars into the sign-in flow to enhance user experience.

featured in #438