Gnarly Learnings from November
Tags: javascript, postgres, react, learning
Published: 2021-12-08 13:18:12

We love reading, watching, and listening to constantly update our skills and learn new perspectives. Here are some of the exciting pieces we learned from this month.

## [The Javascript RORO pattern](https://www.tinyblog.dev/blog/2020-07-13-javascript-roro-pattern/)

RORO - "Receive Object, Return Object" - is a javascript pattern that seeks to take advantage of the benefits of ES6, making functions that have easily constructed props and easily deconstructed return values. 

## [The Invisible Javascript Backdoor](https://certitude.consulting/blog/en/invisible-backdoor/)

While hiding things in plain sight isn't really a new concept in programming, especially for attacks, I found this one interesting because of The Gnar's use of trailing commas in our style guide. Normally, the commas are good for reducing noise in git diffs, but in this case, the author demonstrates how they can be leveraged for malicious purposes.

## [This Project Will Only Take...](https://web.eecs.utk.edu/~azh/blog/thisprojectwillonlytake.html)

Estimating the time it will take to complete a project is difficult but it is extremely valuable to our clients as it allows them to ensure that their business needs are aligned with the development of their product. Estimation (and subsequently, delivery) can become challenging when if requirements aren't fully fleshed out. This author takes us through their approach to sussing out hidden complexity in seemingly simple projects and features.

## [The Value in Value Objects](https://martinfowler.com/bliki/ValueObject.html)

We were discussing value objects vs. reference objects for one of our projects. This article from Martin Fowler is a nice summary of how to make the decision about value vs. reference, as well as some gotchas to look out for in particular languages.

## [State Management Showdown: Redux vs. Context API](https://dev.to/ruppysuppy/redux-vs-context-api-when-to-use-them-4k3p)

When the ContextAPI was released, it showed a world that embraced reducers, and in so doing, it sidestepped redux. When is Redux still useful, and when might you want to reach for it? 

## [Importing SVGs as React Components](https://create-react-app.dev/docs/adding-images-fonts-and-files/#adding-svgs)

We've often seen or written React components to render SVGs, or used `img` tags with an SVG `src` attribute. This section of the Create React App documentation describes how to import React components from SVG file paths directly!

## [Ordering NULLS in PostgreSQL](https://www.postgresql.org/docs/8.3/queries-order.html)

This section of the Postgres documentation covers sorting queries, and a particularly valuable excerpt helped sort where the records with `null` sort attributes are returned in the query.

> The `NULLS FIRST` and `NULLS LAST` options can be used to determine whether
> nulls appear before or after non-null values in the sort ordering. By default,
> null values sort as if larger than any non-null value; that is, `NULLS FIRST`
> is the default for `DESC` order, and `NULLS LAST` otherwise.

## [Converting Large Applications to TypeScript](https://codeascraft.com/2021/11/08/etsys-journey-to-typescript/)

TypeScript continues to be one of our favorite tools at The Gnar. One great feature is the ability to modulate the strictness of the TypeScript configuration in your application. In general, a stricter configuration will result in a higher incidence of program correctness but sometimes, that may not be the best option right out of the gate. One example of when a less strict configuration might be preferable is when migrating from JavaScript to TypeScript, as it allows TypeScript to be adopted incrementally. This is valuable when you have over *17,000* JavaScript files in your application - which is exactly what Etsy had to contend with when they were making the switch. Their approach is detailed in the article above.

## [Importing SCSS variables in Next.js](https://nextjs.org/docs/basic-features/built-in-css-support#sass-variables)

The tooling for frontend developers is constantly evolving, and this small but "next level" feature is a great example. NextJS allows you to access SASS variables in your components easily by simply exporting them!

## [What's in a name? Falsehoods That Programmers Believe About Names](https://shinesolutions.com/2018/01/08/falsehoods-programmers-believe-about-names-with-examples/)

Accessibility comes in many forms, and this article does a good job of taking one common aspect of modern websites - recording a users name - and explores the many assumptions developers may have about it. It is a useful read for those looking to think critically about the kind of things we do - or do not - require and record in our applications.  

## Contributors

- [Alex Jarvis](https://github.com/alxjrvs)
- [Ethan Fertsch](https://github.com/efertsch)
- [Jon Yurek](https://github.com/jyurek)
- [Mike Stone](https://www.github.com/mikestone14)
- [Steve Meisner](https://www.github.com/stevemeisner)
- [Taylor Kearns](https://www.github.com/taylorkearns)

_Learn more about how The Gnar [builds software](https://www.thegnar.com/software-development)._