Graph Theory in Javascript

I’ve been a speaker to a London Algorithms Meetup and the subject was Graph Theory.

Here there is the link to the repository: with the javascript code.

I have created a pairing exercise with specs to guide through the creation of an undirect Graph by using an adjacency list. After all the vertices and edges have been added to the Graph, the exercise requires to visit a Graph with a Breadth First Search Algorithm. In the repo I have written some Javascript tests to follow during the code development. You can run tests by opening SpecRunner.html.

In the repo there are two branches: master and solution.
As you might expect, solution branch contains the complete javascript code.

After a brief introduction to what is a Graph and which are the use cases, I’ve explained how to build a graph with an Adjacency List and then I’ve shown which are the Graph Traversal Algorithms: Depth First Search and Breadth First Search.

What is a Graph

Graph is a non linear data structure, it contains a set of points known as nodes (or vertices) and set of linkes known as edges (or Arcs) which connects the vertices.

Continue reading “Graph Theory in Javascript”

An Introduction about Ember JS

Yesterday I’ve done a presentation about front-end development with javascript and I’ve introduced the Ember JS framework.

It was an amazing evening, I really enjoyed it! Thank you Geek Girls Carrot UK for organizing this event.

Geek Girls Carrots is an organisation that promotes women in IT industry and tries to encourage more females to think about career in tech.

Download Slide


Download Slide


daniela-remogna-introducing-ember-js daniela-remogna-javascript-speaker

How to create a single page app with AngularJS thanks to the help of Yeoman

Yeoman ( is an awesome tool that helps you to easily scaffolding a web application using best practice; in short words with yeoman you get rid doing manual configuration and set up of a project from the scratch.

Yeoman has a bunch of generators, for instance there is a generator for creating an angularJS app, an other one for creating a backbone app and so on. You can find a complete list of the generators on this link:

In this small tutorial we are going to use the yeoman angular generator for generating all the boilerplate that a developer needs to get started with an angular app. You can find more informations about the angular generator at the following link:
Continue reading “How to create a single page app with AngularJS thanks to the help of Yeoman”

An introduction to AngularJS

If you wanna talk about AngularJS you’ve to explain the concept of: Directive, Controller, Expressions, Two way Data Biding and Modules.

AngularJS is a javascript framework maintaned by Google who helps developer to build awesome Single Page App. It is born especially to build web app after a user has logged in, so for all the apps that doesn’t need to be indexed by search engines likes CRM, ERP, Social Network and so on. You can compare angular as a new HTML compiler which allows you to create your own domain specific language in HTML, by attaching your own behavior to any HTML element, attribute or text. In AngularJS the term “compile the HTML” means attaching event listeners to the HTML to make it interactive. It follows a declarative approach in order to infer behaviour on your html page.

Continue reading “An introduction to AngularJS”

Test Driven Development with Javascript

Why should I write Test before Source Code?

Writing Tests is not only a technique to validate your code. Tests give you the specifications of how the code should behave. Writing tests before source code implies that you must know exactly the detailed behavior of your code, as observed from outside the code itself. This is the basic idea of Test Driven Development.

Wikipedia gives us this definition:

Test driven development is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initial failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards.

Continue reading “Test Driven Development with Javascript”

An introduction to Backbone

Thanks to the large diffusions of mobile devices such as tablet and smartphone, nowadays when a developer has to create a web application, the first requirement he has to satisfy is designing a web applications that can be delivered via a desktop browser or a mobile device (iPhone App, Android App and so on).
The first question a developer has to answer is: how to organize the code between server and client side?

If the client side is rendered completly from server side code, the developer has to write different code for each device. So it could be complicated. A better approach is writing the server side code in a manner that it just returns a jSON response with all data of the application; then the client side javascript library will read and process this jSON response in order to create the required DOM elements. With this approach, the developer can use same server code for any device and when the developer make changes on the client side, the server side code does not need to change.

Continue reading “An introduction to Backbone”

I’m a PHP Developer, why I should use Javascript & Node.js to write my server-side code.

If you are a PHP Developer maybe you are used to write your server-side code in PHP and then you make run your code on a web server like Apache. Javascript, from your point of view, it’s simply a client-side scripting language and you use it to handle the front-end client business logic on a web page. A front-end developer might argue that with javascript is possible to manipulate the DOM via a library such as JQuery. You can do more than this. With one language you could code client-side and server side of a web application. Your brain context-switching will say “Thank you”. This is actually a benefit, for both developers and other company’s stakeholders (Search on google “the cost of context-switching for developers”).

So, it may sound strange to hear “Write your server-side code in Javascript using Node.js techonology“.

Anyway, you are here because you don’t understand why you should use Node.js to develop web applications.

Take a rest, drink a coffee and continue to read this article.
Continue reading “I’m a PHP Developer, why I should use Javascript & Node.js to write my server-side code.”

Asynchronous Javascript with Promises

Promises are an alternative way to the callback system for javascript asyncronous event. Instead of calling a callback, we call a function that returns immediatly a promise. Thus we can exit very soon from the function and continue with our code as in synchronouse code style.

Promises are a way to avoid the Callback hell and they are typicaly used for Ajax Requests (jQuery returns promises by default from Ajax requests) and UI animations. With promises you can easily synchronize tasks or execute tasks sequentially.

Continue reading “Asynchronous Javascript with Promises”

How to write your own JQuery Plugin

Dont repeat yourself – DRY – and write your own JQuery plugin for that piece of code that you reuse a lot of time in your projects.

Creating a simple Highlight Plugin

In this small example we are going to create a plugin that highlight an element. It simply changes the background and font-style css properties.

The first thing we have to do is to be sure that our plugin runs inside a local scope by wrapping out all your code inside of an Immediately Invoked Function Expression (IIFE):

// Plugin basic structure
(function($) {

    $.fn.yourMethod = function() {

        // Your Method code



Continue reading “How to write your own JQuery Plugin”