On all these years (about 20) working with many developers, with different styles of coding and different languages, I saw people doing some strange and funny things, also some bad and good practices.

After a lot of time dealing with these kind of developers I had the chance to read a very nice book called Clean Code which have many suggestions about how to write a clean and readable code with contribution of some great names of the development history like: Bjarne Stroustrup, inventor of C++, Kent Beck’s author of Implementation Patterns, Grady Booch, author of Object Oriented Analysis and Design with Applications, Dave Thomas, founder of OTI, godfather of the Eclipse strategy, and others.

After reading that book I always keep an eye on my code to keep it as clean as possible, and also, I remember all that weird codes from the past that I would like to list below:

The never grows developer:

When we start learning how to develop, we always have some sample code like x = y + 1 or i++, but these are only samples for the beginers and does not mean that the developer should continue to use x, y and i as constant and variable names.

Also, the never grows developer, always try to use the same functions and procedures to solve modern problems which probably already have a function or some kind of library to do that;

The no indent developer:

This comer from the newbies developer which does not have indentation on code, believe it still happens, specially these days with script languages where everyone tries to put everything in just one line;

The no comments developer:

This one never puts a comment in the code, even if the code looks like:function calculate (p, y, v) {
return ((p+y*v)^3 ? true : 0);
}

The comment all developer:

This one is also so bad as the no comments developer:function save (userName) { // functionsave the user name
var name = userName; // get the user name paramenter
saveToDatabaseFunction(name); // save the name on database
result true; // always return true after saving
}

This one does not worry about the classes names or the structure of the project, this developer only creates a file called functions or util and add code and functions and classes there.

The economic developer:

This one still thinks that our computers have only just 640K of memory or that our internet bandwidth is about 9600bps. This developer usually tries to do all in just one line:
if (getContentFromForm() + (X[j]+X[i]) * (Y[j]-Y[i]) > 0 ? (Xj Yj - Xi Yi) + (Xi Yj - Xj Yi) : Xj Yj - Xj Yi + Xi Yj - Xi Yi)){ result (Y[j]-Y[i]); }

Many strange things came and I believe that many more will come. Until there I keep reading and practicing to do the best that I can.

There comes a time in the life of a developer where he/she is forced to deal with an API, be a desktop or a web developer, in some time it will be necessary.

Also, maybe, the developer will need to create it’s own API and then is where the things get a little bit difficult. There is a lot of concerns, discussions and suggestions around API standards but none of them are still the definitive right way to build an API, so as always each developer builds the code as it wants.

For me, everytime that I need to deal with a webservice, I study a lot, check the new standards look at the client needs and make the best effort to make the most light and precise services that the client wants. But thats the hard way, the easy way should be, to unpack a generic API code adjust some settings and start to delivery services… Should be like this.

There are some nice tutorials and tools on internet about building an API, like with laravel and with apigility, but almost all have some framework dependencies and then I though in something more simple, just with the basic stuff, why not?

Considering all that, and on all the effort spend on every new webservice, I decided to make a very simple API pack with the basics to make a webservice to work, so here is what I tried to covered:

Auto detect XML-RPC or REST request;

Standard formated XML or JSON automatically (depending of the request);

When I started to use the PhoneGap service to build mobile apps I had some dificulties on about where to begin or what should I use to get a very good looking app, even a simple “hello world” app was a bit difficult to do, so, here I will present a pack that I did with the basic stuff to start building a mobile app on PhoneGap.

As covered in another post of mine, the PhoneGap is a handy tool that allow web developers to develop native mobile apps just using HTML, CSS and Javascript, for more details about the PhoneGap tool, take a look on that introduction.

The PhoneGap Starter Kit, as I like to call, is a pack with the very basic stuff to start a simple app throuh PhoneGap. This pack includes:

Actually is hard to think in any new service without creating a mobile app, be a sales store, a social resource, any delivery service or even a game, all want to be present on mobiles.

Until some years ago, the ability to make a mobile app was just limited to those who knows C, C#, Java or yet other proprietary language, but than, comes the Adobe PhoneGap tools who give to all web developers the chance to build a native app using web coding knowledge.

The PhoneGap Service is free for building open-source apps through the github account, or in case of private projects the price depends of the plan. On free account the user can have at least one private project.

The PhoneGap uses the Apache Cordova lib and a web based rendering engine to make possible to run the HTML, CSS and Javascript content. The tools provided also includes a lot of plugins that makes possible the comunication to native resources of mobile devices like: giroscope, camera, contacts, files and all that native stuff without worring about the coding language, just add the plugin and code in javascript.

Basically, to get started, the developer just need to make or have an Adobe Id and subscribe to the PhoneGap Enviroment. After that the developer can download the desktop tools to build, compile and test the developed apps. Also, instead of download any software, it’s possible to code a native web app and upload a zip file to the PhoneGap Enviroment just to compile.

The online PhoneGap Compiler is fast, accepts to compile with your developer key and also gives a QRCode to download teh compiled app to test.

The PhoneGap compiler actually can build apps for Android, iOS and Windows Phone, which is very handy.

Weekends are a great time to enjoy doing what you like to do, ins’t it? I like to code and read and learn new technologies, experience new computer languages, so past weekend I did something that I was planning to do a long time, try to code something to Elementary OS.

Why the Elementary OS? Well, first of all, I like to try new tech stuff, in second, the Elementary OS makes me feel good to use, a strange feeling, different from using another linux distro. I don’t know, I think I’m in love for it…. ok, let’s stop with this bullshit and back to develop.

Basically, the Elementary OS is over GTK 3 and uses Vala as main language (or not a language) to develop it’s applications. The Elementary “Getting Starter” section for developers already conduces you through very detailed steps to build your first app and to get involved with this magic enviroment.

In the end you get a very nice hello world simple app and a few resources. It’s a very nice experience to see your work running natively.

But I found that the steps are too much detailed, not that it’s bad but sometimes I would like to do it more quickly as I already know many of these basic stuff. Also, in sometimes I felt a little lost, so in the end, I decided to make a simple to-do list of the summary of how to setup a new enviroment to a new project, check it out:

sudo apt install elementary-sdkIt will install all dependencies to compile your app.
Just need to do this step at the first time, don’t need it on your second project.

On the past month I was working in a project, that seemed to be easy on the beginning, to create a kind of service that should be the core to delivery coordinates and weather information of trucks, airplanes and ships from an specific company, and, the project has extended a little (as always), because the client also wanted to add some extra resources like user control, sell credits to use the service among other details. In fact, it wasn’t so easy as I expected but in the end, we did it.

Our team made some research before develop anything and concluded that an API should be the right service to complete this project.

An API is not just a JSON or XML content, it’s more than that, it can have many aspects and involve different types of access, depending of the needs, the most common types are the RESTFul service which is more like an architecture over HTTP using different methods to make the operations and the RPC (Remote Procedure Call) service which is usually done via POST method sending payload information to define the operations. It was important to us to know exactly what are the client needs and what we should start to use.

Knowing about these and some other dificulties of building a web service API, we did what any sane developer would do… search on internet for some basic and simple API to build over it our own solution. Well, we didn’t find something easy and simple, but we have found the Zend apigility which is a fantastic API-based architecture and is based on Zend Framework, so we just gave a chance for it.

The apigility tool offered a great tutorial, many sample codes and can be setup almost by the admin enviroment, also, a complete set of answer types, allowed methods, filters, validations and is also documentation ready, it’s really amazing.

But, “with great power comes great responsibilities”. The apigility is based on Zend framework, so it’s implicit necessary to have a good knowledge on the framework to make a good job, also, we don’t felt like this is the right solution for this project, it was more like “A cannon to hunt a little bird”, and more crucial, the Zend framework would push us to do extra documentation and can be a possible problem in future updates, for the client, as we don’t have too much professionals available with this knowledge. So, we give up of apigility for now.

After some long discussions, following the team instincts, feelings, making some sketches, we kept the idea of making by ourselfs a PHP web service API, which should exactly fit our needs without lack or overage of resources.

There is a lot of discussions around the API standards and if it should be adopted or not, among them are the swagger specification and the Open API Initiative which are supported by many stakeholders like Google, Microsoft, IBM, Paypal and other giants.

We didn’t followed all the standard specifications that we found, but we focused in almost all of them to finish our API.

Was it worth? Well, we were a team of 3 person, we planned, documented, developed, tested and done the service in about 5 days and the client is happy and the project is working, so, the team and the client thinks it was worth it, that’s what matters. 🙂

I like to code… Every time that I have some some free time in front of the computer or reading about some new language or device, comes that feeling “what nice thing I can code using this?”.

So, this time I picked my Pebble Smartwatch as a playground and decided to make something new and exciting, ansmartwatch app.

The Pebble Smartwatch was on of the pioneers on IoT and still is ahead of many devices of it’s category by providing the best recharge battery cycle, e-paper color display and common resources for everyday needs. Despite it’s discontinuity, after been bouth by Fitbit, the Pebble still is a very useful device with many interesting resources.

As the Pebble OS is not open source and can be disabled anytime by the Fitbit company, there is a very cool project called Rebble that is trying to reconstruct a similar OS for the Pebble device, based on FreeRTOS that is the same Pebble OS Base.

IoT devices usually have they’re code and apps based on C Language or some specific script language and its not different on Pebble Enviroment, it has an SDK and all that standard stuff… but there is also available a great service called CloudPebble which is a framework/compiler/interpreter to build Pebble Apps that accepts to code in javascript language, everything online, isn’t nice?

The CloudPebble is free to use, compile, emulate, generate app packages and it can also integrate with github. The better: You can code in Javascript! 😀

Well, continuing to my new and exciting thing, it’s not really easy to do something new these days, there is almost an app for everything that you can think, so I decided to make something that will be useful for me: a currency app that keeps me updated with the currencies that I want (with a nice skin). Not that there isn’t an app for that, but I didn’t like any of those, I like to have a more “cute” app with some flag icons and nice options.

The CloudPebble makes use of the PebbleKit JS which is a javascript SDK to access native properties of the native Pebble SDK. It was fine to find the documentation for almost all functions that I need, and, testing the app was also not so hard.

I also have to use the YQL Plataform (Yahoo Query Language) to get the information about the currencies. Fortunatelly the YQL is free, have a good documentation and also many good sample codes.

The Currency Exchange App code can be found at my github account and can be downloaded to start a new project on CloudPebble.