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”

Configuring IIS using console

Photo by Arget on Unsplash

Setup of new development environment is a very time consuming operation each time (no matter what the reason is: moving to new project, OS reinstall, hardware update). Tools are getting better and better each day, now having fast internet connection and package managers, like NuGet and NPM we waste less time on installing all the required dependencies. But today I want to dig into small, but very easy-to-automate part of development environment setup part – adding and configuring site on IIS.

Continue reading “Configuring IIS using console”

C# Interactive

Recently I’ve installed the Update 1 for my Visual Studio 2015 and in my opinion the killer feature of this update is the C# Interactive window.

I’ve asked couple of .NET developers “What you are doing, when you need to quickly check one small code snippet (for example, LINQ expression or Regular Expression behavior for different input strings)?”. Here are the couple of popular answers:

  1. Use some third-party tools (like LINQPad);
  2. Open additional instance of Visual Studio with “ConsoleApplication1” project;
  3. Use online compilers;
  4. Use Immediate Window.

Continue reading “C# Interactive”

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”

Getting started with Grunt

Currently I’m studying new development process for my project and I’m learning the Grunt automation tool for this purpose. I want to share some basic knowledge about Grunt configuration. I’ll assume Windows OS, but you can use Grunt on Linux-based OS as well. Let’s start:

Continue reading “Getting started with Grunt”

Some words about == and ===

Photo by Irvan Smith on Unsplash

When developers starting to write the code on JavaScript I’ve noticed, that they are using “==” (I’ll call it equal), but not “===” (I’ll call it identity) most of the time. Probably, you will not see any difference most of the time, but one day you’ll get a very interesting error and probably you’ll spend a lot of time, trying to resolve it.

Let’s take a look at the details:

Continue reading “Some words about == and ===”