Archive | Technical RSS feed for this section

Javascript Double Not-Operator(!!)

8 Oct

In javascript Falsy and Truthy values are used all over the place.

For example the following values are always falsy:

  • “” (empty string)
  • undefined
  • false
  • 0
  • null
  • NaN

And any other value is truthy.

Since undefined and empty string are falsy values then we could replace this code below:

if (typeof x !=== 'undefined' && x !=== '') {
  // not emtpy
}

 

with a falsy/truthy verification:

if (x) {
  // not emtpy
}

 

To set the result of falsy/thruthy verification to a variable is possible to use a double not-operator(!!) which will force a type casting to Boolean.

var xIsEmpty = !!x;

 

Actually !! is not an operator it is only the ! operator twice. The first ! will cast to boolean inverting the result. Then the second ! will invert again the value so it is the expected boolean value.

var x = 0;        // falsy
console.log(!x);  // true   (it is not what we want)
console.log(!!x); // false

 

Originally posted in blog.maxcnunes.net

Speed Boats

11 Jul

will

by Will

Speed Boats – How to Improve your Sailing in 4 Easy Steps

Trust me. The development process is like driving a speedboat. You need to go as fast as possible and tackle any obstacles using the very best approach. You need to consider the wind, waves, rocks, engine, even the sun… and get them to work in your favour.

speedboat

The idea is to create a new perspective for your retrospective. When facing problems, the team will find a creative way for dealing with them. Not only is creativity involved in this process but you can also provide efficient strategies to solve your problems.

Continue reading

Tribalingua App

27 Mar

Tribalingua

Couldn’t attend the class? Tired of asking your classmates what the howework is? Lost the awesome link  that Jon suggested you have a look at?

Your problems are over! The Tribalingua app is coming.

Tell don’t Ask

17 Dec

maxcnunes

Do you take care with how you write a letter so that it will clear and easy for your recipiant  to read? Well, it should be the same feeling with the code that you write. With a letter we sometimes have to stop and think what is the best way to write down what is in our minds. Therefore, we have to be clear and easy for anyone else reading what you were thinking when you wrote that.  Just as we have rules to write a nice readable letter, also we have Patterns and Principles to write clean and understandable code.

The principle Tell don’t Ask helps to ensure a correct division of responsibility  without causing excess coupling to an incorrect class.

Continue reading

Ruby in the middle of .NET world

3 Oct

We work with .NET all day long and use all .NET and Microsoft stuff like TFS, C#, WPF, ASP.NET, SQL Server. That is pretty cool, but also there are some nice non-Microsft stuff that are really awesome.

For example, this sprint I have used Ruby to automate a task related to a story that I was working. Long story short I had to copy values from a spreadsheet to a sql query, creating calls to procedures with the appropriate values.

Continue reading

Tips4Hackers: Template Method Design Pattern

26 Sep

mitchelby Mitchel 

Template Method Design Pattern

Howdy tribalingua followers,

This post talks about a design pattern known as template method. For those who don’t know what a design pattern is, here is a quick definition: A design pattern describes a simple and elegant solution to a specific problem in object-oriented software design. It defines a structure that makes it easier to write reusable code, decoupling your system in a way that new requirements can be easier fulfilled.

Continue reading

Programmers and the Automated Build: A story of break-ups and love

18 Apr

If you are a software developer and work with automated build, you must admit: you have already broken the build at least once in your life. This is not something to be proud of, surely, but you have to keep in mind that breaking the build is crucial for your moral constitution. You certantly are a different person after breaking the build – at least more careful and attentive.

But if you are not a developer or have just started working with it, this post will try to explain you – through images – what is the sensation:

Continue reading