tools suggestions if you are seriously working with javascript and node.js

i read this post some time ago. it talks about some tools to use with javascript and node.js. some i’m using and i consider important to use. some i’m still not using but i should be. others are nice and i’m going to use some day.

he also mentioned some issue, such as, manage dependencies. he also mentioned some things that you should avoid when using javascript.

if you are seriously working with javascript and node.js, i suggest you to read this post and see if you can get something new for your toolbox.

this is my priority list of some of tools mentioned by him:

  1. mocha
  2. zombie
  3. coffeescript
  4. jshint/jslint

toString or +”" to cast a number to string

in another post i talked about an “automatic” conversion of a number to string when concatenating a string in javascript.

some developers use this feature to cast a number to string.

var number = 897;
var numberToString = number + "";
> "897" #between quotes in a debug tool showing that it's a string

i don’t like this approach even considering the result is the same. the javascript has the method toString. i prefer to use this method instead of using +”".

var number = 897;
var numberToString = number.toString();
> "897" #between quotes in a debug tool showing that it's a string

the reason i prefer the method toString instead of  + “” is the readability. the concatenation with a empty string “” can be confused or misleading when another developer is reading the code. this concatenation doesn’t show clearly that its aim is cast a number to string. i believe the method toString shows clearly this aim for the developers reading this code.

dave thomas explaining what he thinks to be a clean code in the first chapter of Clean Code book says:

“Clean code can be read, and enhanced by a developer other than its original author…”

answer: is there any difference in javascript? “6″ + 7 + 8 and 6 + 7 + “8″. concatenating string and numbers

last week i posted a question about the difference between the results of  ’6′+ 7 + 8 and 6 + 7 + ’8′ in javascript. the concatenation of string and number can be a little trick.

probably you know that numbers are converted to string when it’s being concatenated to a string. it’s a interesting feature. however, it’s important to have a good understanding about how this conversation works. So, unexpected results can be avoided.

the conversation occurs only when the first string is added. So,

'6' + 7 + 8
> 678


6 + 7 + '8'
> 138

it’s also important to know that it doesn’t happen with other math operations, such as:

'6' + 3*3 + '7'
> 697


'6' + 3-3 + '7'
> 607

javascript is more powerful that you have imagined! did you “really” know?

the first time i wrote one line in javascript was around 1998 and 1999 ( you are right…i’m old… :) ) i can guarantee the life was not easy that time. many developers started to hate javascript. they were happy when solutions for web arrived and they could create website without touch in one line of javascript. actually, i agree with the declaration that javascript is one of the most misunderstood languages in the world. i would say under-estimated.

the scenario is changing recently. “web 2.0″, interactive sites, ajax and others. these are common and usual terms that moved the developers to take a look in the javascript again. even between .net communities, javascript is being mentioned, used and sometimes suggested. but, as happened with some frameworks, languages and tools, some developers start to use, evangelize and also say “it’s really good and nice”. actually, they don’t know what they are using. they only are following what is “fashion” and “cool”.

as i mentioned, javascript is one of the most misunderstood and under-estimated language. we really can do many things. much more than just have control over DOM. once we decided to use javascript, the minimum is understand its potential. and it requires a small effort to get the basic knowledge.

i’ve seemed people talking that coffeescript is nice, “you should use coffeescript”, “i can do what i want with javascript”. but, they really don’t know javascript. i’m not talking about know how to write a function in coffee script. i’m talking about knows what is a function in javascript. i’m talking about knows what is the difference between “3″ + 4 + 5 and 3 + 4  + “5″.

i’ve been studying javascript and its many frameworks. i like what i see. i’ve used coffeescript and it’s really nice and make the difference. however, i need to know javascript if i want to write a good code in javascript. even if i’m using a framework or even i’m not.

so, let’s use javascript, coffeescript, node.js and any other .js. however, let’s really know what we are using…so, we can write a good code in c# or in javascript.

the land that scrum forgot – nice video

the 2012 norwegian developers conference happened one month ago. but i’d like to suggest you to see this video from the last year.

we saw a lot of people moving from waterfall to scrum. but we are also seeing people moving from scrum to other things saying it missed something.

uncle bob express clearly his opinion about the scrum. maybe you can think it’s radical, mainly if you use it. but, it’s a good warning. he tries to break the idea of scrum is necessarily agile.

i liked this video because he tells a little bit about the agile history. and also shows some of the mistakes we can do when we decide for scrum.

welcome to the code snack!

welcome to the code snack!!! my aim in this blog and site is share a little bit of what i’ve been learning e a little bit of my experiments in the coding world, while i’m tasting the my code. :)

i intend to talk about different topics related to coding and best practices (“clean code”, unit test…). i also intend to share some of article or videos that i watched or read, usually adding some of my opinions about that topic. sometimes, i’ll talk about some situation that i was involved and that i believe that we can learn something or at least laugh together. finally, i want to talk about the new challenges of developer application for the new “post-pc era” or “mobile era”.

the post are going to be in english and portuguese. you can change the language using the banner in the menu. the rss feed is also available in the both languages. so, if it’s not the language you prefer, change to it before sign the feed.

this is a responsive site and you can read it in your computer, tablet or phone.

i hope you enjoy it. wellcome!!!