NPM dependency hell

Today I want to share some thoughts on the current state of NPM packages infrastructure. I’m pretty sure that NPM is very good thing:

  • It’s easy to use. Seriously, I love the way it’s working. Recent changes, like adding package.lock.json are making NPM better and better every day;
  • It has a good community and it’s very popular. You can literally find everything that you need here;

However I’m a bit disappointed in the current state of dependency graphs for most of the popular packages.
Continue reading “NPM dependency hell”

Articles worth reading #2

Time goes on and I have a bunch of articles to read. As in the first post here is the list of five articles:

  1. A Complete Guide to Grid – CSS Grid is amazing. Seriously. And the good news is that you can already use it (with some limitations if you still need to support Internet Explorer). But anyway, this article is really good introduction with a lot of visual samples, I use it as a cheat sheet, because data is well-structured and contain a lot of visualization;
  2. The introduction to Reactive Programming you’ve been missing – this one is quite “old” but not outdated. I’d say the opposite. After the release of Angular which is heavily relies on RxJS this article is mandatory for reading. If you haven’t used streams before probably you’ll have issues at the beginning of your way. This article should be a guiding light for you;
  3. Debugging React performance with React 16 and Chrome Devtools. – this one is very basic but still can be useful if you’ve never monitored performance of your applications;
  4. Get Started With Analyzing Runtime Performance – one more good article describing available tools for performance analysis;
  5. Orinoco: young generation garbage collection – this one is more theoretical but still quite important. Because understanding how garbage collection is working is crucial for every developer;

That’s all for now. Thanks!

Articles worth reading #1

Nowadays the amount of articles, blog posts and other sources of information is so huge. It makes it impossible to read all of the posted text. So here is the list of 5 articles I’ve read recently which I found quite useful:

  1. The Shocking Secret About Static Types – this one I think quite interesting because it provides some thoughts regarding benefits of static types. If you are thinking regarding using TypeScript in your next project – consider reading this one;
  2. You Might Not Need TypeScript (or Static Types) – this one is like an continuation of the previous one. More thoughts, ideas and alternatives;
  3. JavaScript Start-up Performance – more in-depth article regarding start-up performance. It’s really important for developers who work with heavy Single-Page Applications;
  4. Choosing a frontend framework in 2017 – actually this one is not about choosing a framework. It’s more about evolution of front-end architectures and patterns. Anyway I found this one very interesting;
  5. All JavaScript frameworks are terrible – don’t be fooled by the name of the article. Seriously, just read it;

That’s all for now. Thanks!

Visual regression testing

Photo by James Lee on Unsplash

Automated regression testing on the big projects is one of the important approaches. A lot of projects are using this approach to reduce costs on manual regression testing, speed up the delivery, reduce costs of bug fixing. Automated UI testing is not an easy task because it’s tightly coupled with data, it’s highly dependent on HTML mark up, it’s slow (because communicating with browser via web driver, grabbing data from different HTML elements is slow), it’s really hard to verify visual issues with this approach (for example positioning of dialog on the viewport).
Continue reading “Visual regression testing”

Pure functions, JavaScript and Unit Testing

Photo by Christopher Burns on Unsplash

I’ve started to write a small game on GitHub to try Node.js, because I’ve never touched Node.js during work hours. On my current project I’ve back-end written with Microsoft .NET. I’ve decided to not use any UI framework, I just added Browserify to share some code between front-end source code and back-end source code. I’ve written a small amount of code and tried to cover this code with Unit Tests. And at this point I found that I have nothing to cover…

Continue reading “Pure functions, JavaScript and Unit Testing”

Side effects in Unit Testing

Photo by Irvan Smith on Unsplash

Today I want to share my recent unpleasant experience. I believe, most of the developers understand it, because it’s something, that is a part of Unit Testing term definition. But we are all humans and sometimes people make mistakes. In my case, the cost of the mistakes, made by one of the developers on the project was couple of hours of work. I’m talking about side effects in Unit Testing.

Continue reading “Side effects in Unit Testing”

Debugging HTML modifications

Photo by Irvan Smith on Unsplash

Let’s imagine the situation: you receive a bug in a component of application you don’t familiar with. The issue is connected with some strange DOM behavior. For example: some part is removed from the document, some incorrect classes applied. The code of the component is quite huge and it will take a while to find all the places, where these modifications can be performed, set breakpoints and try so see, whether this part of code is involved in the issue or not.

Continue reading “Debugging HTML modifications”

Memory leaks and memory management in JavaScript

Photo by Oliver Hale on Unsplash

Web applications are getting more and more complex from year to year. Couple of years ago nobody cared about the memory leaks on the web pages (yeah, they were really a set of web pages, but not web applications). Even if you forget to clean up some memory – it’s not expected, that user will spend a lot of time on the same page. There were a lot of navigation links, which removed information about the entire page from memory and loaded new page.

But now you cannot relate on this behavior, because now web sites turned into web applications. User loads one small HTML file, one script file and some other stuff (like CSS and images) and that’s it. Making requests from browser to servers user can stay on on the “page” for ages. In the worst scenario you will receive a report from production user: “Oh, your application is crashing after 60 hours of using”.

It looks like you have leaking memory in the application.
Continue reading “Memory leaks and memory management in JavaScript”

Flooding DOM by using HTML templates

Photo by Irvan Smith on Unsplash

Some time back I’ve discovered and started to use an amazing feature of HTML 5: templates. If you never heard about it – you definitely should visit HTML 5 Rocks website to read about pros and cons of these functionality. But anyway this post is not about feature itself, but about some pitfall, which I’ve faced after some time.

So, let’s imagine, that you are going to write some page with a dynamic content, which will be generated by using some AJAX calls and templates mechanism. For example you are not satisfied with slow data-binding from existing frameworks (all of them are too generic) and you developed your own data-binding with blackjack and… anyway, you have some HTML:

Continue reading “Flooding DOM by using HTML templates”