Sunday, March 11, 2007

Expressiveness of a PL

Basically, the idea is "Expressiveness is the measure of expression. If I cannot express what I mean in a language, it is limiting expression "(from http://www.artima.com/forums/flat.jsp?forum=276&thread=198171 James Watson
).
expressiveness is not readability: James Watson Merriodoc Brandybuck

But people has different view:
There is also interrogative knowledge, exclamatory logic and imperative knowledge. You can measure expressive power of languages based on how much power they give the programmers to describe each of these knowledge types....their individual benefits don't leap out at the average person John Zabroski

I think expressiveness is the inverse of the impedance mismatch the language creates between the problem domain and the solution in code. Erik Engbrecht

expressiveness is readability:
Unreadable code is not expressive. Vincent O'Sullivan

as expressive as one another. Carson Gross

The game is complexity management. Frank Wilhoit

More resources
http://www.javac.info/
http://www.bejug.org/confluenceBeJUG/display/PARLEYS/Closures+for+Java
http://www.joelonsoftware.com/items/2006/08/01.html
http://ivan.truemesh.com/archives/000637.html
http://www.talios.com/dear_java_i_need_closure.htm
http://blog.moertel.com/articles/2005/08/30/closures-and-the-professional-programmer
http://www.gafter.com/~neal/jot-wildcards.pdf

Saturday, March 10, 2007

PWD

%~dp0 on windows is just like PWD env variable on linux

How rich is rich client

It's very rich that it can seamlessly emulate any desktop representation sub systems now.
Steps to create a simple representation client:

1.create client stub (note the options)









1.1 Create eclipse project stub




2. Import as eclipse project







3. Project layout










4. Auto generated sample code (with a button and a label)
[cite]
package com.spark.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

/**
* Entry point classes define onModuleLoad().
*/
public class veryRich implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {
final Button button = new Button("Click me");
final Label label = new Label();

button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (label.getText().equals(""))
label.setText("Hello World!");
else
label.setText("");
}
});

// Assume that the host HTML has elements defined whose
// IDs are "slot1", "slot2". In a real app, you probably would not want
// to hard-code IDs. Instead, you could, for example, search for all
// elements with a particular CSS class and replace them with widgets.
//
RootPanel.get("slot1").add(button);
RootPanel.get("slot2").add(label);
}
}
[cite]

5.compile it using java2javascript compiler provided by gwt:




6. Run in eclipse - click the file veryRich-shell.cmd
The following browser hooked into jvm will be started:
















Click the button, the label will be switched.





That's cool.

The only limitation on rich client is speed, security and imagination

Thursday, March 8, 2007

Invariable

Invariables ,variables. Two of the mostly basic concepts in algorithm analysis.
After 2 years work, I deeply believe, these two are also a basic feature of the entire IT world.
Take Java world as an example. Many new technologies emerges every year, and nearly all are from basic ideas. Grovvy(http://onestepback.org/articles/groovy/whatisgroovy.html):

Groovy is …

  • A Dynamic
    • Agile
      • Scripting
        • Programming Language
          • based on the JVM
is a dynamic language. The concept of dynamic language is old.
Grail a web frame work on top of Groovy, just as rail on ruby.(That's why called grail) So prepared and embrace the change.

Sunday, March 4, 2007

$big = substr("10000000000", 0, $power + 1);

What does this statement mean?
10 ** $power if the value is less than 10000000000.

What will $stuff = substr("a very long string",3,-3); return?
"ery long str"

Saturday, March 3, 2007

Web Service in new Java

Since JDK5, development of Web Service has been greatly simplified, largely due to annotation. So waht is indeed annotation?
IMO, annotation is just a kind of specifically formed comment, comment has it's own syntax. The really opinion beneath is how to process these comments, but not what they are. I bet there are already legacy projects developers utilize these idea to ease their life (In c word, perl word etc).

And why annotation so popular?
Two key points: 1. The user community. 2. Integration(Source code, tool, sdk support)

The syntax are cited below:
jls7.4.1.1


jls9.6


jls9.7


jls13.5.7

And also see the doc for tool apt