GeekWare - Daniel Pecos Martínez

Software Development

Parchis: the reason why I am a developer

Parchis: the reason why I am a developer

A while back, digging into an old DO NOT DELETE backup folder in one of my old hard drives, I stumped upon a folder called parchis, and for a moment I held my breath until I found some *.bas files there! So what? Well, I just found the lost source code of my very first project, the one I coded while learning about variables, procedures and loops, the one that made me realize that this is the kind of stuff I wanted to do as my professional career and hobby.
How I write AWS SES email templates using MJML

How I write AWS SES email templates using MJML

If you are a AWS SES user (AWS’ email system) you probably know that working with its JSON based templates is not a user-friendly task: Text and HTML content are defined as properties of a JSON object It’s a JSON file, meaning that you have to escape some characters, like " in the HTML It’s quite hard to find the content to change in the HTML being stored in a single line But still, is a quite convenient system, as hosting your own email server is quite an effort, and you want it to be reliable.
REST API with Node.js and Swagger

REST API with Node.js and Swagger

In this tutorial I’ll show how to piece together the required NPM modules to build a REST API in Node.js with proper Swagger documentation. We’re going to use Express as the HTTP framework, and the Swagger documentation will be written as inline comments within the code, as close as possible to the handling endpoint or models that will implement the contract, so it will be harder for them to eventually diverge.

Surprises with Java packages

Packages in Java is a quite simple and straightforward concept of the language. It’s there from the beginning and it’s commonly used by every Java programmer. In a few words, these are the rules you have to follow to create a class inside a package (spoiler: which are not completely true, as we’ll see later): Package statement must be the first one specified in a java class file A package namespace must match the physical path of the file, i.e a class defined with a package a.b.c must be placed in a path a/b/c/ Easy right? Let’s check…

Java 8 and Functional Programming

Purpose of this post is to provide a glimpse of the new features included in Java 8 that shift this language towards a more Functional Programming paradigm. But before, let’s define what we understand for Functional Programming (FP). Functional programming key characteristics include: Higher Order Functions Pure Functions and Immutability Tail Call Recursion Higher Order Functions for a FP language means that functions are considered first class citizens, allowing the programmer to use them as any other value the language defines, for example, a Function value:

Groovy to be part of the Apache Software Foundation

As March 11th, Pivotal dropped its financial sponsorship for Groovy, and despite of not really endangering it, as Groovy is an already well established language with a great community backing it, it raised many concerns, as the required boost a platform like this deserves was missing until now. Furthermore, its creator and project leader until lately, Guillaume Laforge, also recently stepped back in order to focus in Restlet. Also the recent release of Java 8, with the introduction of lambdas into the Java language has increased the interest and traction of Java, making a lot of people question if there were still room for other JVM languages, even more being so closed to Java.

Java 8 one year later

It’s been a little more than a year since Java 8 was released (2014/03/18) and you might think that it’s a little too late for a What’s new in post. In fact latest public update available is 8u40, so let’s review not only what was initially included in Java 8, but what else has changed during this first year, up to release 8u40. Lots of changes were included in the initial Java 8 release, being probably the most notable of them, in my opinion (feel free to disagree, looking forward to discussions):

From Node.js back to Java

During last year, I had the chance to work as CTO of a startup, working mainly within MEAN stack. I was happy, the technology I was working with was in a great hype and its community grew bigger and bigger with lots of projects popping up everywhere. But life is continuously changing, and I started to work in a new company within Java/JEE technologies. I was back to my first days as a professional computer engineer. Java ecosystem is huge, and there are some well established tools that you must control if you want to progress as Java developer. But Java -the language- is getting older, and newer languages are more expressive and require less boiler plate code (don’t get me wrong, JVM is a great platform, and probably the best one for enterprise applications). Even with the recent release of Java 8, which introduced Lambdas and some functional style capabilities, I still feel like writing too much, or at least much more than with other languages.

Who is who in computer science

I have problems remembering people’s names. Really, I’m not good at it. And that’s no exception with computer technology. That’s why I’ve written this post, to try to improve and persist those names in my head. Let’s see who is who in nowadays computer science. Methodologies <div> <strong>Kent Beck</strong> (<a href="http://en.wikipedia.org/wiki/Kent_Beck">wikipedia</a>, <a href="https://twitter.com/KentBeck">twitter</a>) &#8211; XP, Agile, TDD </div> </td> <td width="50%"> <a href="http://martinfowler.com/"><img class="alignleft" src="/assets/2014/05/martin_fowler.png" alt="martin_fowler" width="100" height="85" /></a><strong><a href="http://martinfowler.com/">Martin Fowler</a> </strong>(<a href="http://en.wikipedia.org/wiki/Martin_Fowler">wikipedia</a>, <a href="https://twitter.com/martinfowler">twitter</a>) &#8211; OOP, Agile, TDD </td>

Node.js and V8 history

Talking about Node.js history, it’s talking a little bit about V8 history. But let’s start with a one line definition of what it is: Node.js is a platform built around Google Chrome V8 Javascript engine, to create lightweight, fast, scalable, event-driven and non-blocking I/O applications. So lets begin talking about Node.js origins, the V8 javascript engine. V8 is an opensource project by Google and it is in the very core of Google Chrome browser. Its first public release was on September 2, 2008, same date Chrome’s first release was announced. It was a big step forward in browsers’ performance, and it pushed browsers’ technology to a new whole level. It’s written in C++ and its biggest revolution was that it precompiled the Javascript source code to machine code instead of just interpret it and then applied a JIT process again in runtime to improve dynamic code execution.

Javascript Allongé: a review

Javascript Allongé@raganwald is one of the more refreshing coding books I have read in a big while. Usually when I face a programming language book, I skip the beginner chapters (if I already know the language, of course) and go directly for the juicy ones, but with this one I tried to follow it from end to end because I read some comments on twitter telling that the way basics are explained, become a really solid base for the language, so I gave it a chance.

Javascript Promises Pattern in plain Javascript

In the previous post I gave a glimpse of the Javascript Promises Pattern (JPP). Now we are going to take a more in deep look into it and implement our (simplified) version of this pattern. First of all, let’s sow the code I we defined works: we had three operations (to make the example simpler, they all share the same code, but this is not a requisite), each of them expecting a set of arguments which are processed by an asynchronous operation. The result of this asynchronous operation will be feed to the next operation, and so on until we achieve processResults function that will handle the final result. This is a refactored version of the code exposed in the previous post:

Javascript Promises Pattern – 101

I am sure you have heard about the javascript Promises Pattern, but if you haven’t, here is a quick and simple definition: a promise or future is an object that represents a future result, not yet obtained or calculated (here you have a more complete definition). In fact, what is really nice about it is that allows you to define callbacks for async code in and more elegant and readable way.

HTTP connection + HTTP Authenticacion + Proxy + SSL

Many times during your life as a java developer, you will face the situation of retrieving some resources using an HTTP connection. At first, it will seem easy, but probably some problems will arise such as: Needing to use an HTTP Proxy (maybe authentication would be required) Establishing an HTTP authenticated connection Connecting to a server that uses SSL self-signed certificates I’m sure you will quickly find the Apache Commons solution: commons-httpclient. In this article I will show you some code that, I hope, will ease you the resolution of the previous obstacles using this great API from Apache.

¡Feliz aniversario BASIC!

El 1 de Mayo de 1964 se ejecutó el primer programa en BASIC. Los creadores de este lenguaje de programación, los profesores John G. Kemeny y Thomas E. Kurtz del Dartmouth College, hace 44 años ejecutaron por primera vez un código escrito en BASIC (Beginner’s All-Purpose Symbolic Instruction Code). La búsqueda de un lenguaje potente y sencillo de usar (por aquellas fechas se solía utilizar Fortran y Algol) comenzó en el año 1956, con el fin de facilitar a sus estudiantes el aprendizaje de los métodos de programación.

JavaServerFaces, Spring WebFlow y Struts Tiles, todo en uno

¿Mezclar la versatilidad de JSF con la definición de flujos de negocio de SWF, todo ello con una estética semejante gracias a Tiles? Pues es posible, aunque resulta realmente tedioso y complicado para aquel que es relativamente nuevo a algunas (más bien todas) de estas tecnologías del mundo Java JEE. A esto es a lo que me he dedicado la última semana de trabajo, a intentar comprender el funcionamiento y buscar por Internet la forma de poder conjugar estas tres tecnologías. He conseguido hacerme una idea del complejo funcionamiento de JSF, SWF me ha sorprendido gratamente por la gran potencia que se consigue con tan pocas líneas de código, y Tiles, aunque ni tan avanzado tecnológicamente ni tan sorprendente, ofrece unas posibilidades de diseño visual que unifica toda la aplicación web con tan solo unos poco ficheros.

Mundo Java

Desde hace cosa de unas semanas, el mundo Java está cambiando notablemente. Por un lado, Sun publicó Java EE 5.0, junto con Sun Application Server 9.0, primera versión estable del proyecto Glassfish, que pretende implementar un Application Server libre para la especificación de JEE 5. En esta nueva versión se ha incluido, a parte de un cambio de la nomeclatura para las versiones, la especificación de EJB 3.0, Java Persistence API, una mejora en el desarrollo de webservices o JSF entre otras características.

Mono: ¡Hola Mundo!

Para retomar de nuevo la marcha del blog, he decidido comenzar mostrando algunos ejemplos de programación en C#. Por el momento os dejo el obligatorio programa para todo aquel que empieza con algún lenguaje. Hola Mundo! using System; namespace HolaMundo { public class HolaMundo { public static void Main (string [] args) { Console.WriteLine ("Hola Mundo!"); } } } Sencillo, ¿verdad? Tiene mucha semejanza con Java, exceptuando que las palabras reservadas difieren y que Java no posee el concepto de espacios con nombre o NameSpaces, entre otras.

Funcionamiento de .NET

En los artículos anteriores hemos hablado de conceptos como CTS, CLI (CLS), IL o JIT, los cuales pueden resultar bastante confusos. A continuación daremos una aclaración del significado de cada uno de ellos, y explicaremos su función dentro de la plataforma .NET, para lo cual se hará una explicación más a fondo de su funcionamiento. Hemos comentado en artículos anteriores que cuando compilas un código fuente a un binario de .NET, éste binario no contiene código máquina de la arquitectura en la que se compiló, sino que se genera un código para una máquina virtual, al estilo del bytecode de Java.

Pasado, presente y futuro de Mono

En este artículo os comentaré un poco de historia sobre la evolución de la tecnología .NET y del proyecto Mono, que a pesar de su corta existencia, ha sido un proyecto muy vivo, y en el cual han participado y participan muchas personas de todo el mundo. .NET es una tecnología desarrollada por Microsoft, que ha sido estandarizada en el ECMA (C#, CLI), ofreciendo la posibilidad de crear utilidades que trabajen con este entorno, sin miedo a que un día Microsoft interponga una demanda o que simplemente cambie las especificaciones a su antojo.

¿Qué es Mono?

Mono (http://www.go-mono.com) es la implementación libre de la tecnología .NET, capaz de correr en Linux, sistemas *NIX, MacOS, y Windows. Gracias a este proyecto, los usuarios de sistemas *NIX podremos contar con los últimos avances en lo que a tecnología del software se refiere. Y es que Mono no es simplemente un compilador y su correspondiente runtime, sino que también se incluyen una serie de utilidades que nos facilitarán mucho la vida a la hora de programar, como un explorador de documentación –MonoDoc-, o un mini servidor web –XSP-, con capacidad de procesar programas escritos para ASP.NET o de ofrecer un servicio web para el resto de Internet, entre otras.