My Blog

Here you can find my private notes about programming that I wanted to share with you. Feel free to filter based on the topic you want or search for something specific.

    Software Architecture with JavaScript - In which part of your code should you do sanity & validation checks to your data?

    When working in an application which is divided into multiple architectural layers, it is often the case that the developers of a team do not trust the data their function get in one layer from a function in the same or in an another layer. For that reason they often add null checks (very common in C#) or in JavaScript’s case they add if (variable) {...} checks (implicit cohersion of values in an if clause) in order to catch an error before it happens and avoid breaking the execution of the code.

    But is it that bad for a function to fail or is it that bad for your application to throw an exception when something did not go as it is supposed to go?

    Read the complete article

    A list of reasons for why I like to use TypeScript - Part One

    With this article I like to post my thoughts about TypeScript and some of the advantages of the language that I use on my everyday programming tasks.

    1. Types, types, types

    Who does not know or have not implemented code like the following in JavaScript:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
        var person = {
            firstname: "Christos",
            lastname: "Monogios"
        };
        
        // Lines of code...
        
        person.skills = ["TypeScript"];
        
        console.log(person);
     
    
    Read the complete article

    How to speed up the compilation of your Jekyll website when you use npm modules

    Chances are high that you are going to use plugins from npm in your Jekyll website. For example you might want to minify the CSS files by using Gulp, or bundle together your JavaScript files with Webpack.

    A new node_modules folder is going to be created on the root of your website and now all of a sudden your website need much more time to be build when you start the development-server with Jekyll serve.

    Read the complete article

    How to fix the 'Unable to find "react" ("npm") in the registry' error when using the tool Typings and TypeScript

    During the last years we see that every month new JavaScript frameworks/ tools/ libraries are comming out to the public and they all promise to help us develop better, faster and give more quality to our applications. One of the favorite combinations is currently the use of the React framework, TypeScript as superset of JavaScript and the webpack tool for combining files together, dependencies and more.

    When using the combination, it is very probably that you are also going to use the Typings plugin for fast downloading of definitions files for TypeScript.

    If you installed react with npm and you get the ‘Unable to find “react” (“npm”) in the registry’ error from Typings when you try to download the d.ts file of react, then here is the solution to your problem:

    Read the complete article

    Create a breadcrumb list of links with JavaScript and use it inside your React applications!

    The advantages of using breadcrumbs in your web applications are widely known.

    Suppose we have the following example of chained links in a breadcrumb:

    Main page > Main category 1 > Sub category 1 > Product 1

    Read the complete article