Skip to main content

Learning Session #7


Hello again, we’re meeting again, this time after a long break. I was on the vacation in Portugal for a week and got myself a needed coding detox ๐Ÿ˜Š I got a week of exploring foreign culture and cuisine and it was really worth the time! Now I am full of energy and positive mindset to start learning and having fun with coding again!

Shall we start, then?

1. TypeScript

>> “Notes on TypeScript: Pick, Exclude and Higher Order Components” by A. Sharif

Here is a good example of using Pick, Exclude and Omit types in the TS which helps you create new types based on existing ones by extracting certain properties.

There can be many use cases for that, for me, it was creating a type with Omit, which was based on an existing business model and then used in Angular’s reactive form.

For the other reason entirely I’ve also written a type that creates union type from keys which extend Date interface:


>> unknown type

Fairly new unknown type in TS lets you forget about any type and its inabilities. The difference is slight but significant.

Value of type any can be assigned to anything and anything can be assigned to this value. Value of unknown type CANNOT be assigned to anything, but anything can be assigned to the value.

That is powerful, because it is more type-safe, even if it still is somewhat “any”. With that, we can forget with bad practices of using any and related errors.

>> TSLint rule: member-ordering

Next step for ensuring clarity and readability of your classes is here. With this simple rule, you can manage the ordering of each member of your classes: private/public, static/instance/, fields/methods – you name it.

>> “Custom TSLint rules — easier than you think” by Eran Shabi

This a really nice article introduces you to the world of custom TSLint rules. With it, you can create a simple example rule and see for yourself that it is not difficult at all! I can relate because I’ve already used it to create something on my own ๐Ÿ˜Š Now our code can be even more beautiful!

>> “lodash-decorators”npm package

The cool thing I found recently is the utility decorators for JavaScript (apparently also for TypeScript) based on popular lodash library. Here you can find decorators like @Memoize or @Bind.

2. Java

>> “JPA Attribute Converters” by baeldung

A great functionality to use in your Spring back-end is an attribute converter. It does exactly what it states – it converts attributes for your database entity. It may be used in the case when you want to convert some data from a database and make it more explicit for the user when sent to the client. When data comes back converter does the backward – it converts the data back to be interpreted correctly by the database.

3. Other

>> Wakatime

I found really awesome tool for measuring the time you spend on coding. Just create an account, hook it up to your IDE and start coding! It measures the time spent on certain projects and in certain languages. It is also configurable to some degree, for example, if you wish to not include time spent on JSON files (like I did ๐Ÿ˜‰).


In the end, I wanted also to share with you, that for the last two weeks I’ve been preoccupied with learning about functional programming. It is an exciting new experience for me and I can’t wait to share my insights with you! See you soon!

Comments

Popular posts from this blog

How I started with Functional Programming

There was a moment during past Learning Sessions when I declared, that I’ll share with you how and why I decided to dive into Functional Programming. And that day is today! I’ll guide you along the path I took to understand basic concepts of FP. My first meaningful encounter with FP was during local Wrocล‚aw TypeScript meetup . There I got to hear Jรณzef Flakus telling us about core concepts of the FP. We then got to the concept of FRP and how it is used in MarbleJS, the framework for creating server-side apps. In fact, Jรณzef is the creator of this framework. It was really cool to hear his point of view. Those concepts were entirely new to me, because (as it turned out) I had 100% imperative programming mindset. The second talk that day was authored by Tomasz Ducin. He showed us how we can implement functional composition in TypeScript. It was a brilliant live coding session but… I had no idea what he was talking about ๐Ÿ˜‰ I was examining code created by Tomasz for the entire ...

Learning Session #2 (12/31 – 01/13)

1. Git >> Free and (almost) unlimited private repositories on GitHub Last week everyone on Twitter was talking about this so I can't just leave that be, right? ๐Ÿ˜‰ What I’m referring to is GitHub announcing free and unlimited private repositories for all users. That’s a great news and I was wondering why this option was not enabled from day one I started using GitHub. I mentioned that this option is “almost” unlimited because free private repository can manage up to three collaborators only. Big projects won’t be able to use those, but at least individual users can now freely hide code they consider shameful ๐Ÿ˜‰ 2. React >> React Crash Course by Mosh Hamedani During last two weeks I’ve completed this YouTube crash course by Mosh Hamedani. It is derived from his full course on React and contains first couple of lessons. It think it was a great introduction to the library itself (React is a considered a library, not a framework, isn’t it? ๐Ÿ˜Š). Tutorial ends ...

Learning Session #6

1. Angular Today I’d like to focus mainly on a series of articles about zones and change detection mechanisms. They relate mostly to the Angular, but the knowledge can be applied also to other JS frameworks. Really interesting read if you are interested in how your framework may work behind the scenes! >> “Understanding zones” by Pascal Precht An explanation of what zones are, how they work and how they can improve our work. The conception itself was created some time ago and it quickly got deserved attention. Now it is one of core mechanisms in Angular.  >> “Zones in Angular” by Pascal Precht Extension of the previous article describing how the Angular takes advantage of zones in its change detection.  >> “A Comprehensive Guide to Angular onPush Change Detection Strategy” by Netanel Basal Introduction to change detection strategies and how and when we should them. The article focuses mostly on “onPush” strategy, which can improve the performance...