http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html --
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
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 view this discussion on the web visit
> https://groups.google.com/d/msg/javaposse/-/eLzRtpGSgPAJ.
Don't make me sit you in the comfy chair and poke you with sharp
cushions!
On Nov 23, 3:02 pm, Kevin Wright <kev.lee.wri...@gmail.com> wrote:
> What! No Monty Python?
>
> I refuse to back down over this... Carl would never forgive me if I did :)
>
> On 23 November 2011 13:48, Ricky Clarkson <ricky.clark...@gmail.com> wrote:
>
>
>
>
>
>
>
> > **
> > I think you'd have been better off keeping the film quotes out of that.
> > Either the coffee isn't working (quite probable, it's made from powder by
> > a machine) or that was quite confusing.
> > ------------------------------
> > *From: * Kevin Wright <kev.lee.wri...@gmail.com>
> > *Sender: * java...@googlegroups.com
> > *Date: *Wed, 23 Nov 2011 14:36:48 +0000
> > *To: *<java...@googlegroups.com>
> > *ReplyTo: * java...@googlegroups.com
> > *Subject: *Re: [The Java Posse] Stephen Colebourne on Scala (ouch!)
> > On 23 November 2011 14:04, Jan Goyvaerts <java.arti...@gmail.com> wrote:
>
> >> Speaking of which - NO intention whatsoever to start a flame war ! - is
> >> it correct about the state of the testing ?
>
> >> On Wed, Nov 23, 2011 at 14:42, phil swenson <phil.swen...@gmail.com>wrote:
>
> >>>http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html
Don't make me sit you in the comfy chair and poke you with sharp
cushions!
Fair point, but I made both comments quite early yesterday morning after I saw the tweet, both were clearly marked with my name and the java posse website (cos I am too lazy and haven't updated my own blog in way too long), and both were, as I say, polite and professional in nature. Indeed one was in response to the implication that I had somehow not demonstrated Scala in my demo at the Scripting Bowl, which is clearly nonsense and I felt deserved some kind of response to that effect. Perhaps Stephen has longer than a 24 hour backlog, perhaps he did not recognize my name, but I have trouble believing either of these things. Not to worry, I can always mention it at the end of the next Posse episode :-)Dick
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/-g1TmSL_lqAJ.
Hopefully not. Nothing clears a room faster than two programmers
swapping forty-year-old Monty Python quotes.
[...] is never good when you start out a discussion by saying now I know people will disagree but thats because their bigoted zelots. Its kind of disingenuous to attempt to post a technical dissent filled with personal opinion and preface it with that kind of clause inevitability allowing you to label any dissent as "See those scala zelots are at it again"
http://news.ycombinator.com/item?id=3265003
But nevertheless, I'm still waiting for the obligatory “OMG Scala zealots have been mean to me” aftermath post. :-)
On the “contents” of the post itself ... pretty much hypocrisy at its best.
Bye,--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
dynamically typed language like scala, php, or whatever
Probably a bit too much. BTW, I didn't understand yet whether this thread
was yet another discussion about Scala, or about Stephen's blog post.
I haven't read the blog post, as 102+ answers are just unreadable. I did
attend Stephen's presentation (not really because I'm interested in Scala
or Fantom, but because I never attended a talk by Stephen). Overall, it
was very interesting. After a short exchange with Mario Fusco, I
understand that some criticisms about Scala were probably too shallow. In
the end, though, I appreciated one of Stephen's conclusions, that Scala is
overkill on typing and that just a few of current programming problems
with Java are about typing. Thus there's some overengineering in a useless
area. OTOH, while some aspects of Fantom are interesting, I don't feel
much enthusiastic about it (still, I don't think Stephen wanted to give it
a push, but just have a comparison with Scala). Definitely, it's
interesting that with Fantom you can't have shared mutable state, if I
understood well, and this is a real area of troubles, where I'd appreciate
some care by the language.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
fabrizio...@tidalwave.it
http://tidalwave.it - http://fabriziogiudici.it
On Nov 23, 2011 7:09 PM, "Steel City Phantom" <scph...@gmail.com> wrote:
the types of projects that i do completely eliminate scala as a reasonable option for anything more than simple testing utilities
Many people start with Scala there, the DSL capabilities make it a *very* good fit for writing specifications that read almost exactly like user stories.
take the project im wrapping up right now. im running a team of 8 developers across 3 different companies in 4 different cities in 2 states. add to that a starting point of 200,000 lines of extraordinarily badly designed code with absolutely zero javadocs or any other form of documentation and you have a typical tuesday morning for me.
So you have bigger problems than language choice. But have you considered that your programming language is the main source (no pun intended) of communication between those teams. As a communication channel, is it expressive enough, what's the signal/noise ration?
if this were done in a dynamically typed language like scala, php, or whatever, i most likely would have told my boss to write it off as a total loss and propose a new system from the ground up.
Scala is anything but dynamically typed! One of the criticisms of that article was that the type system is too imposing. Which is is, if you only try and understand it by reading the language specs and not by e.g. actually trying to program something in Scala. In practice, it gets out of your way very nicely.
but because Java forced the previous developers to follow the strict typing and coding rules of java itself, my team and i were able to save it and get it running again with a new database access layer and security system. this project would flat out not have been possible with a dynamic language. it just couldn't.
So if the static typing of Java helped, then presumably the more complete type system of Scala would help even more. As a trival example, it makes it easy to express the idea of optional or uninitialised values via the Option class. Using nulls in Java just isn't as effective!
In general, the issues you've raised so far make it sound as though Scala could actually be a very good fit.
you want an improvement that would help me? how about a JVM that has a true memory managment system that allows the application to manage its memory allocation without cryptic settings in config files and reboots.
Scheduled For (I believe) Java 10
how about a JVM that doesn't have a @#$ damn permgen space. how about a garbage collection system that actually gives you back what it cleans out of memory. oh, how about a garbage collection system that you can trigger when you want it to actually do something specific, like truely flush this 10 meg variable and return those 10 megs back to the system, not just say "oh yea, i did that, TRUST ME!!!"
Permgen space is on the roadmap to be dropped, probably alongside Java 9, with G1GC being made the default garbage collector
how about language features that allow a dependency management system that doesn't require me to write shell scripts to delete old versions of files after every build that keep crashing because class A needs version 10 and class B needs version 9.
Project Jigsaw, a High priority on the Java 8 roadmap.
that would put a smile on my face
Quite :)
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+unsubscribe@googlegroups.com.
> Agreed, shared mutable state is generally a PITA. Then again, it can
> occasionally be very valuable if correctly used and controlled.
>
> Case in point, the disruptor pattern achieves some amazing performance
> metrics through use of shared mutable state, as do certain lock-free
> algorithms and software transactional memory.
>
> Are these solutions that we want to categorically rule out of a
> programming
> language?
Not by chance I wrote "I'd appreciate some care", rather than say that I
don't want to see it supported. Clearly, it's ok when experienced people
use it for writing the Disruptor or such, while I'd appreciate something
that prevented a direct use, not mediated by a "trusted" library.
Case in point, the disruptor pattern achieves some amazing performance metrics through use of shared mutable state, as do certain lock-free algorithms and software transactional memory.Are these solutions that we want to categorically rule out of a programming language?
I've found that to be true, but I find myself able to understand the
type systems of C# and of Haskell (ok, not everything) simply by
reading the language spec. Less true of Java, but I had 10 years less
experience when I first read Java's than when I first read C#'s.
There are things I would happily remove from Scala's type system and
it could be that Java's real successor will be something like Scala,
but minus a few features. Here's what I'd kill:
View types - nobody knows what they are but they knock a bunch of
lines off a number of use cases.
Implicit conversions - the main use case is to do what C# does with
extension methods, and those are simpler. I'd keep implicit
parameters, but only just.
The many and varied uses of underscore, _. Just write 'ignored'
instead [for most uses].
Self types. I don't care much about OOP (not to say I'm in the
immutable-only camp), and those seem only useful in that. The
encoding I'd normally use is more like Java's Enum type (trait Foo[F
<: Foo]) but when I'm coding without enforced designs, which is
luckily all the time now, it just doesn't come up.
Incomplete pattern matches - those should just be a compile error, as
should an incomplete switch over an enum in Java.
Existential types. Wildcards were a mistake in Java, they don't
really need to be copied over. There are reasons for not having 100%
compatibility, and sanity is one of them.
It's not part of the type system, but I'd also drop the XML literals
as I think pretty much everyone using Scala today would too. They are
probably *the* best advert for continuous code review I can think of
(the literals aren't bad but the code backing them is).
I think that without those features, sure, some code would be longer
but I don't think it would be disastrous and it would be much easier
to learn the language. That said, you can learn the language today
and ignore all those features, but some libraries will make that
difficult as they rely on the features.
The core messages behind that talk are that people should care less about what "celebrities" think, and should do more thinking for themselves
So overall, I'm very happy.
Existential types are pretty much the sane cousin of wildcards and necessary in some places.
I'm pretty much against removing implicits, they are one of the key features of the language. I wonder what the whole angst is all about. Java has implicit conversions, C# has implicit and explicit conversions and those two languages are still alive.
I like your Courage analogy. My Diabolical Developer talk at Devoxx
was very much in the same vein, although hidden behind a wall of UK/NZ
irony and sarcasm. Thinking for yourself and not blindly trusting the
'Giants' in our industry is something I think many in our industry
could do more of.
As I say to my audience:
"Those who can't code, teach, those who can't teach write books, those
who don't finish their books, speak at conferences"
OK, that's a little untruthful, so really what I'm saying is:
"If I'm speaking at a number of conferences, writing a book & running
mentoring/training courses then how much of my time am I really
spending coding? So you should take what I say with a grain of salt,
instead maybe you should listen to the developer sitting next to you
who's hacking on some code on their laptop right now."
Cheers,
Martijn
2011/11/23 Cédric Beust ♔ <ced...@beust.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to java...@googlegroups.com.
> To unsubscribe from this group, send email to
> javaposse+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
They're also core to the mechanism that allows collections to just do the Right Thing(tm). For example:someBitSet map {_.toString}
Please - I encourage you to watch the talk - the irony is not lost on me, and indeed I tackle it head on, even to the point of pushing people to disagree with me and think for themselves (which is the point of the whole thing anyway) :-)
On Wed, Nov 23, 2011 at 8:05 PM, Kevin Wright <kev.lee...@gmail.com> wrote:
> For example:
> someBitSet map {_.toString}
> is only able to return a Set[String] thanks to an mechanism based on
> implicits
That's implicit parameters as far as I know, whereas I was talking
about removing implicit conversions.
> I used a self-type only today! They just make some things so much easier...
> Especially when coupled with structural typing, self types really do make
> some problems a great deal more approachable.
They seem to be used for avoiding making a type generic.
> Existential types. Wildcards were a mistake in Java, they don't
> really need to be copied over. There are reasons for not having 100%
> compatibility, and sanity is one of them.
> They're also, sadly, a necessary evil for dealing with certain Java
> libraries. If Scala were to remove features that enable interop, then
> existential types most definitely would not be the first on my list!
One could write a bit of Java code that exposes a wildcard-less
version of a class to Scala. Not the ideal perhaps, but in the
interests of simplicity it might be for the best.
> As it
> is, interop was a core design choice of Scala, so existentials really can't
> be removed.
The interop is great from Java to Scala but terrible the other way
around. object X { val x = 5 } generates a class file named X$, for
instance. There are reasons but they are based on engineering choices
that could reasonably have gone the other way.
Other than Java interop? C# has a similar type system to Java and
doesn't seem to need them, but maybe its programmers replace them with
some runtime casting.
> I'm pretty much against removing implicits, they are one of the key features
> of the language. I wonder what the whole angst is all about. Java has
> implicit conversions, C# has implicit and explicit conversions and those two
> languages are still alive.
Java's implicit conversions are a fixed set, as you know. C#'s do not
make methods available on the value, so if you have a conversion from
Dollar to Euro you can't do mySavingsInDollars.BailOut(greece); you
need ((Euro)mySavingsInDollars).BailOut(greece);, where BailOut only
exists on Euro, not on Dollar. Or you can use a temporary variable as
in, Euro inEuros = mySavingsInDollars; and that triggers the implicit
conversion. Trust me, the example I wrote and deleted before that one
was worse!
So C#'s conversions are slightly more straightforward and are not
appropriate for Scala's main use of them. Luckily C# has extension
methods that cover that use case. To be more exact, I would remove
the 'implicit search' where Scala's compiler looks for an appropriate
type to convert a value to to make a method applicable, but C#'s and
Java's implicit conversions are not, to me, an issue.
I could be wrong, but I think an underlying point Kevin was making was
that there is no compiler support outside of implicits for the
collections in scala. That is, if you had a use case that was similar
to this in code you were writing, you too could take advantage of it.
Since Fantom doesn't even let you write generic classes, I'm guessing
they special case their collections in the compiler.
I could be wrong, but I think an underlying point Kevin was making was
that there is no compiler support outside of implicits for the
collections in scala. That is, if you had a use case that was similar
to this in code you were writing, you too could take advantage of it.
Since Fantom doesn't even let you write generic classes, I'm guessing
they special case their collections in the compiler.
That really bugs me. When I began using Java I was really impressed
at what I would now call dogfooding, that it was pretty much built in
itself at least as far as the library goes, whereas I don't think that
was true for any of the BASICs I'd used beforehand. It was true of C,
C++ and Pascal which I used before Java but for some reason the
importance of it didn't really click until Java.
To see Fantom provide built-in generic types only seems like a serious
step backwards, like not having lambdas or not having recursion.
Apologies, I had meant to say that I wouldn't be shocked if the other
languages also special case the compiler for their collections.
Kotlin goes so far as to make the contains method "break" variance
rules. That sounds like special casing as well. In fact, it seems
like all of the "easier" ways are really just doing the work in the
compiler such that others can not do the same tricks. :)
> Hi Dick,
>
> I like your Courage analogy. My Diabolical Developer talk at Devoxx
> was very much in the same vein, although hidden behind a wall of UK/NZ
> irony and sarcasm. Thinking for yourself and not blindly trusting the
> 'Giants' in our industry is something I think many in our industry
> could do more of.
>
> As I say to my audience:
>
> "Those who can't code, teach, those who can't teach write books, those
> who don't finish their books, speak at conferences"
>
> OK, that's a little untruthful, so really what I'm saying is:
>
> "If I'm speaking at a number of conferences, writing a book & running
> mentoring/training courses then how much of my time am I really
> spending coding? So you should take what I say with a grain of salt,
> instead maybe you should listen to the developer sitting next to you
> who's hacking on some code on their laptop right now."
LOL and I agree with your general points. It's just the matter of defining
what "mentoring" means. It's one of the things I frequently do and it
includes writing code together with the customer, including testing it and
bringing it to production (I mean, it's not just "academic" code).
Also, I am not sure what you mean by "100% safe". Perhaps you mean
statically type-checked according to the scala type system (which is what
you kind of say later in the same sentence - which I think sums it up nicely
and adequately).
Not trying to nit-pick. I just find type-safety to be a small subset of the
potentially desirable properties of programs. I would hate someone to
think that any program I wrote was "100% safe" just because it compiled
or met some type systems constraints.
Cheers, Paul.
Anyway, I'm very glad your response got through in the end, as it is a
good contribution to the debate (and I guess I should really have
checked this list earlier!!!).
thanks,
Stephen
(I'll avoid responding to comments from others here, mostly because
I've had my say now in the main piece and the follow up
http://blog.joda.org/2011/11/scala-ejb-2-feedback.html . Its now for
others to comment, think and decide)
On Nov 23, 2:41 pm, Dick Wall <dickw...@gmail.com> wrote:
> I am a little disappointed that despite writing two polite and on-message
> responses to the article, Stephen has decided not to show those in the
> comments apparently. I am disappointed but not entirely surprised that his
> message is being controlled in this way. Stephen, I don't know if you still
> read the Java Posse group, but if you do, can you let me know why my
> responses were not published in the comments, and whether you want any
> changes to them in order to show them? Thanks.
>
> Dick
LOL
This is all 100% safe and statically typed, and is made possible by the "scary" CanBuildFrom implicit parameter that Stephen mention in his article.I don't believe that Fantom can do this
, not least because it doesn't have highly-optimised collection types such as BitSet
, it doesn't consider Maps to subclass collections of pairs
, and it doesn't support creation of your own paramaterised collection types. So far as I'm aware, Scala is the only language in existence that directly supports such a scheme (though I imagine it would be totally possible to duplicate using something like Lisp macros)
Perhaps there's someone maintaining some code I wrote who is cursing
me now for relying on Date being immutable, I don't know.
Even without that ignorance, not changing values you don't 'own' can
work, just as in C you free() only values you 'own'. Defensive
copying isn't actually necessary. All that said, I prefer the
guarantees immutability can give you, but without immutability I
wouldn't automatically start copying everything around, making method
calls O(n) unnecessarily.
it embraces the same ideals of immutability that he once championed
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
That's encouraging, not enforcing. Nothing stops you from importing
the mutable map type.
Otherwise, it's semantics. method params are immutable
unless, the standard keyword for values is "val"
(equivalent to final in Java), and collections in the standard library
2011/11/24 Cédric Beust ♔ <ced...@beust.com>:
val m = Map(1->"a",2->"b",3->"c")
val field = m(1).getClass.getDeclaredField("value")
field.setAccessible(true)
val mods = field.getClass.getDeclaredField("modifiers")
mods.setAccessible(true)
mods.setInt(field, field.getModifiers & ~java.lang.reflect.Modifier.FINAL)
field.set(m(1), other.get(m(2)))
println(m)
// => Map(1 -> b, 2 -> b, 3 -> c)
2011/11/25 Cédric Beust ♔ <ced...@beust.com>:
--Cédric
--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
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 java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
With kind regards
Ben
[1] Of course this does not hold for System.out, System.in and
System.err.
> Well, that's not quite true. Static final fields actually are
> final[1].
I didn't check the specs... but are you sure? Because people tend to
consider them unmodifiable "also by reflection" just because they are
inlined by the compiler (a thing that can be worked around, BTW). I could
be wrong, but I'd say they are just fields as others, and final (other
than a compiler syntax) is a bit in the VM that could be possibly
dynamically modified?
With kind regards
Ben
[1]: http://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection
[2]: http://www.azulsystems.com/blog/cliff/2011-10-27-final-fields-part-2
On 27 Nov., 13:23, "Fabrizio Giudici" <Fabrizio.Giud...@tidalwave.it>
wrote:
> fabrizio.giud...@tidalwave.ithttp://tidalwave.it-http://fabriziogiudici.it
> As far as I am aware there is no (Java-standard-compliant) way to
> change the value of static final fields (excepting of course the
> previously noted System.in, out and err). And as far as the JVM is
> concerned the same holds true for non-static final fields. Just
> recently Cliff Click wrote two blog posts about that[1,2].
>
> With kind regards
> Ben
>
> [1]:
> http://www.azulsystems.com/blog/cliff/2011-10-17-writing-to-final-fields-via-reflection
> [2]: http://www.azulsystems.com/blog/cliff/2011-10-27-final-fields-part-2
Some people argue the opposite:
Didn't find the time to try it, though.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
> Even if this works, be warned that static final fields are special in
> that
> the JVM is allowed to make static constant-propagation optimization, at
> least for fields of primitive types, without any guard code. So if you
> have
> some code like "if (DEBUG) {...}" and DEBUG==false at the time this code
> is
> first executed, the VM will obliterate that code to nothingness - this is
> guaranteed by spec, it's the only way to obtain conditional compilation
> in
> Java. (I think even the interpreter will do this, no need to wait for
> JIT.)
> Even if afterwards you change DEBUG to true (JNI will certainly work as a
> last resort), that CSE-optimized code will *not* be recompiled to be
> consistent with the new value.
The discussion about reflection and constants was merely academical. Of
course changing constants by reflection is bad idea for any practical
purpose.