Programmer Utilities – Links 02


, ,

JSON to Java Object (POJO)

  • As the name says, it converts JSON to POJO, but also has the funcionality to pass the URL of a JSON.


JSON/XML to Java Object (POJO)

  • Ao contrário do link acima, esse link não converte só JSON, mas também XML. Não aceita uma URL para um JSON. Unlike the above link, this link does not convert JSON only, but also XML. Doesn’t accepts a URL to a JSON.


JSON to C# Object

  • As the name says, it converts JSON to C# object, but also has the funcionality to pass the URL of a JSON.



  • Gist is a code sharing tool. No need to create an account to share (both public and private), however, without an account is impossible to edit the file.

URL: Continue reading

What I’ve Been Reading – 01


, , ,

Hi guys, what’s up? I’ll share with you some things that I’ve been reading lately and I think relevant and worthy to take a look:


  • Liquibase is a database version control tool. Supports changesets, branching and merging and also has traceability. It supports the following file formats: XML, JSON, YAML and SQL. Here is an example taken from the official site:

--liquibase formatted sql

--changeset nvoxland:1
create table person (
id int not null primary key,
firstname varchar(80),
lastname varchar(80) not null,
state varchar(2)

--changeset nvoxland:2
alter table person add column username varchar(8)

--changeset nvoxland:3
create table state AS SELECT DISTINCT state AS id FROM person WHERE state IS NOT NULL;
alter table state modify id char(2) NOT NULL;
alter table state add primary key(id);
alter table person add constraint fk_person_state foreign key (state) references state(id);

  • State of the Study: I intend to use, first to test and use the features. If I like, I want to use whenever I can.
  • My Opinion About the Subject: Anything that makes easier database maintenance is valid. Before this, I only used Flyway, but I will test Liquibase.

My Reference Link (BR):

My Reference Link (EN):

Ionic vs React Native

  • Ionic and React Native are two frameworks that promise to develop hybrid mobile applications using JavaScript (Ionic using Angular base, and the React Native using React and its concepts). As I know little of both, I am evaluating pros and cons to know what I should study.

Continue reading

Tips – Performance 01


, , ,

On Tips Performance series, I’ll give tips of little or almost little things that can be done to improve application performance.

Optimize the FOR loop

Reason: Every time FOR ends an iteration, it validates the condition to know whether to continue. In this condition, it calls a method of the list, thus, the list size will be calculated for each iteration.

Explanation: By placing the value of the list size in a variable, access is much faster because it is not necessary to calculate in all iterations, because it uses the variable that already contains the reference in memory.


for (int i = 0; i <= list.size(); i++) { ... }


for (int i = 0, j = list.size(); i <= j; i++) { ... }

Programming on the Right Scopes

Reason: Many objects in broad scopes are unused most of the time. Much of the programming languages currently have a garbage collection, cleaning objects that are no longer being used / referenced. Continue reading

HTTP Protocol (Part 2)



On the previous post (HTTP Protocol (Part 1)) we talked a little bit about HTTP basic structure. On this post, we’re gonna talk a little bit more about HTTP structure and go deep on the knowledge.

Status Codes

These are some of the Status Codes most used / known:

  • 200 – OK
    • Default successful response. It may contains response body.
  • 204 – No Content
    • Successful response in which there will never be response body. Note: even if you return response body, once with this status code response, the response body will be ignored and will be as if it had not.
  • 304 – Not Modified
    • It is used when conditional GET or HEAD requests are received and would have resulted in 200 status response, if not for the fact that the condition was false. Typically used when the client wants to see a response only if it has been changed compared to a previous request.
    • The server that generates a 304 response MUST generate any of the headers that would result 200 for the same request: Cache-Control, Content-Location, Date, ETag, Vary and Expires.
  • 400 – Bad Request
    • It means that the request could not be understood by the server due to malformed syntax.
  • 401 – Unauthorized
    • It means that for the request to proceed is required user authentication.
  • 403 – Forbidden
    • It means that the request was understood but the user is not allowed to complete the request.
  • 404 – Not Found
    • Default status when a URI is not found.
  • 500 – Internal Server Error
    • Generic error code, used when an unexpected condition is found and no specific message is suitable.


  • The headers in HTTP are used to traffic all types of meta information about the requests.
  • Several of these headers are standardized; however, they are easily extensible to accommodate any special particulars which an application may require on this direction.

These are the most used / known Headers:

  • Host – It shows which DNS was used to reach this server
  • User-Agent – It provides information on the means used to access this address
  • Accept – It performs negotiation with the server about the accepted content
  • Accept-Language – It negotiates with the server which language to be used in response
  • Accept-Encoding – It negotiates with the server which encoding to be used in response
  • Connection – Set the type of connection to the server (persistent or not)
  • Content-Type – It defines the MIME Type of the content

Continue reading

HTTP Protocol (Part 1)



What is HTTP?

HTTP is a communication protocol that uses a Request-Response model, that involves a client and a server.


  • This protocol has the following requests format:
<method> <URL> HTTP/<version>

<Headers - Always multiple, one in each row>

<request body>

  • Example:
GET /store/clients HTTP/1.1
Host: localhost:8080
Accept: text/html


  • The response to the requests has the following general format:
HTTP/<version> <status code> <code description>


<response body>

  • Example:
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 245

   <client id="1">
   <client id="2">

Continue reading

Programmer Utilities – Books 01


, ,

Must-Read Books

Recommended Books

Which other book do you recommend? And which category?

SOLID – Advanced Object Orientation


, , , , ,

As we saw on the previous post (Programming Principles), SOLID is a pretty extensive subject and deserves its exclusive post.

SOLID is a principle that teaches the best use of object orientation and some techniques that we will see below. SOLID means:

  • S – Single-responsiblity principle
  • O – Open-closed principle
  • L – Liskov substitution principle
  • I – Interface segregation principle
  • D – Dependency Inversion Principle

Single Responsibility: an object must have only one responsibility.

  • It is common to see objects with various responsibilities, doing various things, classes with thousands of lines, DAO with business rules, validation hardcoded on the Controller, etc.
  • A class must have one and only one reason to change, which means that it should have only one job.

Example (Controller):


public String update(User user) throws Exception {
    * Controller Class should intermediate Model and redirect to 
    * the View, should not BE the Model and redirect 
    * to the View.
    if(isValidEmail(user.getEmail()) &amp;&amp; someBusinessRule(user)) {
    } else {
        throw new Exception("Something is wrong, dude.");

    return "myPage";

Continue reading

Programming Principles


, , ,


Single Responsibility: an object must have only one responsibility.
Open-Close: entities should be open for extension, but closed for modification.
Liskov substitution: client objects that are very specific should be replaced by instances of its subtypes.
Interface segregation: small and specific interfaces are better than a generic interface.
Dependency inversion: do not depend on specific implementations, but abstractions

It is a principle that is focused on better use of object orientation and some techniques such as Dependency Inversion (which also involves dependency injection, so do not get confused). It’s probably one of the most important principles for a well done and well structured code.

It is so important that I’ll not give an example about it here, then it will be in the next post, which I will detail the SOLID.


Don’t Repeat Yourself

It is a principle that is focused on the elimination of duplicates and that repeated logics must be eliminated via abstraction and repeated processes should be eliminated via automation.

Once duplications have directly impact on software maintenance, DRY is a highly recommended principle to always be used.

Example of possible applied DRY:


DRY01 Continue reading

Programmer Utilities – Eclipse Plugins 01


, ,

Notepad for Eclipse – Notepad

  • A notepad to avoid opening external programs and / or splitting screens. It’s even better if you configure shortcut.


Real-time collaborative programming – Saros

  • With Saros, it’s possible to code with your friends or your team in real time.


Explorer for Eclipse – StartExplorer

  • In my opinion, one of the coolest plugins. You can: Open the folder where the file is, copy the full path of the file, open a terminal (from your choice, including Git Bash) on the chosen path and also has the option to open the file with its default application.


Advanced Search for Eclipse – InstaSearch

  • InstaSearch brings a quick search for Eclipse and searches for references to files and similarities and have a good level of granularity. Very good also when configured with shortcut.


Performance Monitor for Eclipse – JVM Monitor

  • Monitor your JVM with various data such as CPU, Threads, Memory, etc.


Set of Utilities – Webclipse

  • Honestly, I cannot define Webclipse. In my opinion it is the best plugin of all. It has really powerful features such as JavaScript Debugger, REST Inspect, Project Explorer + (amazing, you can find a file typing on Project Explorer), Minimap, Slack integration, among other things.

URL: Continue reading

Java Virtual Machine




  • JVM is a complete machine that runs on top of the real. It has its own machine instructions (assembly) and its APIs. Their role is to execute the generic instructions of machine in the operating system and in the specific hardware on which you are running.
  • These virtual machine instructions are bytecodes. The bytecode name comes from the fact that each opcode (instruction) is the size of one byte and therefore the JVM is capable of running up to 256 different bytecode (although the Java 7 has only 205). This makes it a theoretically simple machine to implement and run on devices with limited capacity.


The JVM memory management is divided in:

  • Stack or Code Cache: Native memory. Variable portion of memory that is used by the Java process to manage the applications and features made in Java that are running the JVM. It is a space used for compilation. It’s here that is native, made specifically for the system.
  • Heap: It is the total area used to create and store all instances. You may have a fixed size or a minimum value (Xms) and maximum (Xmx).
    • The JVM allocates on operating system the amount of Xms memory for once, and this memory is never returned to the system.
    • As more memory is required, the JVM allocates in large blocks until the maximum of Xmx (if you need more than that, an OutOfMemoryError is thrown).
  • Permanent Generation or PermGen¹: is a memory space counted out of the heap (in addition to Xms/Xmx) where information is stored for loading classes and methods. This memory can have a maximum value, but not necessarily will use it all. To specify the size of PermGen, use another option, the -XX:MaxPermSize

¹ – Until Java 7 

  • MetaSpace²: It is the representation of the class metadata. Came to replace the PermGen because among other things, it uses native memory, being limited only by the total system memory. The MetaSpace is able to dynamically resize the maximum size depending on the application needs on runtime. However, you can specify the maximum size with the option -XX:MaxMetaspaceSize

² – Java 8+

Continue reading