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

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

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

Programmer's Bookshelf - "The Pragmatic Programmer"

“People should see your name on a piece of code and expect it to be solid, well written, tested, and documented.” ~ David Thomas, Andrew Hunt Today I proudly finished “The Pragmatic Programmer” by David Thomas and Andrew Hunt 😊  I recommend it to anyone looking for solid tips for every aspect of developer’s work: from technical to project management. Also, it may just ensure you in the correctness of your workflow 😊 What I have learned from the book:   - „Provide Options, Don’t Make Excuses” – take responsibility for your errors and provide solutions. - “Don’t Live with Broken Windows” – prevent damage to your projects by not ignoring anything potentially harmful and fixing it. - “Invest Regularly in Your Knowledge Portfolio” – embrace any opportunity to learn! - “Involve your users in the trade-off” – remember that you’re writing software for other people. - Users not only decide what they want but also when they want it and how good it should be...