Myths of the Near Future

Ruby and JavaScript enthusiast.

Read this first

Functional approach to React components (getting rid of `this`)

I don’t like this. I mean I don’t like this.

There are multiple articles on why OOP is not the best paradigm, and why it’s especially so in JavaScript.

One example is inheritance. Even Java folks know the Composition over Inheritance rule (thanks to J. Bloch?) and React team explicitly states this as well.

Another side of it is the infamous JavaScript this, which is hard to deal with and which is known for making the code flow particularly tangled and messy.

But what really bothers me is how many new developers now who start straightaway with React skipping the basics of JavaScript (remember jQuery?) simply don’t understand the functional side of JavaScript. Cmon guys, the class is simply a syntactic sugar.

OK, enough grumbling for now.

I want to share a simple trick I’ve started using recently while developing one of my personal projects. It’s very simple. It abstracts away the...

Continue reading →

Git bisecting FTW

Do you guys know git bisect works? This is one of this features you don’t end up to use often but when you do this is completely mind-blowing.

So here’s a recent example. I received a bug report from one of the managers, and it was quickly apparent the problem was that one of the files was missing a function. But I didn’t know what that function looks like and when/why it was deleted, so I needed to find the commit in which this change took place.

Git bisect to the rescue!

Git bisect is a tool that can run some test command on different commits to figure out the first commit that went out of hand.

First, we need to figure out the command. That can be your test suit, or in our case is a simple grep expression, like this grep initApp scr/app.js.

Make sure for whatever command you run, it should return 0 for good commits and not 0 for bad commits. You can check what your command...

Continue reading →

Microservices: maybe not

Microservices have been gathering some attraction for the past several years for a reason. Microservice-based architecture proved its efficiency and won the hearts of many developers.

But as with any other thing under the sky, microservices is not a silver bullet, it’s a tradeoff. And as with any tradeoff, it’s good to know what you gain and what you lose.

So before you sell your soul to the devil, let’s at least take a quick glimpse into the contract.

The downsides of the microservices

Here the most evident arguments for why forcing the microservices architecture may be a bad thing.

  • The overall complexity is gonna rise
    Compared to a monolith, where you have a single repo and a single database, now imagine you have over 20 repos and you need to make sense of them, like how they interact with each other, what APIs they provide and consume, messaging and so on.

  • Development time is...

Continue reading →

Why does clean code matter?

Surprisingly often I encounter this type of question in one form or the other.

What’s the point of clean code?

If the code has been written, and it does what it’s expected to (satisfying the business requirements), and doing this in a most efficient way (performance speaking)? So why we just can’t leave it alone?

Why bother?

To start with, I need to clarify what the “clean code” is.

The codebase is a reflection of reality. And so the clean code is the code that reads like business requirements. “Clean” not in the sense of being understandable by an average developer, but in the sense of being a close reflection of the business area.

That’s important because this definition is objective, vs. “understandability” which is subjective.

Strictly saying, in an ideal world, the complexity of code should be a linear function of business area complexity. Otherwise, a small change in...

Continue reading →

Spell checker in VIM

Only recently I figured out that there’s a built-in spellchecker in VIM. You can turn it on with

:setlocal spell spelllang=en_us

Now VIM will highlight any misspelled word. You can navigate between them with ]s and [s. z= will show you a list of suggestion, and if you’re sure the word spelled correctly, you can type zg to add it to the dictionary.

View →

11 JavaScript Blogs to Follow in 2017

There’s a huge benefit in running a JavaScript newsletter. You get to know about many smart people from whom you can learn a lot.

Here are the most interesting blogs I stumbled upon. Feel free to add them directly to your preferred RSS reader. This stuff is profound, professional and of a very high quality.

Without further ado, in no particular order.

②ality – JavaScript and more
Dr. Axel Rauschmayer aka 2ality is an iconic figure among the community. He writes about new ES6 and ES7 features. His write-ups are usually lengthy and very detailed. He is also the author of very thorough books

Reginald Braithwaite
Reginald is the author of the brilliant JavaScript Allongé which teaches JavaScript but takes a more functional approach. His blog articles are deep and extremely interesting.

μ (yes, just like that)
This one is not on JavaScript in particular but rather on functional...

Continue reading →

Browsing changed files in Vim with FZF

I use junegunn/fzf to browse files in Vim. It’s an extremely fast fuzzy finder written in Go. If you compare it to something like [CtrlP](kien/ctrlp.vim) you’ll find it blazingly fast. And what’s cool, it doesn’t need to cache files because it’s THAT fast (no need to hit F5 every time you add a new file into the project). If you didn’t hear about it go try it out!

My most used command is obviously:

noremap <Leader><Leader> :Files<cr>

, which opens the dialog with all files in the working tree to fuzzy find from. I find <Leader><Leader> combination very handy (it’s similar to Shift-Shift in Intellij-based products).

Sometimes (quite often actually) in the middle of development cycle I don’t immediately remember what file I need. In this case I don’t want to see all the files in the working tree, I just want to browse the files I’m working on right now i.e. changed files and newly...

Continue reading →

Essential Form Interactions

There are several important features every form should have, be it a simple login form, or a complicated multi page questionnaire. Most of them are really easy to implement but are often neglected. On the other side as from user perspective we absolutely anticipate them and lack of those small interaction makes us frustrated.

Disclaimer: I’m not a UX-expert myself, just an ordinary developer :) But I do believe that world could be a bit better place if we stick to following simple rules. I also should mention that most of time UX- and UI- guys just don’t think on that kind of details. So in the end it’s us, developers who should take care about it.

Autofocus in first input

Reaching out for a mouse is annoying and unnecessary (that’s a main line of this article by the way). Simply, put the cursor into the first input of the form, so that user could start typing right away. This is...

Continue reading →

Simple tabs directive: Angular transclusion, isolation and controller in action

Sometimes when there’s too much content for one page it’s convenient to hide some of it behind the tabs. Basically you can click on a tab to display one page or another. It comes quite handy and I use it a lot in many of my webapps. I came up with this handy directives that allows for dropping tabbed content pretty much anywhere on a page.

What I like about it is that even though it’s quite simple and concise it touches a lot of Angular concepts that believed to be complex and hard for beginners like transclusion and controller.

Interface is quite simple:

  <nge-tab name='books' title='Books'>
    <!-- Some content here -->
  <nge-tab name='reviews' title='Reviews'>
    <!-- Some content here -->

Let’s look under the hood

Here’s nge-tabs:

angular.module('readn.directives').directive 'ngeTabs', ->
    restrict: 'E'   it only can be

Continue reading →

Why I don’t care about quick sort

I have to make a shameful confession.

Being a professional developer for 8 years now, I don’t know how to implement a quick sort. Or merge sort. Or whatever sort. I mean, I know the words, so I can try to make use of my brain and come up with some approach, but that attempt would probably fail. And when you start throwing these O(n), O(log n) things at me I would probably just roll my eyes ant try to disappear.

Now before you run to unsubscribe from this blog, let me try to explain what I mean by this, and why I really don’t care.

Let’s say that you’re hiring a developer for your super awesome startup. And I’m among the participators. The reason your company exists, is obviously making money. And whatever actions you do running it (including hiring engineers) have only one end goal — make more money.

Now if we try to make a logical connection between me as your engineer knowing...

Continue reading →