Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java and DSL

 
Stephane Clinckart
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Java well designed to support DSL ???
C# looks better designed for that.
Will the next version of Java reduce the gap?

Thanks a lot,

Stephane Clinckart
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean whether it's easy to create DSLs within your code base using the language syntax itself - i.e. to define an API - I suppose it's not that different between Java and C#. Did you have a particular language feature in mind that would give C# an advantage in this regard?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Closures.

IMO Java is pretty internal-DSL-resistant due to relatively heavy syntax and lack of closures. Static imports help for cleanliness (think Mockito from a developer-centric DSL standpoint), blocks/closures would help quite a bit, IMO.
 
Stephane Clinckart
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse Koskela wrote:If you mean whether it's easy to create DSLs within your code base using the language syntax itself - i.e. to define an API - I suppose it's not that different between Java and C#. Did you have a particular language feature in mind that would give C# an advantage in this regard?


I effectivly points some differences in the language itself:

- There is no lambda expression
- There is no Dynamic type like in C#4

I'm not a real expert with DSL...
--> but I think I know enough about to be sure it will be much more complex in Java to define DSL API than with C#4 due only to theses 2 differences.

The evolution of the Java language is much more slower than C# in the last 3/5 years.

I hope this gap will be reduce with Java 8... but Microsoft will not stop to evoluate also...

Another remarkable gap is Microsoft LINQ... The Java language is not yet enough evoluated to be ready to offer the sames functionnalities.
Of course... some frameworks will achieve to do almost the same... but with wich effort ???
May be Oracle will now accelerate the evolution of the Java language.

Wait & see...

Kind regards,

Stephane Clinckart

 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Completely agree with you Stephane. But I doubt with the community behind it that Java will evolve any faster. Take a look at some lingering bugs and issues that haven't been fixed for ages !
 
Stephane Clinckart
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vyas Sanzgiri wrote:Completely agree with you Stephane. But I doubt with the community behind it that Java will evolve any faster. Take a look at some lingering bugs and issues that haven't been fixed for ages !


So... for a middle/long term Java is dead.

But I think the JVM will survive...

Now which new language will massivly be adopted by the communauty and be better than C#4 ???

Actually, I'm lost and can't predict it.

Do you agree ? Do you have some prediction?

Kind regards,

Stephane Clinckart
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it Java 7 will have closures, and if you can't wait then I recommend taking a look at Groovy. It's basically Java syntax but it supports closures, and supports meta-programming so you get much of the dynamic goodness of Python or Ruby - and it compiles down to Java byte-code.

Burk
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java 7 will not have closures :http://tech.puredanger.com/java7/ I agree this is not an official source.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vyas Sanzgiri wrote:Java 7 will not have closures :http://tech.puredanger.com/java7/ I agree this is not an official source.


I wasn't there, but evidently Mark Reinhold (a Principal Engineer at Sun) made the announcement that Java 7 would support closures at the Devoxx conference last November. and that sounds pretty official to me. DZone has a report on it here http://java.dzone.com/news/closures-coming-java-7 and the Java Posse mentioned the announcement in at least one of their podcasts late last year.

Burk
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark had said earlier in the year that closures would not be in Java 7. So they are not consistent. So my guess is wait and watch!

I am not convinced until I see Java 7 out in the open :-)
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vyas Sanzgiri wrote:Mark had said earlier in the year that closures would not be in Java 7. So they are not consistent. So my guess is wait and watch!

I am not convinced until I see Java 7 out in the open :-)


Well nothings for sure until it's delivered, but if Sun decided to announce something at one of the biggest Java conferences around (3200 attendees from 35 European countries and beyond) I expect they'd be pretty sure about it.
Burk
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAICT closures will make it in in the new form; I sure hope so.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we kind of got off track on this. The original question was whether Java was "well designed" to support DSLs. I don;t believe it was specifically designed to support creating DSLs, but I believe that many of the same things that make it a great general purpose language contribute to making it easier to implement DSLs. So I say, "Yes."

Burk
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I say "no", because as a GPL it lacks many of the constructs necessary for clean DSL implementation, and has an impoverished model of abstraction.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:I say "no", because as a GPL it lacks many of the constructs necessary for clean DSL implementation, and has an impoverished model of abstraction.

David,
Can you be more specific? What kind of constructs are you talking about? For the moment, in one of the other threads someone (I think Terrence) mentioned a DSL implemented in machine language (assembler) - if that's true then it seems reasonable that you can build whatever constructs you need in Java.

As for the "impoverished model of abstraction", that sounds pretty bad - but what do you mean by it?

Burk
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Closures are the biggest thing missing. The pomp and circumstance of Java also make things rather ugly when compared to other languages that allow a more natural internal DSL.

Java's shortcomings are well-documented; rather than continue this thread's spiral into forum-inappropriate chatter I'll just direct you to the web :)
 
nehaa arora
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Closures are the biggest thing missing. The pomp and circumstance of Java also make things rather ugly when compared to other languages that allow a more natural internal DSL.

Java's shortcomings are well-documented; rather than continue this thread's spiral into forum-inappropriate chatter I'll just direct you to the web :)



Dunno if I am adding to the 'chatter' here..but i guess it would be real helpful to enlist imperative language features amenable to DSL development, as 'closures' were mentioned here. Does it then make more sense to pick a programming language suited for DSL work than build up sophisticated language frameworks in java .

thanks,
Neha
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Closures are the biggest thing missing. The pomp and circumstance of Java also make things rather ugly when compared to other languages that allow a more natural internal DSL.

Java's shortcomings are well-documented; rather than continue this thread's spiral into forum-inappropriate chatter I'll just direct you to the web :)


At the risk of spiraling, the web;s a big place with lots of noise from people who don't know what they're talking about. Can you direct me to a place you think makes valid points?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too many to try listing, but searching for "java +impoverished model of abstraction" returned this:

http://www.brainbell.com/tutorials/java/Basic_Java_Limitations.htm

There are an essentially unlimited number of others that go into similar detail. To be honest, I don't really think about it anymore--coming from a Lisp, Smalltalk, and Forth background, Java is like a prison with a really awesome wood/machine-shop: the tools might be awesome, but you're still in jail. If you were born in that jail, seeing how life might be different is difficult to explain--which is why I generally don't try to explain things like Lisp macros to people; until you've experienced what they bring to the table it can be a pretty tough sell.
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

I came from a C/C++ background (with a little Delphi thrown in) so for me Java is a step up.

Burk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic