The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Java Grid

Today at work I heard quite a strange conversation between two coworkers of mine, a developer and a salesman (I'm in BI so I do not code much and I'm on MS side).

"What are you doing?"
"A grid."
"Why? Is the native grid not working?"
"In Java you can not simply drop in a grid. You have Swing. In a certain sense you can create components but is more difficoult. You can't simply drop in a grid or buy one."

Is this true? It sounds very very strange.

I did not dare to ask because it was not my business and, and the developer is probably the best I've seen in my career
Sevenoaks Send private email
Tuesday, January 17, 2006
 
 
Its absolutely true, and its a big reason why Swing isn't widely used.  There is no Swing equivalent to DataGrid in .NET.  You either have to buy a 3rd party widget or build it yourself on top of JTable, which is a very basic object.

Having said that, if this guy is an experienced Swing dev, I'm surprised he doesn't have his own DataGrid equivalent in his library already.
dave
Tuesday, January 17, 2006
 
 
Also, the guy is wrong about not being able to buy one.  There are tons of third party widget vendors for Swing.
dave
Tuesday, January 17, 2006
 
 
The Java people are proud of the MVC side of Swing, so they basically need to reinvent lots of wheel until they find the time to create or buy some components.

Basically, I think Swing is more difficult than it should be for the general people, and part of the problem is that basic problems like data binding are not standard in Swing. Thus, if you want good components you need to use JBuilder or find a third party provider -- the problem is, that Java does not have a standard way to access databases besides JDBC and a couple of other mechanisms, though JDBC has at least three versions (JDBC 1, JDBC 2, JDBC 3...) and none of them has been used for data binding in Swing.

When I studied Swing, I learned to differentiate the technology of MVC and MVP, the later being a lot more comfortable to work with (it's used in Smalltalk's Squeak). As I come from Delphi, I had the opportunity to see how data binding work, which is closer to how MVP works. It was not until I saw an implementation of MVC windows in Swing that I realized that if I wanted something easy I would have to create it myself.

After almost two years of Delphi + Job I finally have a good GUI framework that I have developed in Ruby, the main toolkit being GTK+. It supports data binding a la Delphi and has all the bells and whistles that I care to create; so, now, every line of code is a moment of pleasure when I'm creating new GUI code, in spite of some windows that demand rather complex logic. If there is one thing that I don't support is drag and drop, though for CRUD applications I won't miss it in the short term.

Swing? Nah...
Lost in the jungle
Tuesday, January 17, 2006
 
 
First, JDBC is not a data binding API. It's a data access API akin to ODBC. There are four types. Each "type" is defined by it's implementation; native, mixed, pure-java, etc.

Second, as someone who's worked with VB, MFC, GTK and Qt on the UI side for over 12 years, I can say without a doubt that Swing is by far the most flexible UI toolkit around. I have yet to come up against ANY UI problem that was not solvable in a day or so. While I agree that Swing does make the simple stuff slightly more complex, it makes the really, really hard stuff possible.
Duke
Tuesday, January 17, 2006
 
 
I see you missed Delphi...
Lost in the jungle
Tuesday, January 17, 2006
 
 
The model proposed by Dephi's data bound controls is not optimal or correct. It's okay for hacking out prototypes, but I avoid them in production code. The only instance when I use them is in readonly mode.
MBJ Send private email
Wednesday, January 18, 2006
 
 
There aren't many ways around it for those kinds of programs. The great effect that I achieved was in getting the crap out of the way, like:

http://img4.imageshack.us/my.php?image=200601180512282048x768scrot9lk.png

Those are some of the programs that I have written in Ruby. There is the fun (Chess), and there is the cool stuff (Ruby Editor and DB Admin).

Minimum window with persistence of preferences (window size and position) and database edition is like:

require 'cgr/cgr'

open_preferences(__FILE__)

start{|w|
  v = view(:KB, "/home/dewd/t_/kb", "select * from uma_tabela order by ID").open
  w.title = 'Hello World power by DB'
  w.pack dbbuttons(v)
  w.pack [dbgrid(v), true, true, true]
  w.pack [1, true, true], button('Bye Bye...'){ w.close }
}

I can access several different databases with that same code, all I need to do is to change the interface to MySQL, PostgreSQL, etc, and the connection string.

But the fun is really getting the repetition out of the way -- I've become a fun of the maxim "don't repeat yourself". BTW, today I created code to add column, drop column, rename column, change type, copy fields. Now I'm creating the GUI interface to it on one of the windows that appear on the screenshot.
Lost in the jungle
Wednesday, January 18, 2006
 
 
Stupid question:  I know this is AWT, and not Swing, but wouldn't something like this get you pretty close?

http://infragistics.com/Products/JSuite/AWT/GridsFeatures.aspx

I've never used Infragistics' Java controls, but their .Net controls are pretty decent.  Moreover, since these guys have been doing grids forever, I'd expect them to have a pretty good feel for what makes grid development efficient.
D. Lambert Send private email
Wednesday, January 18, 2006
 
 
I'm primarily and currently a Java type but when playing around with .NETs DataGrid I got intensely jealous.  .NET and data-based controls rock!  No JAXB generating 80-odd classes for 'simple' XML parsing; Put any data from any source into the same DataGrid; etc.., etc..

Sigh....
Paul Norrie Send private email
Wednesday, January 18, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz