Category Archives: Uncategorized

Radar 2.0 is coming soon

The brand new version of the SonarQube plugin for Netbeans is almost here. Here is the list of the new features in this version.

SonarQube Runner

The main new feature is support for sonar-runner. So now is possible to run analysis locally and see the issues before committing/pushing your changes to the server.

When the sonar-runner is launched, an output tab is opened to see how the process is executing.

output-tab

 

At the end, the summary of issues is shown.

New layout

All the information is now shown in one panel with two tabs.

Summary

The summary is displayed in the first tab. The count of the issues is displayed by severity and by rule. From here, you can navigate to the list of issues.

summary

 

 

Also in this tab, you can see more information of a rule.

rule-dialog

Issues

The second tab is for the list of issues. This list has kept basically the same functionality with minor changes: the location of issue is shown in short format and, by default, a minimal number of columns is displayed. Of course, if you prefer, you can show some of the other columns.

column-menu

Additionally, now both tables have a popup menu to invoke common actions for a row.
popup-issue-list

Menu

The name of the items to invoke Radar have been renamed and grouped for better identification.

actions

Availability

All the features of this version are completed and the final release will be available after some minor fixes and some more testing.

Meanwhile, you can download the current build and give it a try. Bug reports are welcome in the page of the project: https://code.google.com/p/radar-netbeans/

Abstracción

Hablar de abstracción, no es solamente un principio que aplica dentro del Paradigma Orientado a Objetos. Cualquier sistema de software se basa en alguna forma de representación de la realidad. Se abstraen conceptos, se abstraen funciones, se abstraen algoritmos.

Hablando ahora sí de Orientación a Objetos, las abstracciones suelen ser diferentes de acuerdo al dominio del problema. Una clase Persona no tendrá el mismo detalle para una aplicación de medicina que para una aplicación web de correo. Al final estas diferencias hacen complicada la reutilización de clases.

Sería interesante un paradigma que permitiera modificar o alterar la abstracción de una clase en función del dominio en que se esté aplicando.

Modelo del dominio

Dentro del paradigma orientado a objetos, el modelo del dominio, expresado en un modelo conceptual, intenta capturar y expresar mediante conceptos (que pueden ser entendidos como clases) el contexto del problema, es decir, todo los objetos y sus relaciones que interactuan dentro de él.

Hello World with Carmesi

In this post, I’ll show an example of a very minimal web application using Carmesi. It’s just a variation of “Hello, world!” that receives a parameter to concatenate in a greeting message that is displayed in a different page.

First, there have to be a HTML page to capture the parameter. This page contains a form that allows the user to capture his or her name.

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form method="GET" action="greetings">
            <p>
                <label for="name">Please, introduce your name</label>
                <input type="text" name="name"/>
            </p>
            <button>Get greeting message</button>
        </form>
    </body>
</html>

The next step (and here is where Carmesi is used), a class to put the logic of the application (as this example is very very basic, the logic is captured in the controller but not to be done in an application with a more complex logic).

We have to specify a few things in the controller:

  • The url to invoke it. The form in the first step uses this url to send the parameter. This information is specified with URL annotation.
  • That the request parameter called name will be injected into a parameter of the method (RequestParameter annotation).
  • That the result will be stored in a request attribute to be displayed by the result page. This information is implicit in the declaration of the controller because the name of the method is prefixed with get (the name of the attribute is got by removing this prefix from the name of the method).  The annotation RequestAttribute could be added to the method to make it explicit.
  • The result page of this controller. This is specified using ForwardTo because we need to access to the request scope (in other cases RedirectTo could be used).
import carmesi.URL;
import carmesi.ForwardTo;
import carmesi.RequestParameter;

@URL("/greetings")
@ForwardTo("result.jsp")
public class GreetingsController {

    public String getGreetingMessage(@RequestParameter("name") String name){
        return "Hello, "+name+"!";
    }

}

And finally, the application needs a result page to display the message. The value is in the request attribute greetingMessage.

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>${greetingMessage}</h1>
    </body>
</html>

Here is an screenshot of the execution of this example: