Java for Rubyists

I'm not anything like a Java expert, but I do refer to Bruce Eckel's
_Thinking in Java_ most of the time when I need to look up a language
feature (as opposed to just understanding some API via its Javadoc).
It's freely downloadable via his Web site(s); I always remember
http://BruceEckel.com/ most easily.

Al

···

-----Original Message-----
From: Miles Keaton [mailto:mileskeaton@gmail.com]
Sent: Monday, March 28, 2005 6:09 PM
To: ruby-talk ML; shalev@simplyphysics.com
Subject: Re: Java for Rubyists

I have been forced by the powers-that-be to learn Java.
Is there some book out there somewhere that will teach Java without
making me go mad from comparing it to Ruby?

Shalev -

I recently bought a "Head First" book on Design Patterns. The "Head
First" series is SO good - SUCH a great way to learn something,
especially when you've already got a resentful attitude, and you're
going to need some help making it fun.

Try to go down to a bookstore to see this book in person:
http://www.oreilly.com/catalog/hfjava2/
... or at very least download the two sample chapters in PDF, there.

I can highly recommend it, and if you look over at Amazon, you'll see
that almost everyone else does, too.

I second Eckel

I fell the original posters pain. My work world is filled with long
forgotten .net apps and J2ee apps that I have to patch at a moments
notice.

Having scripting languages has helped me nonetheless with the
exploration of ideas in a timely manner, working out algorithms and
protocols etc...

···

On Tue, 29 Mar 2005 11:20:21 +0900, Albert Chou <achou@tealeaf.com> wrote:

I'm not anything like a Java expert, but I do refer to Bruce Eckel's
_Thinking in Java_ most of the time when I need to look up a language
feature (as opposed to just understanding some API via its Javadoc).
It's freely downloadable via his Web site(s); I always remember
http://BruceEckel.com/ most easily.

Al

-----Original Message-----
From: Miles Keaton [mailto:mileskeaton@gmail.com]
Sent: Monday, March 28, 2005 6:09 PM
To: ruby-talk ML; shalev@simplyphysics.com
Subject: Re: Java for Rubyists

> I have been forced by the powers-that-be to learn Java.
> Is there some book out there somewhere that will teach Java without
> making me go mad from comparing it to Ruby?

Shalev -

I recently bought a "Head First" book on Design Patterns. The "Head
First" series is SO good - SUCH a great way to learn something,
especially when you've already got a resentful attitude, and you're
going to need some help making it fun.

Try to go down to a bookstore to see this book in person:
http://www.oreilly.com/catalog/hfjava2/
... or at very least download the two sample chapters in PDF, there.

I can highly recommend it, and if you look over at Amazon, you'll see
that almost everyone else does, too.

--
Thomas G. Willis
http://paperbackmusic.net

I fell the original posters pain. My work world is filled with long
forgotten .net apps and J2ee apps that I have to patch at a moments
notice.

I'll never get this attitude, why is programming in a more powerful
language almost more enjoyable than in a less powerful language?

Do C kernel hackers grumble they are not writing in zsh or Scheme?

Personally I find many languages enjoyable to program in, even low
level languages where you are producing alot more LOC than you
otherwise might using a HLL.

···

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

I cannot claim to speak for the writer, but I will say that some
languages are just more fun than others -- and this is not entirely
limited to "higher level" verses "lower level" languages. For me it
often maps to using a language well suited to the task. Although there
is little call for it today, I still remember the pure pleasure of
writing well tuned assembly code. I experienced pleasure writing well
tuned server code in C and C++.

Of course that all having been said, for whet is Java well suited? It
always feels like a dynamic language fighting its static typing to me.
It has some wonderful dynamic features that I always miss when using
C++ (dynamic class loading, reflection, etc), but the static type
checking seems to bog them down in syntax. In addition the majority of
Java frameworks seem to lean very heavy on configuration files (not
that externalizing options are a bad thing) to compensate for the lack
of meta data -- hopefully Java 1.5's meta data system will help in
this.

My $0.02, worth exactly what you paid for it
Patrick

···

On Tue, 29 Mar 2005 23:55:08 +0900, Lyndon Samson <lyndon.samson@gmail.com> wrote:

I'll never get this attitude, why is programming in a more powerful
language almost more enjoyable than in a less powerful language?

Lyndon Samson wrote:

I fell the original posters pain. My work world is filled with long
forgotten .net apps and J2ee apps that I have to patch at a moments
notice.
   
I'll never get this attitude, why is programming in a more powerful
language almost more enjoyable than in a less powerful language?

Do C kernel hackers grumble they are not writing in zsh or Scheme?

Personally I find many languages enjoyable to program in, even low
level languages where you are producing alot more LOC than you
otherwise might using a HLL.

I think you are confusing several things here: more powerful language / less powerful language != low level language / high level language. A language can be low level and powerful just as a language can be high level and less powerful.

Imaging trying to attach a post it note to a fridge, there are two approaches:

Approach 1 (powerful languages):
1) attach post it note to fridge

Approach 2 (less powerful languages):
1) Write an XML file stating the precise location that the note will be locate
2) Obtain, in writing, permission to attach the note to the fridge
3) Find a subcontractor to attach the note to the fridge
4) Write an XML file stating the tasks that need to be undertaken by the contractor
5) The contractor does the work

Now if I were building a skyscraper then approach 2 is entirely appropriate but for a post it note approach 1 is the way to go. Trouble is that some languages treat every project like a skyscraper and the programmer like a complete idiot.

Lyndon Samson <lyndon.samson@gmail.com> writes:

I fell the original posters pain. My work world is filled with long
forgotten .net apps and J2ee apps that I have to patch at a moments
notice.

I'll never get this attitude, why is programming in a more powerful
language almost more enjoyable than in a less powerful language?

Do C kernel hackers grumble they are not writing in zsh or Scheme?

It's a matter of level. When you write a low-level app (kernel), C is
perfectly fine. When you write a (very) high-level app (script, even)
in C and you don't gruble, something's wrong with you, I guess. :slight_smile:

J2EE apps can be abstracted rather well (I think), but Java doesn't
allow going high-level enough to make coding bearable. You notice
that as soon as code generation, XDoclet etc. gets used.

Personally I find many languages enjoyable to program in, even low
level languages where you are producing alot more LOC than you
otherwise might using a HLL.

The right tool for every job.

···

Into RFID? www.rfidnewsupdate.com Simple, fast, news.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

You read too much into my comments you person you... :wink:

I was strictly speaking from my personal experience, nothing against
the technologies mentioned. I have my preferences.

The truth is for me productivity = happiness, increased productivity =
increased happiness. I want to be happy.

I do not feel producitive in my dealings with J2ee, or .net because of
the very specific, poorly implemented projects(that I didn't write),
that I am responsible for maintaining(not fixing).

In other words, due to my personal experience, not because of any
perceived bias towards lower or higher level languages. I try to use a
screw driver when a screw driver is needed, and steel wool when steel
wool is needed.

Being human I tend to prefer things, and I like steel wool but I still
pick up the screw driver when I need to.

···

On Tue, 29 Mar 2005 23:55:08 +0900, Lyndon Samson <lyndon.samson@gmail.com> wrote:

> I fell the original posters pain. My work world is filled with long
> forgotten .net apps and J2ee apps that I have to patch at a moments
> notice.

I'll never get this attitude, why is programming in a more powerful
language almost more enjoyable than in a less powerful language?

Do C kernel hackers grumble they are not writing in zsh or Scheme?

Personally I find many languages enjoyable to program in, even low
level languages where you are producing alot more LOC than you
otherwise might using a HLL.

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

--
Thomas G. Willis
http://paperbackmusic.net

Not to enter a J2EE sucks (not) flamewar, but one shouldn't confuse
misconceptions in J2EE with Java's own abstraction level.
As a Java/J2EE developper, I do think they are two completely
different things. Java is quite a good programming language. Simple,
elegant, and powerful. But J2EE is all crap ! Nobody should ever have
to write a single line of those fugly XML files. And, for that,
annotations can be the best thing in Java5.
But I'm here really off-topic.

···

On Wed, 30 Mar 2005 00:13:17 +0900, Christian Neukirchen <chneukirchen@gmail.com> wrote:

J2EE apps can be abstracted rather well (I think), but Java doesn't
allow going high-level enough to make coding bearable. You notice
that as soon as code generation, XDoclet etc. gets used.

--
Nicolas Delsaux
"Un langage de programmation est censé être une façon conventionnelle
de donner des ordres à un ordinateur. Il n'est pas censé être obscur,
bizarre et plein de pièges subtils (ça ce sont les attributs de la
magie)."
Dave Small

Lyndon Samson <lyndon.samson@gmail.com> writes:

>> I fell the original posters pain. My work world is filled with long
>> forgotten .net apps and J2ee apps that I have to patch at a moments
>> notice.
>
> I'll never get this attitude, why is programming in a more powerful
> language almost more enjoyable than in a less powerful language?
>
> Do C kernel hackers grumble they are not writing in zsh or Scheme?

It's a matter of level. When you write a low-level app (kernel), C is
perfectly fine. When you write a (very) high-level app (script, even)
in C and you don't gruble, something's wrong with you, I guess. :slight_smile:

Hmm I can draw a further distinction, between coding for enjoyment,
and coding for more pragmatic reasons ( for payment, volunteer work
etc ).

I can code high level apps ( like roguelike games for example ) in C
for fun, because the delivery timeframe is to infinity and beyound :slight_smile:
I dont even need to use the stdlib or other fine examples of code
reuse although I probably should.

···

On Wed, 30 Mar 2005 00:13:17 +0900, Christian Neukirchen <chneukirchen@gmail.com> wrote:

J2EE apps can be abstracted rather well (I think), but Java doesn't
allow going high-level enough to make coding bearable. You notice
that as soon as code generation, XDoclet etc. gets used.

> Personally I find many languages enjoyable to program in, even low
> level languages where you are producing alot more LOC than you
> otherwise might using a HLL.

The right tool for every job.

> Into RFID? www.rfidnewsupdate.com Simple, fast, news.
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

I need to access a MySQL database from Ruby.
I'm running under Windows using the one-click installer.
Is DBI the preferred way to do that?

If so, what do I need to install that doesn't come bundled in the one-click
installer? DBI? Ruby MySQL driver?

Are there gems for those or do I need to install them the old fashioned way?

···

--
R. Mark Volkmann
Partner, Object Computing, Inc.

Patrick Hurley wrote:

Of course that all having been said, for whet is Java well suited?

Programming toasters.

···

--
Florian Frank

Nicolas Delsaux <nicolas.delsaux@gmail.com> writes:

J2EE apps can be abstracted rather well (I think), but Java doesn't
allow going high-level enough to make coding bearable. You notice
that as soon as code generation, XDoclet etc. gets used.

Not to enter a J2EE sucks (not) flamewar, but one shouldn't confuse
misconceptions in J2EE with Java's own abstraction level.
As a Java/J2EE developper, I do think they are two completely
different things. Java is quite a good programming language. Simple,
elegant, and powerful. But J2EE is all crap ! Nobody should ever have
to write a single line of those fugly XML files. And, for that,
annotations can be the best thing in Java5.
But I'm here really off-topic.

I have no idea about J2EE, really; but I dislike Java enough on it's
own. If Java was as meta-programmable as Ruby, J2EE wouldn't need XML
for configuration.

···

On Wed, 30 Mar 2005 00:13:17 +0900, Christian Neukirchen > <chneukirchen@gmail.com> wrote:

Nicolas Delsaux

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Actually, the language was designed for programming coffee percolators.

-Shalev

···

On Mar 30, 2005, at 3:53 PM, Florian Frank wrote:

Patrick Hurley wrote:

Of course that all having been said, for whet is Java well suited?

Programming toasters.

--
Florian Frank

Florian Frank wrote:

Patrick Hurley wrote:

Of course that all having been said, for whet is Java well suited?

Programming toasters.

Nay, toasting programmers. Cheers!

Nicolas Delsaux <nicolas.delsaux@gmail.com> writes:

>>
>> J2EE apps can be abstracted rather well (I think), but Java doesn't
>> allow going high-level enough to make coding bearable. You notice
>> that as soon as code generation, XDoclet etc. gets used.
>
> Not to enter a J2EE sucks (not) flamewar, but one shouldn't confuse
> misconceptions in J2EE with Java's own abstraction level.
> As a Java/J2EE developper, I do think they are two completely
> different things. Java is quite a good programming language. Simple,
> elegant, and powerful. But J2EE is all crap ! Nobody should ever have
> to write a single line of those fugly XML files. And, for that,
> annotations can be the best thing in Java5.
> But I'm here really off-topic.

I have no idea about J2EE, really; but I dislike Java enough on it's
own. If Java was as meta-programmable as Ruby, J2EE wouldn't need XML
for configuration.

Something else I find interesting. The hatred towards non programmatic
configuration files.

Programmatic configuration is great for programmers, but where would
the average application user be without simple, hard to mess up
configuration, like sendmail.cf for example :slight_smile:

Or perhaps the bile is directed only at the overly verbose XML?

···

On Wed, 30 Mar 2005 01:45:57 +0900, Christian Neukirchen <chneukirchen@gmail.com> wrote:

> On Wed, 30 Mar 2005 00:13:17 +0900, Christian Neukirchen > > <chneukirchen@gmail.com> wrote:

> Nicolas Delsaux
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

Lyndon Samson wrote:
...

Something else I find interesting. The hatred towards non programmatic
configuration files.

Programmatic configuration is great for programmers, but where would
the average application user be without simple, hard to mess up
configuration, like sendmail.cf for example :slight_smile:

Or perhaps the bile is directed only at the overly verbose XML?

Certainly seems so, at least for some.

Angle-brackets and explicit begin-end markup are bad, significant-indentation is good. Unless the significant-indentation is part of a programming language, then it's bad, and explicit begin-end markup is good.

Whether XML is "overly verbose" may depend on how you interact with it. For people who criticize it for leading to carpal tunnel syndrome, I would invoke the "Eclipse defense" [0]: Use an editor, such as vim with an XML plug-in, that does auto end-tag completion or otherwise assists in editing and rendering XML.

Whether one is doing XML push-ups or YAML squat thrusts may not be the real issue, but instead whether the people responsible for configuration have a means to describe their intent with a minimum of fuss. For some, that may mean using the same language the program is written in; for others, verbose (but easily validated) markup is the better choice.

James

[0] So-named in honor of those who justify assorted Java grievances by insisting that these issues go away if you assume a sufficiently powerful IDE.

Something else I find interesting. The hatred towards non programmatic
configuration files.

I think I may be a good evangelist for that :wink:

Programmatic configuration is great for programmers, but where would
the average application user be without simple, hard to mess up
configuration, like sendmail.cf for example :slight_smile:

Or a kind of YAML file ?

Or perhaps the bile is directed only at the overly verbose XML?

Not only. I have the strong belief that most of a J2EE app config is
in fact code. As an example, take any Struts application. Could the
action objects work without the struts-config file (which defines, for
the know-not, the mapping between an URL, a Java Action, and the
various depending JSP) ? Certainly not. And so, that ugly and huge
file is in fact code, hidden in configuration. It's bad.
The same can be said about most O/R mapping tools. Each time some code
is strongly tied to a configuration file, it's the obvious sign that
this is not configuration, but code.

The argument of the lack for meta-programming in Java was before told.
It was a weakness of Java. But, with Java5, came (as I already
mentionned) annotations, which are (to my mind) the biggest
modification incorporated since Java 1. Those annotations provide a
way to extend java semantic according to *your* needs. I firmly
believe that, soon, Struts, Hibernate, and the such, will move all the
XML data in annotations, like XDoclet used to do, in fact.

···

On Wed, 30 Mar 2005 02:56:29 +0900, Lyndon Samson <lyndon.samson@gmail.com> wrote:

--
Nicolas Delsaux
"Un langage de programmation est censé être une façon conventionnelle
de donner des ordres à un ordinateur. Il n'est pas censé être obscur,
bizarre et plein de pièges subtils (ça ce sont les attributs de la
magie)."
Dave Small

So... it looks like people have a lot of experience on the subject and, not to break up a good streak or anything,
could you perhaps share some of that experience in the form of a good book choice?

-Thanks
Shalev