Xzajo's Weblog

All | Java | nbxdoclet | NetBeans | Personal | Project Extensions | Sun | Testing
« Previous month (Apr 2006) | Main | Next month (Jun 2006) »
20060622 Thursday June 22, 2006

P2P programming

Few years ago has been introduced XP programming. A part of XP programming was pair programming. What is pair programming? Two developers are programming together on one computer. They are reviewing their ideas in one time. It rapidly increased quality of code.

Pair and XP programming is applicable to small teams. It is quite difficult to use XP methods on project where are for example hundreds developers. What is missing here? The developers didn't provide inter team communication about their codes. It is really difficult to share knowledge among all the developers.

Another way how to review the code is send commit logs to public mailing list. The commit logs are read only inside small team because it is not effective if the developers checks commit logs from many developers.

An inspiration how to solve this problem can be P2P data sharing. P2P data sharing was invented in order to reduce load of server. Big file is split to many small parts. Different parts are distributed to different users(nodes). If the node download his part he can redistribute the parts to different users. For each node in P2P network is computed ration uploaded/downloaded. When the ratio is very small the node got smaller priority for downloading files than node with bigger priority.

We can map P2P networking problem to code review problem. A node is developer. A developer commits code.Other developers reviews his code. It is the same like P2P network. The download is reviewing his code. The upload is reviewing of other's developer code. If the developers doesn't review code. No one is interested in review his code because the commit log is on the end of list with commits for code review.

The commits log are sent to different groups of developers. How to distinguish the developers? There are few metrics: -A developer uses a API. The API owner is in commit logs. The api usage is in commit log of the the user. The owner of API do the review. -He uses the API for long time I got many reviews. He is experienced API user. He can do review of code which uses the API or do the review to API developer Sent the same count of commit logs to different developers.

The reviewer must mark the reviewed code:

He can also add comments to review.

For the code review can be created a plugin to IDE.

The P2P programming can be used for code evaluation between different projects if they uses the same API or export API. For example first group develops WEB framework. The second group develops web application. The second group uses the framework of the first group. The first group do review of the code of the second group. After a while third group of developers started use the API of the first group. The code of third group will can review second group because they are experiences users of the framework.

Please let me know if already exists software project similar to P2P programming.

Posted by xzajo ( Jun 22 2006, 04:41:40 PM CEST ) Permalink Comments [5]

20060615 Thursday June 15, 2006

Netbeans met GWT and more GWT components

I wrote about my first experience with GWT in my last blog. Yesterday I experimented with GWT application in NetBeans. The new GWT plugin contains GWT project type. It is now easy build, run and debug GWT projects in NetBeans. The code completion with javadoc is also available. Tomas will publish his plugin early, I hope.

On http://gwt.components.googlepages.com/ are more GWT components. My favorite is Auto-Completion Textbox. It allows to add Code completion to Texbox on web page. The AutoCompleteTextBox component extends TextBox class. It adds to TextBox one new useful method:

public void setCompletionItems(CompletionItems items)
The CoompletionItems type is code completion provider:
public interface CompletionItems {
        /**
         * Returns an array of all completion items matching
         * @param match The user-entered text all compleition items have to match
         * @return      Array of strings
         */
        public String[] getCompletionItems(String match);
}
I wrote a simple application with AutoCompleteTextBox. The class with GWT EntryPoint is below. It shows code completion for names.
public class Main implements EntryPoint {
    
    class NameCompletionItem implements CompletionItems {
        public String[] getCompletionItems(String match) {
            ArrayList list = new ArrayList();
            
            String values[] =  new String[]{"roumen","radim","xzajo","geertjan","lukas"}; 
            
            String lowerMatch = match.toLowerCase();
            for (int i = 0 ; i < values.length ; i++) {
                String value = values[i];
                if (value.startsWith(lowerMatch)) {
                    list.add(value);
                }
            }
            String retVals [] = new String[list.size()];
            
            for (int i = 0 ; i < list.size() ; i++) {
               retVals[i] = (String) list.get(i); 
            }
            return retVals;
        }
        
        
    }
    public void onModuleLoad() {
        AutoCompletionTexBox textBox = new AutoCompletionTexBox();
        textBox.setCompletionItems(new NameCompletionItem());
        RootPanel.get().add(textBox);
    }
    
}

Conversion between ArrayList and array of Strings doesn't work on client side of GWT (Collection.toArray(Object[] array). The gwt compiler shows an error. Therefore I used the for loop. Screenshot with code completion in browser is below.


Posted by xzajo ( Jun 15 2006, 12:50:07 AM CEST ) Permalink Comments [12]

20060609 Friday June 09, 2006

GWT - revolution in web application development

Few my friends were talking about Google Web Toolkit GWT last week. There are too many MVC frameworks for web application development in java world - JSF, Struts, Spring, Tapestry, JSF, etc. It is not normal that one other tool can so quickly impressed java developers. I had to look at GWT too. GWT answers to question which I've heard many times:

Why not to develop the web application in the same way like desktop application?

By using GWT you can develop web application in the same way like swing application. The similar parts are below:
  1. Entry point for java application is Main class. It is EntryPointClass for GWT application.
  2. Swing and GWT represents all UI components a java class.
  3. Registration handlers are done by event listeners. For example listening on clicking of JButton.
  4. Components is registered to panel. A panel contains layout.
  5. You can show dialogs and change components on desktop for swing or in web browser for GWT.
  6. Swing app can be run on different platform. GWT application can be show in different web browsers.
Web browser doesn't contain support for java in html pages. GWT compiles java bytecode on client side of application to AJAX. There is development cycle for GWT application:
  1. Use your favorite Java IDE to write and debug an application in the Java language, using as many (or as few) GWT libraries as you find useful.
  2. Use GWT's Java-to-JavaScript compiler to distill your application into a set of JavaScript and HTML files that you can serve with any web server.
  3. Confirm that your application works in each browser that you want to support, which usually takes no additional work.

GWT solves communication between client and server side. It use proprietary Remote Procedure Calls. A service is represented by interface. Server side implements the interface and JavaScript is generated for client side. It leads developers to separate model, view and controller. GWT RPC is kind of SOA. Only with one difference. It doesn't use redundant (and slow ) SOAP protocol. Developer doesn't need to write jsp pages and servlets anymore.

There is no support for GWT application development in NetBeans. I hope GWT NetBeans project type be implemented early. And I may be someone will answer to another question:

Why not to generate GWT java code with NetBeans Matisse editor?

Posted by xzajo ( Jun 09 2006, 01:22:13 PM CEST ) Permalink Comments [175]

Calendar

RSS Feeds

Search

Links

Navigation

Referers