Post/Code

HomeAboutUsesNow

Official Docs.

In recent time, I have found it immensely valuable to, in detail, go through the official "Getting Started" guides/tutorials and documentation for frameworks. Namely because this is, in many ways, the source of truth. The creators and developers of the frameworks themselves have put together these guides, as such, the knowledge and information is straight-from-the-horses'-mouth if you will. As such, it is understood that the manner of doing things demonstrated can be considered best practice. This is in contrast to what you may learn from a tutorial or blog online which may or may not be according to best practice and may or may not reflect the most up to date expression and thinking on the topics.

In the past week I have gone (or revisited) the following:

I still need to revisit some of these, but it is really impressive how much one learns from these resources. Additionally, I feel that while the examples, and applications might be somewhat trivial, they set a solid base - especially in terms of properly organising and structuring your code.

For example, if you go through Tour of Heroes, they cover a range of topics that cover:

  • CRUD
  • Search
  • Event, input and property bindings
  • Routing
  • Http
  • Observables

Observables is an interesting one, take for instance the following information:

With the switchMap operator, every qualifying key event can trigger an HttpClient.get() method call. Even with a 300ms pause between requests, you could have multiple HTTP requests in flight and they may not return in the order sent.

switchMap() preserves the original request order while returning only the observable from the most recent HTTP method call. Results from prior calls are canceled and discarded.

Note that canceling a previous searchHeroes() Observable doesn't actually abort a pending HTTP request. Unwanted results are simply discarded before they reach your application code.

That blows my mind! The functionality and benefit provided out the box by switchMap alone is impressive! Now, I know 'rxjs' is a separate library and not Angular specific, but, if you were to continue coding things the way you have always coded them before, you would miss out on the phenomenal functionality and capability operators like this give you straight away!

Another exampe is the extensive use of Decorators in both Angular and Nest.js (which is heavily inspired and follos many of the Angular conventions). Decorators make the code so much easier to read while masking a lot of functionality behind the scenes.

If you are cosidering dipping your toe into any coding topic, I would suggest and strongly advocate to set aside several hours to go through the official 'Getting started' guides, tutorials and documentation. Even though developers trditionally dislike documentation, it feels to me that documentation is getting far better and more thoughtful than it was in past days! That, or maybe I just did not read it properly!

In the case of Gatsby.js, while Gatsby does the heavy-lifting for you, it is a really nice and easy way into more advanced topics such as GraphQL, which clearly, is an important topic in development for the next few years.