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 #10

1. Functional Programming Basically all content surrounding FP this time is connected with articles and projects created by Giulio Canti ( @giuliocanti ). For me reading those articles below definitely firmed and expanded my previous knowledge on FP. I would like to give credit to Piotr ( @hasparus ) who introduced me to Giulio’s work after the last WrocÅ‚aw TypeScript meetup. It was genuinely fascinating, thank you both! >> “fp-ts” library  I think fp-ts today is as famous for TypeScript as Rambda for JavaScript. With it, you can use “popular patterns and abstractions available in most functional languages”. If you are a newbie to FP (like me) and you know TypeScript it may be a good way to get your head around FP concepts through practice. Just play with it a little, create something small, something you know. >> “Getting started with fp-ts” series Aside from fp-ts having a well written official guide, Giulio created a series of articles, that introduce...

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 ...