Sure, you can write shabby code in any language.

However it's much easier to tell what the original intent was if the 
environment actually prevents certain classes of error. 

Did the programmer mean to write int x = 123 or String x = "123"? For that case 
you should be able to tell frm the context but in more involved cases it might 
be difficult, or worse, some parts of code assume the value is one type and 
some another.

At this point this isn't specific to Groovy, for a dynamic language Groovy at 
least does something at runtime with type annotations, which is more than most 
do.

The real issue is that mediocre programmers can create a worse mess in a 
language that doesn't enforce types and maybe other restrictions than one that 
does.

I'm not elevating myself here, apart from some good practices regarding source 
control etc., I'm capable of making just as big a mess as anyone in a language 
I don't know properly.

A good example that doesn't relate to typing directly is thread-safety in GUI 
toolkits. Swing and WPF have the same requirement whereby you are required to 
use components on the event dispatch thread only. WPF goes some way to 
enforcing that by throwing an exception should you instantiate a component on 
the wrong thread.

Swing, on the other hand, just protests mildly in part of the documentation and 
occasionally displays corruption. This makes it much easier to build up a large 
codebase of mostly-working but fundamentally flawed GUI code.

Refactoring that isn't something I've seen the two MFs cover, and frankly it's 
really hard. That's why where you see 'freedom' I see 'to make a huge mess' in 
small print, and I personally would only use Groovy in dynamic mode as a 
teaching environment or for small programs that would not be expensive to 
rewrite without looking at the original code.

I hope the static mode catches on, and if it does I expect I'll look at Groovy 
again if Oracle repeats Sun's to-ing and fro-ing on lambdas.
-----Original Message-----
From: Paul King <[email protected]>
Sender: [email protected]
Date: Tue, 8 Nov 2011 21:06:14 
To: <[email protected]>
Reply-To: [email protected]
Subject: Re: [The Java Posse] Re: Yet another JVM lang: Extend

On Tue, Nov 8, 2011 at 7:41 PM, Ricky Clarkson <[email protected]> wrote:
> One of the problems we face as developers is taking over projects written by 
> people who ignored or disabled such warnings, or didn't even use the IDE that 
> provides the warnings.
>
> Every time you make an error into a warning someone will deal with it later.

Indeed, that is why things like CodeNarc (checkstyle equivalent) and
now Grumpy mode have been created and have enjoyed some
interest/popularity within the Groovy community. Of course, relying on
compilation alone is setting the bar fairly low. You would ideally
like tests, invariants, static and dynamic analysis tools etc. to be
in play - but agree with you that not all environments are ideal. Of
course, I have also seen the bad side of relying just on compilation -
people not understanding what some code does and just keep "hacking"
it until it compiles - then ship it once if compiles!

Cheers, Paul.

> -----Original Message-----
> From: Paul King <[email protected]>
> Sender: [email protected]
> Date: Tue, 8 Nov 2011 20:36:58
> To: <[email protected]>
> Reply-To: [email protected]
> Subject: Re: [The Java Posse] Re: Yet another JVM lang: Extend
>
> Well, 99% of the time people would get feedback (it would turn yellow
> in their IDEs) at type time. You wouldn't wait until compile time to
> get such feedback.
>
> Cheers, Paul.
>
> On Tue, Nov 8, 2011 at 7:13 PM, Ricky Clarkson <[email protected]> 
> wrote:
>> Which mode would compile the majority of Groovy code?
>> -----Original Message-----
>> From: Paul King <[email protected]>
>> Sender: [email protected]
>> Date: Tue, 8 Nov 2011 19:40:05
>> To: <[email protected]>
>> Reply-To: [email protected]
>> Subject: Re: [The Java Posse] Re: Yet another JVM lang: Extend
>>
>> Yes,
>>
>>  int x = "hello"
>>
>> obviously needs to compile but fail at runtime when in dynamic mode
>> (to cater for what would be somewhat dubious style of metaprogramming
>> in this case) and does indeed fail compilation in grumpy/static mode.
>>
>> Cheers, Paul.
>>
>> On Tue, Nov 8, 2011 at 6:03 PM, Ricky Clarkson <[email protected]> 
>> wrote:
>>> That's what I did about 5 years ago. Perhaps something has changed since 
>>> then but I believe int x = "hello" still compiles in Groovy.
>>>
>>> Also, Scala's .NET compatibility predates Fantom so in order to copy it 
>>> Martin must be even smarter than I thought.
>>> -----Original Message-----
>>> From: Russel Winder <[email protected]>
>>> Sender: [email protected]
>>> Date: Tue, 08 Nov 2011 08:33:35
>>> To: <[email protected]>
>>> Reply-To: [email protected]
>>> Subject: Re: [The Java Posse] Re: Yet another JVM lang: Extend
>>>
>>> On Mon, 2011-11-07 at 16:52 +0000, Ricky Clarkson wrote:
>>>> That's pretty much what I was trying to say. Groovy is a half-arsed Java 
>>>> imitation (to me), similarly Fantom->Scala, PHP->Perl, Ruby->(Smalltalk, 
>>>> Perl)
>>>
>>> Ricky,
>>>
>>> If you are thinking of Groovy as a half-arsed Java imitation, you really
>>> need to actually look at the two languages and compare them.
>>>
>>> Interestingly isn't it Scala copying Fantom to be a language for the
>>> CLR?
>>>
>>> --
>>> Russel.
>>> =============================================================================
>>> Dr Russel Winder      t: +44 20 7585 2200   voip: 
>>> sip:[email protected]
>>> 41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
>>> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "The Java Posse" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group at 
>>> http://groups.google.com/group/javaposse?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "The Java Posse" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/javaposse?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "The Java Posse" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/javaposse?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to