I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Showing posts with label introduction. Show all posts
Showing posts with label introduction. Show all posts

Friday, 12 September 2008

Overview of Maven

Maven is a tool design to support as many task as possible for the management of a software project.

Its purpose is to provide a simple tool to achieve the following tasks:

  • Builds
  • Documentation
  • Reporting
  • Dependencies
  • SCMs
  • Releases
  • Distribution

A number of good tutorials can be found on maven's guide page.

Archetypes:

In maven there is the possibility to create archetype models of projects. This means that it is possible to create very easily new projects which have a number of templates to start with. This is related to the possibilities of RAILS.

This is performed by issueing the following command:

$ mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

Project Object Model: POM

There is a concept of project object model somewhat similar to the ant build files.

An example from the website (see this page):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Quick Start Archetype</name>
  <url>http://maven.apache.org</url>
  <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
      </dependency>
  </dependencies>
</project>

This model is quite easy to understand.

Project File and Directory Structure

The project file and directory structure depends on the archetype chosen to create a new project. There are means of configuring this, see: http://maven.apache.org/guides/mini/guide-creating-archetypes.html.

The build Life cycle

Each possible tasks (e.g. validate, compile, package) may require other to be performed first. This means that there are dependencies between the tasks (like in ant).

Common tasks
  • mvn compile (compile the code)
  • mvn test (test the functionalities of this project)
  • mvn test-compile (compile test classes for this project)
  • mvn package (package the code of this project)
  • mvn clean (clean the builds and task )
  • mvn site (create a template website for the project)
  • mvn idea:idea (create an IntelliJ IDEA descriptor for the project)
  • mvn eclipse:eclipse (create the project description files for eclipse)
Maven Plugins

There are a number of plugins which can be useful for maven. You can add them to the POM file of the project, see: How_do_I_use_plug-ins

A list of plugins can be found there.

SCM Plugin ( Source Code Management plugin)

One of the many pluging is the SCM plugin which offers useful tasks/goals for interacting with a SCM

External Dependencies

There is also the possibility to configure external dependencies.

Deployment

There are also possibilities of deployment if things are configured. For example, the created distribution can be copied and added to a repository using scp. For this, some information about user names, keys and/or passwords have to be configured.

Documentation

There are also some thing to help in the creation of a documentation site using archetypes. See: guide-site.

Thursday, 21 February 2008

Quality Management

The quality of a project is extremely important to consider a project a success. Much work has been done in the enterprise world to offer processes and solutions to ensure the quality of many aspects of projects. The information of this entry are mainly obtained from the article from the article on quality management of the Linux Magazine 12/07. IT Infrastructure Library (ITIL) ITIL is a mean of checking that the infrastructures of a company can ensure the quality of the processes used. It is currently a very important quality management method. The ITIL is a number of books describing aspects of IT processes. Important processes The following processes play an important role in the quality in the ITIL library. Service Support, Service Delivery, Planning to Implement Service Management, Application Management, ICT Infrastructure Management, Security Management. For this a number of norms have been developed:

ISO 9001

DIN ISO 9001 is an important norm for quality. It comes from production companies and remains somewhat generic. The purpose of this norm is to define how the quality should be taken care of.

Important for the ISO 9001 is that the quality is defined on the result of the processes and not on their implementation. For example, it requires that systems be documentated, but does not specify how this documentation should be implemented.

A number of quality management norms have been integrated in the ISO 9001, and many other system are getting closer to the norm.

This norm defines that the quality management responsabilities lie directly by the directing managers.

ISO 20 000

ISO 20 000 defines a norm and is very similar to the ITIL. A company can be certified for this norm through a serie of audits.

Six Sigma

Six Sigma is a very strict way of checking the quality of the processes of an enterprise. For this, there is a central instance as well as many other mechanism to check in all processes the quality of the whole system. ITIL Terminology ITIL uses its own terminology to discuss the quality management of a company.

Wednesday, 20 February 2008

Firefox extensions

I have been fooling around with firefox extensions and tried one of my own. There are a few easy things to remember: create a chrome directory with the following structure:
  • chrome ->
    • content ->
      • - extensionname.js
      • - extensionname.xul
      • - overlay.xul
    • locale->
      • en-US->
        • - extensionname.dtd
        • - extensionname.properties
        • - overlay.dtd
      • skins->
  • components->
  • defaults->
    • preferences->
  • - chrome.manifest
  • - install.rdf
Here is a little summary of the purpose of all these files: - the content directory contains the core of the extension, an overlay.xul file which defines some modifications to an existing xul file. The extensionname.xul file contains a xul file for the visualisation of the application, and the extensionname.js contains javascript code used for interaction purposes - the locale contains dtd and property files for the possible localisation of the extension. For each possibility, there is a directory with the name of the locale. The dtd are used for xul files, while the properties files are for javascript files. - the defaults directory is used for things related with the user profile, - while the components contains possible XPCOM components. Finally, install.rdf gives some information about the extension, while the manifest file chrome.manifest indicates on which xul file the overlay is applied and the place where the extension is to be found. To simplify the work, I use a templating method to generate extensions from some definition files. To package the extension once the install.rdf and the manifest file have been correctly edited, you only need to zip it with an ".xpi" as file extension.

Friday, 11 January 2008

Maven

Once I had been using ant, and then I heard about Maven. But what am I supposed to think about Maven. To use maven, we first need to create the basic skeleton of the content of the project. This is performed using in the parent directory of the future project directory: $ mvn archetype:create -DgroupId=org.jaycode.jdream -DartifactId=jdream We can now enter the project directory: $ cd jdream It creates diverse files and directories, in particular a pom.xml, which is a file describing the project and main application and test files. From there we can start coding. But a number of task can be performed (here an extract from the maven tutorial):
  • validate : validate the project is correct and all necessary information is available
  • compile : compile the source code of the project
  • test : test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package : take the compiled code and package it in its distributable format, such as a JAR.
  • integration-test : process and deploy the package if necessary into an environment where integration tests can be run
  • verify : run any checks to verify the package is valid and meets quality criteria
  • install : install the package into the local repository, for use as a dependency in other projects locally
  • deploy : done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
Another interesting feature is the possibility to adapt the pom file for eclipse:
$ mvn eclipse:eclipse
which creates the .classpath and .project files necessary for an eclipse project. One of the very interesting feature of maven is the possibility of creating template projects to simplify the creation of whole projects. It allows for example the possibility to go in the direction of rails some how.

Design Patterns

Since I have read the Gamma et al. book on design patterns, I tend to see most of the programming techniques as a set of design patterns which one combines with one another. There are many useful design patterns and the categorisation given in the Gamma book is at least useful to get an overview of these relevant design patterns:
  • creational patterns
  • structural patterns
  • behavioral patterns
The description of each of the design patterns follows a simple structure:
  • Intent (succint description of the intent of the design pattern)
  • Other Names (other names which have been given to this pattern)
  • Motivation (gives a description of the type of problem for which this pattern can be used)
  • Applicability (gives a summary of the main guidelines when to use the pattern)
  • Structure (gives a UML description of the overall structure of the pattern)
  • Participants ( a description of the main elements or classes used in the structure)
  • Collaboration (describes how the elements are used in cooperation with the others)
  • Consequences (the main consequences of the use of the pattern)
  • Implementation (a description of how to implement the pattern in a sensible way)
  • Sample Code ( some sample code of the use and of the implementation)
  • Known Uses (some example where this pattern has been used effectively)
  • Related Patterns ( explains the relation this pattern has to other patterns)

Thursday, 10 January 2008

Java NIO - Intro

Here is an entry on the topic of Java NIO in order to keep in mind the main aspects of these API. First of all, Java NIO stands for Java New I/O. There are a number of useful classes in this new API:
  • buffers (they represent fixed size arrays of primitive data elements wrapped with supplementary state information)
  • Channels (a model for a communiation connection)
  • File locking and memory mapped files (provides classes for monitoring locking of files as well as the possibility of mapping files to memory thus improving the process)
  • sockets (these classes provies new methods of interacting with network sockets)
  • selectors (this allows the possibility to watch the status of different channels to monitor them more easily
  • regular expressions (Perl like regular expressions for processing of Java)
  • character sets (the mappings between characters and byte streams)

Monday, 7 January 2008

AJAX

Thsi is a beginning of a long serie on the technologies which make AJAX. The basic principle of AJAX is making Web pages more responsive by allowing more complex interaction with the servers without requiring the reloading of a page. The name AJAX means asynchronous Javascript with XML. Two main important applications:
  1. load pages more quickly through an asynchron loading of the page(i.e the whole page is not loaded immediately).
  2. depending on the actions of the user, appropriate data can be loaded without requiring the reloading of the page
Most applications require for this task the use of XMLHttpRequest Objects.

Thursday, 13 December 2007

First Start to Hibernate

In the series of new technologies which I should get my hands on and about which I wish to get an overview Hibernate is an important candidate.

First of all Hibernate is an Object/Relation Mapping framework, this means that it is used to create maps between object oriented structures and relational databases. The main goal is to keep the object in a running system as persistent as possible with the data present in the database in order to ensure consistency in the data. Another important point is also the efficiency of querying and the optimized use of resources.

In Hibernate this is managed through the use of a mapping defined using XML configuration files. The mappings are stored in a file looking like that:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
[...]
</hibernate-mapping>

A mapping as the following shape:

<class name="myaddressbook.model.Person" table="PERSONS">
....
</class>
where the name is the java name of the class, whereas PERSONS is th name of the relational table of this class.

the fields of a class Person of the sort:

package myaddressbook.model.Person;

class Person {

Long id;
String name;
Date birthday;

// plus the corresponding getters/setters
}
would look like:

<id name="id" column="PERSON_ID">
           <generator class="native"/>
       </id>
       <property name="birthday" type="timestamp" column="BIRTHDAY"/>
       <property name="name"/>


finally the complete file should be under: person.hbm.xml at the place where the file is found.

For the configuration of Hibernate, it is important to set the information about the database. For this, there are different possibilities:

  • a properties file
  • an XML configuration files
  • or using Java to set the information

Tuesday, 11 December 2007

Scala Programming Language

Yet another programming language I want to take a look at: Scala.

It seems to be fully compatible with Java too as well as having many features similar to Groovy (see my post on groovy).

One of the thing though that seems really interesting is the concurrent programming features as shown at this place. I still need to try that though. I also want to know in which way it differs from Message Passing Interfaces (actually I think it is kind of like MPI).

It does not seem to be as developped as Groovy. So I think I'll stick with learning Groovy.

A personal note on Ruby and Ruby on Rails

I bought the Ruby on Rails Hors Serie 33 from Linux Magazine.

Not bad! I learned a lot from the different tutorial. I spent a few evening trying a few things out.

I found there were a few interesting things in Rails. I am not really in love with ruby though. This might only be because I felt a little annoyed of a few idiosyncracies of the language, I might get used to them though (in particular this global, not global variable thing).

There was nothing really problematic when you know enough of python, perl, java and the like.

What I really like though was: Rails. I tried it and you really get a few simple things done in very little time. That's really cool. I tried the address book example from the Hors Serie and I also implemented a little blog management system just for the heck of it.

I liked the ActiveRecord, and Action Pack and also the scaffolding stuff as well as the possibility to test it quickly with a small server.

Learning Groovy or Groovy Learning

Well I decided to learn Groovy.

It seems to have the most interesting properties, something like python or perl for java, except without the things I dislike from perl and python (about the former, it's not readible, about the latter I dislike the formatting constraint).

I haven't tested the compilation issue or the speed but this should not be a big problem. We'll see.

I made myself a summary from the groovy syntax and features from the tutorial.

I really like: (see: the differences from Java )

  • closures
  • the simple list and map syntax... What a pain it is in Java.
  • groovy markup as a nice way to work with XML, HTML, ANT...
  • easy use of regular expressions !!!!!! YEAH!
  • less problems with quotation marks and multi line strings
  • Gstring ( something to use variables for strings )
  • lots of supplementary useful methods (see the groovy jdk )
  • easy iteration ( though 1.5 did make things a lot easier)
  • easy setter/getter mechanism for beans
  • using closure for listeners

I'll have to try GRAILS, because I tried Rails And I found it not bad really.

It would also be interesting to see whether Groovy can be combined with JSF which I really liked.

But I think I am just starting feeling groovy.