I just jumped on Clojure five months ago, and I was a little lost
without types at first also. Then I've come to realize that types is
not as essential to bug-less software as I previously thought it was.
For the following reasons:

1) There's less "types" to begin with. I was a Java programmer, and
libraries are literally filled with classes with names like
"ActionListener, MouseClickHandler, Tester, DummyTester" etc...

I call these "behavior" classes. Classes that represent "behavior"
instead of "data". These classes were designed to take advantage of
the limited polymorphism that Java offers. In Clojure, there's no need
to represent this functionality in this fashion. Usually you just pass
functions around, and it's much more natural, and there's no need for
these "behavior" classes.

2) There's less repetitive code.
    In Java, whenever I changed something, the changes would have to
be propagated down almost the entire project. And I relied upon the
compile-time errors to keep track of the changes that I need to
update.
  In Clojure, I find there's a lot less repetitive code, so usually I
only need to change the code in one small part.
  This is highly dependent on your programming style though, so this
won't apply to everyone.

3) "Open" types make reusing code easier. So again there's less types
to deal with.
  In Java, classes are final. You cannot add methods or fields to
classes. Instead, you're supposed to use inheritance to accomplish
that. So in Java, you have a lot of extraneous classes such as
"String", "QString", "KString", "MyString", etc.. or "Window",
"AWTWindow", "SpringWindow", "JWindow", etc...

 Clojure prefers to use many functions that operate on a limited
number of types. So this situation doesn't arise very often.

4) Testing is much much easier. I was a relatively experienced Java
programmer. I very rarely got compile-time errors anymore. All of my
bugs were RuntimeErrors. Which you can only catch by testing. And yet
Java's type system makes testing so tedious and difficult. So giving
up a little compile-time safety for the ease of testing that Clojure
offers is a big big win in my books.

Hope that puts you at ease a bit, and I hope you enjoy learning
Clojure
-Patrick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to