On 8 September 2010 12:04, Ricky Clarkson <[email protected]> wrote:
> > I can't comment for anyone coming from a different language, but studies
> on
> > migrating Java->Scala shows that you'll be matching productivity levels
> > after 4 weeks, and improving on them thereafter. This is based on pure
> > research as well as feedback from the experiences at EDF trading and
> > Twitter.
>
> Can I, using an IDE, do a usages search from Scala or Java, finding
> results in both Scala and Java code? Can I refactor a Java class and
> have the changes applied to my Scala code, and vice-versa? I hope the
> answer is yes.
IntelliJ can, Eclipse has it on the roadmap. Netbeans... I just don't know
>> 1. In your Scala sample I don't see what that type of items list
> >> contains or should contain.
> >
> > That's the entire point, it doesn't matter!
>
> It would matter if you made YourType.*(Int) fire the missiles instead
> of multiply. Think that's unreasonable? Consider List("hello",
> "world") map (_ + 2)
>
That would return `List("hello2", "world2")`, it's valid code
Scala maintains the same specialised string concatenation behaviour as Java.
Personally I hate `+` for string concatenation, it causes a multitude of
other problems. But Scala inherited it from Java, so we're stuck with it.
What do you mean by the `YourType.*(Int)` notation? It's not valid syntax
in either Java or Scala.
The IDE needs to make sure you can easily see types when you want to,
> and to be able to desugar (_ + 2) into new Function[String, String] {
> def apply(x: String) = x + 2 } either as a view or as a change to the
> code.
>
> > If it's a list of Ints and must later be changed to a list of Doubles or
> > BigInts, why *should* you need to go and change every tiny bit of code
> that
> > uses the list?
>
> Doing that in some cases will prevent bugs caused by refactoring.
> When you change x from type Bath to Athlete, .run has a different
> meaning.
and if your method was `runAllFromList`, then that would be perfectly
acceptable :)
Closing a file and a DB connection, for example, are very different things,
but I see no problem in having a closeAll method that works for either type.
Otherwise, I'd expect your code to do something else with the list that
*does* show up the difference between baths and athletes. There would still
be an error :)
> What's the equivalent to the Tab key for reading back the code? Can your
> > IDE do that for you?
>
> Yes, IDEA has closure folding for Java code.
If it's possible to show the "closure" in a folded form, and still know
everything about it that you need to, then why not just have the folded form
as default language syntax?
It's a recognised need, this is why Scala has closures and why Java7 is
eventually getting them.
> > More worrying still is the fact that Java *needs* this kind of IDE
> support.
>
> Why is it worrying that a language needs an IDE? My first language,
> BASIC on a Spectrum 48k, came with its own IDE, and was quite
> pleasant.
Well, I can only speak from personal experience...
I used to favour eclipse for Java work, then discovered that IntelliJ was
better for Scala, believing at the time that an IDE would be essential.
I still prefer Eclipse for a lot of Java work though.
Frustratingly, I now have to maintain 2 sets of key bindings in my head.
I'm also trying to get up to speed with emacs (a third set of bindings!) now
I've appreciated that Scala doesn't need an IDE so much.
(and the command-line tools are fantastic!)
If Java hadn't been so IDE dependent, I most likely would have learned Emacs
or Vim sooner, and migrating to Scala would have been even easier.
> For example; When you look at an example of using Scala actors, you're
> > looking at a pure library, actors are absolutely *not* in the language
> spec.
>
> On the other tack; a syntax error in a heavy Scala DSL, like Specs or
> actors, can be quite confusing particularly if you're new to the
> language. When you're less new you can read: 5 mustBe lessThan(6)
> (specs, paraphrased) and realise it means 5.mustBe(lessThan(6)), but
> as a new Scala programmer if you write 5 mustBe lessThan 6 you will
> get a confusing error (it will look in the wrong namespace for
> lessThan, iirc)
>
> This isn't really specific to Scala, you could even write Java code
> that exhibits this problem, but Scala does rather encourage it. The
> advantages of DSLs are great, but the barrier to entry can be greater.
I know, I think most Scala developers have encountered that one early in
their learning curve.
It's not perfect as a language, just better than Java.
For comparison, I think that "if(string1 == string2)" is harder problem for
new developers to come to terms with.
> > You can write rubbish in any language, but that doesn't mean that a
> language
> > can't help you out here.
>
> Indeed. I hope the Next Best Thing makes certain kinds of rubbish
> that Java allows impossible.
and makes possible useful things that Java doesn't allow :)
--
Kevin Wright
mail / gtalk / msn : [email protected]
pulse / skype: kev.lee.wright
twitter: @thecoda
--
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.