Lo que pasa al copiar código sin revisarlo

Muy bueno lo que se explica en Nissan app developer busted for copying code from Stack Overflow:

Copying and pasting code from the internet is one of the biggest open secrets in computer programming.

A developer working on the NissanConnect EV mobile app just got caught red-handed when a verbatim Stack Overflow answer showed up in the most recent app update.

But the fact that a line of code copied from the internet somehow made its way through the quality assurance process (there is a QA process for Nissan apps, right?) and deployed as an update — to an app that manages a car nevertheless — doesn’t give me a ton of confidence to Nissan or other connected cars in general.

So the lesson here? Never, ever copy and paste code from the internet you don’t understand. I repeat: never copy and paste code from the internet you don’t understand.

Las condiciones Yoda

Gracias a la lectura de What lame things do programmers often argue about? he descubierto el término Yoda condition:

In programming jargon, Yoda conditions (also called Yoda notation) is a programming style where the two parts of an expression are reversed from the typical order in a conditional statement. A yoda condition places the constant portion of the expression on the left side of the conditional statement. The name for this programming style is derived from the Star Wars character named Yoda, who spoke English in a non-standard syntax.

Yoda conditions are part of the WordPress and Symfony coding standards.

Al principio no entendía la ventaja que podía ofrecer este estilo de programación, pero:

In programming languages that use a single equals sign (=) for assignment and not for comparison, a possible mistake is to assign a value unintentionally instead of writing a conditional statement.

if (myNumber = 42) { /* … */ }
// This assigns 42 to myNumber instead of evaluating the desired condition
Using Yoda conditions:

if (42 = myNumber) { /* … */ }
// This is a syntax error and will not compile
Since 42 is a constant and can not be changed, this error will be caught by the compiler.

¿Sobre qué cosas estúpidas discuten a veces los programadores?

Me ha hecho reír, pero a su vez me ha hecho pensar, la pregunta What lame things do programmers often argue about? publicada en Quora.

El inicio es muy bueno:

#thecodingevolution

  1. //11 lines
  2. public String getSex(int num)
  3. {
  4. if(num==0)
  5. {
  6. return “Female”;
  7. }
  8. else
  9. {
  10. return “Male”;
  11. }
  12. }

 

  1. //1 year later. 6 lines 🙂
  2. public String getSex(int num){
  3. if(num==0){
  4. return “Female”;
  5. }
  6. return “Male”;
  7. }

 

  1. //2 years later + lazy writing, 3 lines xD
  2. public String getSex(int num){
  3. return num == 0 ? “Female” : “Male”;
  4. }

Lo que pasa al rediseñar un sitio web

How We Lost 47% of Our Users After a Redesign explica:

By trying to make the service simple and minimalistic we complicated user’s experiences. Getting rid of a few tiny details dissolved the whole sense of a queue and availability was lost, leading to a bunch of unanswered questions and reduced usage.
But it’s not the end! We gained a great experience and are determined to make things better now, and more important, we know how.

Errores del software

Interesante la recopilación de entradas publicadas en microsiervos dedicadas a los errores del software y su impacto en nuestras vidas:

Los falsos nativos digitales

El concepto de nativo digital es un concepto que me “chirría”:

Se denomina nativo digital u homo sapiens sapiens digital a todas aquellas personas que nacieron desde 1980 hasta la actualidad, cuando ya existía una tecnología digital bastante desarrollada y la cual estaba al alcance de muchos.

[…] un ejemplo de esto son los niños y los jóvenes que toman un móvil, un tablet o un ordenador, y lo utilizan bastante bien aún sin mucho entrenamiento previo.

¿Es verdad eso? ¿Un nativo digital coge un aparato digital e inmediatamente sabe utilizarlo?

Recomiendo la lectura de Hola, tengo 14 años y he pasado una semana usando el IRC para entender el falso mito de los nativos digitales.