About Bugs

There is a nice article from java-sys that talks about the facts about bugs. So I summaries the main point as below

  • The US economy loses over $60 billion annually – the size of Puerto Rico’s GDP – fixing software bugs
  • To fix a bug during QA costs more than 7 times the amount to fix during developer coding (according to IEEE Computer, January 2001)
  • Waterfall software development model was introduced in the 1970 as a way to minimize bugs, but the author himself noted it as being a flawed, non-working model
  • The way we’ve been preventing bugs is wrong and costly, and developers needed a way to define better methods and practices to make their software work. Thankfully, Agile development practices were developed starting in 2001 with the Agile Manifesto – also introducing the idea of Unit Testing
  • Agile projects are statistically 300% more successful than non-Agile projects.
  • Unit Testing, and other forms of developer testing, is much more cost-effective than QA teams and allow for faster time to market.

Graph Database (Neo4j)

In the late of 2011, I’m looking for a new database solution that do not rely on RDBMS and ORM for the object oriented data store. I was firstly introduced an NoSQL database called mongoDB that is quite impressive for object oriented data store. The learning curve for the database is very fast due to its simplicity. But looking at this and to the variation of the data that I’m going to store that has relationship then the MongoDB will not satisfy me with a simple and efficient way. I looked to another NoSQL database that based on the Graph, WOW… My first impression was good and not as simple as MongoDB from the document based database.

Finally I found Neo4j that is well known publicly to support the graph database. For some reasons I fell in love with this type of database. After trying a couple home project with the pure Neo4j API, I feel so classic working with API provided, I remember that I worked on project that use POSIX framwork.

Finding the solution for the Neo4j wrapper took me all around in the google and finally I found that Spring Data is the only one framework that is now being developed for serious project. So in order to really implement Neo4j for serious enterprise application you should master Spring data. I took sometimes to learn Spring in combination with Vaadin,

Finally, I can master these three frameworks to support my software development. It is feel good that you can use the high end technology and really implement it in my projects.

Hibernate Named Query

I would like to share some basic of hibernate named query. It is very cool feature of java persistence or hibernate to query into the database with only creating the query once. Hare is my main class
package app.namedQuery;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.NamedQuery;
import javax.persistence.Persistence;
import javax.persistence.Query;

public class App {
	EntityManagerFactory emf;
	EntityManager em;

	public static void main(String[] args) {
		App temp = new App();
		temp.initEM();
		temp.doNamed();
	}

	public void initEM() {
		emf = Persistence.createEntityManagerFactory("ts");
		em = emf.createEntityManager();
	}

	public void doNamed(){
		Query mydo = em.createNamedQuery("MEMBER_ALL");
		List<Member> list =  mydo.getResultList();

		for(Member temp : list){
			System.out.println(temp.getEmail());
		}
	}
}

You can see below my member entity class, I use annotation rather than the mapping with the XML because it is not straight forward. Dont forget to add the below code into your entity class to enable the em.createNamedQuery to resolve the query

<code>@NamedQuery</code><code>(name=</code><code>"MEMBER_ALL"</code><code>, query=MyNamedQuery.SELECT_ALL_MEMBER)</code>
package app.namedQuery;

// Generated Sep 6, 2011 6:09:39 PM by Hibernate Tools 3.4.0.CR1

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.NamedQuery;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Member generated by hbm2java
 */
@NamedQuery(name="MEMBER_ALL", query=MyNamedQuery.SELECT_ALL_MEMBER)
@Entity
@Table(name = "member", catalog = "test", uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class Member implements java.io.Serializable {

	private Long id;
	private String email;
	private String name;
	private String phoneNumber;

	public Member() {
	}

	public Member(String email, String name, String phoneNumber) {
		this.email = email;
		this.name = name;
		this.phoneNumber = phoneNumber;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "email", unique = true, nullable = false)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "name", nullable = false, length = 25)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phone_number", nullable = false, length = 12)
	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
}

I wrapped the query string into a class so that it is cleaner in your code, i put it inside a class and put the query string as static member so that can be accessed without getter.

package app.namedQuery;

public class MyNamedQuery {
	public static final String SELECT_ALL_MEMBER = "from Member";
}

I would like to give you the bonus of my persistence.xml conifugration for standalone application, please see below

<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
	version="1.0">

	<persistence-unit name="ts"
		transaction-type="RESOURCE_LOCAL">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<class>app.namedQuery.Member</class>
		<properties>
			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
			<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
			<property name="hibernate.connection.username" value="teddybear" />
			<property name="hibernate.connection.password" value="******" />
			<property name="hibernate.connection.url" value="jdbc:mysql://localhost/test" />
			<property name="hibernate.hbm2ddl.auto" value="update"/>
			<property name="hibernate.connection.autocommit" value="true"/>
			<property name="show_sql" value="true" />
		</properties>
	</persistence-unit>
</persistence>

Seam Now

Finaly the seam 3 is published, After waiting for long time stay in the Seam 2.0 and now I can move forward with the new feature given in the seam 3. Now it  really uses maven as the build management tools which is better then seam-gen.\

I’m curious with the some new things added to the seam 3 which I would say these things could become the next standard for java as seam 2.0 feature that mostly taken as the standard of the new java bean and functionality.

Good job redhat with the jboss team to produce a good quality product. (Seam 3.0)

New Amo

After few weeks of waiting since the death of my Acer 4520 machine and now having the new branded machine Dell XPS l140x with 2 Gb extra memory. I have been using this machine for some days and everything looks fine from the out part body into the real inside spec. 100 % satisfied.

I have tested my java testing and look promising, I used all the latest version of my development set and everything just gone fast and smoothly.

 

Finally just want to thank to Allah that He give me this new brand laptop.

Feasibilty Study

I would like to share a bit knowledge of feasibilty study on software development. The study is about on what aspects should be considered on deciding either to develop or purchase the system.

1. Economical feasibilty, this will consider regarding the available budget to tackle the poroblem.

2. Technical feasibilty, this is about the technical skill is currently had, are we having the required skill to develop the system? Is the design practically work properly?

3. Schedule feasibilty, Can the solution developed and accepted in time.

4. Risk feasibilty, what is the succesful approach and implementation could be taken..

5. Operational feasibilty, it is about how the solution could affect the user daily life, feeling, work environment, requirement and the degree of satifaction of the user.

CMM, Capability Maturity Model

My laptop is now officially broken thus makes me so nervous to do anything without it. I opened my box full of my computer science books. I picked one of them and start refresh my mind.

CMM, capability mature model is a tool created by a wellknown university at united states. CMM is used to give overvire of the maturity state of an organizational on developing a software. The are 5 states that organization can be measured into.

1. Initial, this state describe that the organization has nothing to follow such as standard, regulatio and proper documentation. Project run without a clear direction. The succesful of project realy depends on the who is running the project.

2. Repeatable, this states the organization has more concern to the project management but the development it self is still unmanaged. The succesful of the project is just the same like item no. 1

3.Define, this state describes that the organization has adopted a methodology to handle the process of project. Documentation is already been setup properly and risk is more manageable and prefictable

4.Managed, this state describe the organization has been able to be effective and regularly repeat the pattern to be success, Objective and quality of goal has been detailed measured and recorded into the system.

5. Optimized, this state the oragnization has been able to continuesly refine their procedure and project delivery to have better quality. Knowledge are shared among the person to sustain and improve the succesful way to handle projects.

Hopefully the short resume above could give you all the big picture where your current organization maturity state level. …