This page is no longer maintained — Please continue to the home page at www.scala-lang.org

problems of scala complexity

101 replies
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.
I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken
fanf
Joined: 2009-03-17,
User offline. Last seen 2 years 30 weeks ago.
Re: problems of scala complexity
On 19/11/2011 00:56, Kenneth McDonald wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines. [...]
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.


I'm still not sure, even after the other thread (I didn't reach the end of all its branches), about what are you after ? Are asking for a Chekstyle[1] application for Scala ?

[1]: ok, everyone knows that one, but nonetheless: http://checkstyle.sourceforge.net/
-- 
Francois ARMAND
http://fanf42.blogspot.com
http://www.normation.com
Russ P.
Joined: 2009-01-31,
User offline. Last seen 1 year 26 weeks ago.
Re: problems of scala complexity


On Fri, Nov 18, 2011 at 3:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:

Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken


This idea was discussed extensively a few months ago. I suggest you find the discussion. I don't recall off hand if any consensus was reached. The basic idea makes sense to me, but I don't know if it is practically feasible.

Any company can institute its own coding standards, of course. Heck, any large enough company can probably develop a compiler plug-in to *enforce* its coding standards and restrictions. Maybe someone should try that and see how it works in practice.

--Russ P.

--
http://RussP.us
kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: problems of scala complexity
On 2011-11-18 4:21 PM, Russ Paielli wrote:
CAHy81hP0rrj5Xu5UBidJiy1sA_Km32SsBk-HypuPzJgcqZsuJw [at] mail [dot] gmail [dot] com" type="cite">

On Fri, Nov 18, 2011 at 3:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com" rel="nofollow">ykkenmcd [at] gmail [dot] com> wrote:

Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken


This idea was discussed extensively a few months ago. I suggest you find the discussion. I don't recall off hand if any consensus was reached. The basic idea makes sense to me, but I don't know if it is practically feasible.

Any company can institute its own coding standards, of course. Heck, any large enough company can probably develop a compiler plug-in to *enforce* its coding standards and restrictions. Maybe someone should try that and see how it works in practice.

--Russ P.

--
http://RussP.us

I seem to recall recently someone suggested some sort of switches to control which language features could be enabled.

For example, in C#/.NET there is the concept of 'unsafe' code so that the developer has to expressly declare they are doing something 'unsafe'. This becomes a warning to both the person choosing to do something unsafe, and to the reader that someone chose to do something unsafe - hopefully for good reason - hopefully because they were qualified to do so. I leave it up to each particular enterprise to decide what their internal conventions are, and who is qualified to do what, but at least there is some language support to make it clearer what is happening (and maybe who is doing it).

I am not sure what this would look like in Scala, but I will naively start off with something based on the now famous A1, A2, A3, L1, L2, L3 classifications. I'm sure there are smarter people who can figure out something better. You could probably do something extra like the @author javadoc so that systems like Maven could test who is allow author certain types of code and fail the build or generate a report when unqualified people (who can't swim) enter the deep end (so to speak). At a minimum the build could signal the software architects that maybe some code review is in order.

It's Friday - I'm tired, but I think Ken is onto something.

Cheers, Eric
Tony Morris
Joined: 2008-12-19,
User offline. Last seen 30 weeks 4 days ago.
Re: problems of scala complexity


On Nov 19, 2011 9:56 AM, "Kenneth McDonald" <ykkenmcd [at] gmail [dot] com> wrote:
>
> I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
>
>     However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
>
> Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
>
> More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
>
> I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.

Hi! Look at me!

You keep saying this, yet you still do not recognise that the problem is not with me or scalaz, but you.

Plenty of us can get along just fine with it, and we do exactly that, right now, at this moment. It has about 10 or more willing contributors and many of them write stuff that I do not comprehend. Want to know what I about it? That's right, I set about coming to terms with comprehending that very thing. Why might I do this? Because that very thing is often *useful*. Your "corporate guidelines" are antithetical to utility, and every scalaz committer soon learns that the only criteria for inclusion is usefulness, not bureacratic garbage; quite the contrary.

You keep using "what Ken fails to comprehend" as some kind of synonym for complexity or obtusity. It is so blatantly transparent that you are inventing excuses for that which you have developed an irrational anxiety response and I will call you out on it each time you burden me,personally with your personal issues. Please pull your head out of the sand, for your own benefit. You might even come to the point where you are able to comprehend that actually scalaz is one of the most easy to comprehend libraries out there, just like others who have bothered to acquaint themselves with the subject matter. Do you think I have scalaz memorised or something?

You can stop looking at me now and start looking at yourself.

>
> I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?
>
> Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
>
> I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
>
> Ken

Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Re: problems of scala complexity
I'd phrase the question another way.
Given a large organization that needs to maintain the ability to move people between projects, and a language like Scala that allows for some very diverse forms of expression, how does one keep the intersection of the two from exploding?
I'm not sure it's possible.
Maxime Lévesque
Joined: 2009-08-18,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

Let's leave aside the difference of perception on the complexity of
Scala, it's totally understandable
that perceived complexity varies as much as it does.

Finding the optimal ratio of complexity to power is always a goal in
language or library design,
personally, I'm a bit clueless on how Scala's complexity could be
reduced without reducing it's power,
I am sure there are much more capable minds than mine thinking about this.

I am certain however that improving the tools can go a long way to
reduce the overall complexity that
Scala can bring to a project. Auto completion for example in an IDE
can be a powerfull educational tool,
when a user stalls the mouse pointer on a val and the IDE shows the
type, that is a huge complexity
reducer, that is just the begining, if an IDE could show a visual hint
at places in the code where
implicit conversions occur, and provide a link to the conversion function,
that would have a huge educational potential, and the complexity would
in effect have been reduced, without changing anything in the language.
Improvements in other tools could also go a long way, Scaladoc could
be made more explanatory,
for example with implicit params, showing a link to implicit val or
def declarations that applies within
the given library. SBT is another area, it needs to be as simple as
possible because it's the first tool
that a Scala new commer will use.
There is also accidental complexity, unstable or insufficiently
documented tools, etc...
All this can be addressed right now without even debating, not that
debating isn't usefull,
but if someont wishes to reduce the complexity of Scala for new
comers, there are plenty
of things that can be done by just helping improve tools in the ecosystem.

Cheers

ML

2011/11/18 Tony Morris :
>
> On Nov 19, 2011 9:56 AM, "Kenneth McDonald" wrote:
>>
>> I am moving this from scala-user to scala-debate upon request. First, a
>> bit of context (copied):
>>
>>     However, as I've thought more about it, I've realized that what
>> enterprises need is _controllable_ complexity. If you have 2,000 software
>> engineers using Scala (which is what we all hope for, right?), then some of
>> them _will_ use the most complex features because they think it's cool,
>> regardless of corporate guidelines.
>>
>> Next, to put this into my own personal perspective: Until recently, I
>> dismissed arguments that Scala was too complex on the grounds that "you can
>> always use as simply a more productive Java".
>>
>> More recently, I have seen arguments that convinced me that a significant
>> problems with Scala was that _the possibility of using it an an unduly
>> complex manner restricted its corporate applicability_. I see this as a
>> highly valid point. (Large) corporations need to expect that engineers are,
>> to some degree, interchangeable. I think even Google must have that approach
>> these days. It should be expected that an engineer can be dumped into
>> another engineers' job and be able, int not too long, to pick up on what is
>> going on.
>>
>> I don't believe this is possible with "full Scala". For example, look at
>> Tony M. and (in addition) scalaz. How many engineers could pick up on code
>> engineered in that universe? Very, very few.
>
> Hi! Look at me!
>
> You keep saying this, yet you still do not recognise that the problem is not
> with me or scalaz, but you.
>
> Plenty of us can get along just fine with it, and we do exactly that, right
> now, at this moment. It has about 10 or more willing contributors and many
> of them write stuff that I do not comprehend. Want to know what I about it?
> That's right, I set about coming to terms with comprehending that very
> thing. Why might I do this? Because that very thing is often *useful*. Your
> "corporate guidelines" are antithetical to utility, and every scalaz
> committer soon learns that the only criteria for inclusion is usefulness,
> not bureacratic garbage; quite the contrary.
>
> You keep using "what Ken fails to comprehend" as some kind of synonym for
> complexity or obtusity. It is so blatantly transparent that you are
> inventing excuses for that which you have developed an irrational anxiety
> response and I will call you out on it each time you burden me,personally
> with your personal issues. Please pull your head out of the sand, for your
> own benefit. You might even come to the point where you are able to
> comprehend that actually scalaz is one of the most easy to comprehend
> libraries out there, just like others who have bothered to acquaint
> themselves with the subject matter. Do you think I have scalaz memorised or
> something?
>
> You can stop looking at me now and start looking at yourself.
>
>>
>> I know from experience that given enough people, developers who are
>> completely incompetent in a technology will nonetheless use the extreme
>> abilities of that technology. For example, I once spent several nasty months
>> fixing the "code" of a "developer" who knew virtually nothing about C++, but
>> who nonetheless decided she could overload operators at her discretion. Do
>> you have any idea how difficult it is to understand code where "+"  means
>> "accumulate into a queue"?
>>
>> Given, than , I refer back to the (implicit question) of my original post:
>> does it make sense to allow the enterprise to control the degree of
>> complexity of Scala that is used? (I think it does)
>>
>> I understand that such a topic may be part of the scala language
>> discussions. If so, apologies, I have not seen it.
>>
>> Ken

Justin du coeur
Joined: 2009-03-04,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

I'm still trying to decide if I think this argument is reasonable, or rationalization.

I mean, C++ was fabulously complex for its day, full of features that you didn't want the average programmer going near, but the world didn't end - a little education and coding guidelines sufficed just fine.  (Ditto for Ada 95, but admittedly that didn't achieve such reach.)

I understand the argument reasonably well.  But history suggests to me that it is probably more catastrophizing than anything else - a problem mostly solveable by coding guidelines...

On Nov 18, 2011 6:56 PM, "Kenneth McDonald" <ykkenmcd [at] gmail [dot] com> wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.
I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken
Bernd Johannes
Joined: 2011-01-28,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity

Am Samstag, 19. November 2011, 02:09:24 schrieb Erik Engbrecht:
> I'd phrase the question another way.
>
> Given a large organization that needs to maintain the ability to move
> people between projects, and a language like Scala that allows for some
> very diverse forms of expression, how does one keep the intersection of the
> two from exploding?
>
> I'm not sure it's possible.

While I dismiss the option to disable scala features I see the beauty in being
able to "spot" "critical" sections somehow.

What I am missing currently is a survey giving some basic facts about what
furthers understanding and what blocks understanding if someone is about to
read some given section of code. "Critical" would be anything that makes it
unecessarily hard to understand or follow a concept / solution that is
implemented (the "what it does").

That's not to be mixed with the complexity of a concept/solution in itself. If
I don't understand the concept/solution (the "why") in itself I won't be able
to figure out the meaning of code implementing that concept/solution in any
language.

Existing code metrics (for different languages) try to capture aspects of this
"what it does" problem (and there has been some related research) - but I am
not aware of any good code metrics for scala.

If we had such code metrics we could tag the code and try to align metric
signatures with "comprehension effort". This would give enterprises a valuable
instrument to spot source parts which should be reworked.

I think that would help...

Greetings
Bernd

tolsen77
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Re: problems of scala complexity
Mind you, scalaz is just a library written in Scala [1]? Earlier editions was available in Java [1] too. That's even more incomprehensible to the untrained eye than Scala. ;) People might disagree with this methodology of programming but one shouldn't conflate Scala the language with it. I believe it has nothing to do with full Scala. Is it worth the effort? Well, we need to see more evidence proving its worth. Some ideas seems to trickle through though. Btw, wouldn't the same problems about complexity apply to algorithms and data-structures?

[1] https://github.com/functionaljava/functionaljava/blob/master/core/src/main/java/fj/data/Iteratee.java
[2] https://github.com/scalaz/scalaz/blob/master/core/src/main/scala/scalaz/Iteratee.scala

On 19 November 2011 00:56, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: problems of scala complexity
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.

Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.

Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.

Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.
This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.

Can best practices be influenced by tools, such as style checkers? Maybe. It's certainly something we want to pursue. But it would be silly to delegate responsibility for forming best practices to these tools only.

[Cross-posted to scala-user, because it relates to quite a few threads there as well]

 -- Martin

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: problems of scala complexity
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.

Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.

Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.

Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.
This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.

Can best practices be influenced by tools, such as style checkers? Maybe. It's certainly something we want to pursue. But it would be silly to delegate responsibility for forming best practices to these tools only.

[Cross-posted to scala-user, because it relates to quite a few threads there as well]

 -- Martin

Tom Switzer
Joined: 2011-07-19,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity
Hi Ken,
On Fri, Nov 18, 2011 at 6:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_.

But this is hardly limited to Scala. You can use Java in ways that can be much more difficult to understand than most Scala code. Also, complex is not the right word -- watch Rich Hickey's presentation on complexity, it is awesome.
Using the visitor pattern (/double dispatch) in Java may confuse an engineer who has never seen the concept. However, the visitor pattern can actually _simplify_ a lot of Java code, where you need to reuse a data structure in many ways.
Now, you want to see complex? Look at most large Java frameworks used in large enterprises. There is so much magic going on that trying to debug a simple problem can lead to days lost as you try to untwine all the various pieces and figure out how they interact. Some of these things have these incredibly complicated testing frameworks to support them, as everything is so intertwined that even testing a small unit of code is a problem unto itself.
I first started using Scala in one project I had previously written in Java. Using concepts like implicits, traits, "enrich" my library pattern (;)), etc. I was able to greatly simplify my library. That is, these concepts let me both simplify my code and also produce a library that was simpler.  
I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.

Our entire modern society is built on specialization. You want to be able to replace somebody if they're hit by a bus, but software developers do not come in a one-size-fits-all model. Now, clearly your problem has a lot of caveats. Regardless of the organization, you wouldn't expect a newly hired tester to be put in a senior developers position and just figure things out himself. You replace competent developers with competent developers. Can a competent developer learn Scala? Of course. This has already been proven, as shown by Scala's popularity. 
I'm a firm believer that people will raise to your expectations of them. If you make it clear that you expect them to be replaceable cogs that should write software that can be maintained by the cheapest developer they can find, since it is expected you'll either be fired, outsourced or quit in a short amount of time, then, yeah, you'll end up with crap. Crap people and crap code. Perhaps the real solution is that enterprises just need to raise their expectations?  
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.

How many engineers could pick up/maintain code in most operating system or even the collection libraries in Java, C#, C++, Scala, etc. Does this stop people from using them effectively? No. Scalaz is a tool for software developers. You do not need to be able to create a tool from scratch to use it effectively.  
I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?

Code reviews were created to solve precisely this problem. Nothing about Scala interferes with this. However, these rules can also "backfire" when you don't trust your developers. One friend told me a story where his code was rejected because it used a linked list, rather than an ArrayList. Of course, he was using a linked list for the O(1) insert/delete while traversing the list. The standards were so strict/arbitrarily applied that they'd rather have an O(n^2) algorithm that used ArrayList than a O(n) one that used a linked list.  
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)

No, I do not think it does. It makes sense to let enterprises do what they always did; code reviews. Code reviews are great because they can be tailored for each dept. and individual. If a group needs to write performant code or an easy-to-use, not-so-easy-to-implement library, they shouldn't be gimped because someone higher up is worried about whether he'll be able to ship the dept off to some 3rd world country.
Code reviews ensure new developers aren't making sill mistakes (like overloading + in an unexpected way), while also letting senior developers create complex, but necessary, software that is still understandable by other senior developers, even if not by a newbie.  
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: problems of scala complexity


On Fri, Nov 18, 2011 at 6:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
This mindset has led to the greatest atrocities in engineering management.  No two engineers are the same.   We all have different capabilities, and the features we choose to work on in a code base reflects that.   Making sure engineers can maintain code is *different* than treating them like replacable cogs.
 
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.

I completely disagree with the assumption that FP style code can't be engineered by many.   Scalaz does itself a disservice in two ways:
(1)  Non-existent documentation.   This is *just as bad* as that old legacy codebase we're all forced to maintain with 1k's of lines of non-documented junk code. (2) Re-inventing itself every revision.    Scalaz is tough because it changes so frequently.  Luckily 6.x series has been maintained for a while and stable-ish.
Assuming the Scalaz represents functional programming in scala on the whole is bogus.
Treating engineers as replacable cogs is downright insulting.   

I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?

Let's look at the real problem: You had an engineer who was committing poor code into the codebase with no supervision.   I think we've all run into this problem *regardless of the language*.  I ran into this problem more often on Java teams and less often with Scala teams.  Poor process and hiring does not necessitate a problem of language, but of the company doing the hiring, or its development process.   Good engineers will be able to hire other good engineers.   There's a lot of smart people out there, that if recongized by a company can ensure a good, smooth development process.   I don't think I've ever walked into a shop without at least one guy who knew what's up.  Some may not have enough of the boss's ear to turn around the process, but this is a *human* problem.  
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)

Right, if your company requires this to ensure correct code, perhaps a plugin.  However, given what I've seen in Java, I think some folks can destroy a codebase even without implicits.   The fundamental problem still remains:   Someone is given no oversight and commit rights to code.  

I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken

This is a great place to re-hash discussions, especially if you feel the environment has changed, or you have no content to add.   Don't hesitate to bring things up.  Discussions like these are very healthy for the community, assuming it doesn't devolve.


odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: problems of scala complexity


On Sat, Nov 19, 2011 at 7:44 PM, Josh Suereth <joshua [dot] suereth [at] gmail [dot] com> wrote:


On Fri, Nov 18, 2011 at 6:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
This mindset has led to the greatest atrocities in engineering management.  No two engineers are the same.   We all have different capabilities, and the features we choose to work on in a code base reflects that.   Making sure engineers can maintain code is *different* than treating them like replacable cogs.
 
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.

I completely disagree with the assumption that FP style code can't be engineered by many.   Scalaz does itself a disservice in two ways:
(1)  Non-existent documentation.   This is *just as bad* as that old legacy codebase we're all forced to maintain with 1k's of lines of non-documented junk code. (2) Re-inventing itself every revision.    Scalaz is tough because it changes so frequently.  Luckily 6.x series has been maintained for a while and stable-ish.
Assuming the Scalaz represents functional programming in scala on the whole is bogus.
Treating engineers as replacable cogs is downright insulting.   

I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?

Let's look at the real problem: You had an engineer who was committing poor code into the codebase with no supervision.   I think we've all run into this problem *regardless of the language*.  I ran into this problem more often on Java teams and less often with Scala teams.  Poor process and hiring does not necessitate a problem of language, but of the company doing the hiring, or its development process.   Good engineers will be able to hire other good engineers.   There's a lot of smart people out there, that if recongized by a company can ensure a good, smooth development process.   I don't think I've ever walked into a shop without at least one guy who knew what's up.  Some may not have enough of the boss's ear to turn around the process, but this is a *human* problem.  
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)

Right, if your company requires this to ensure correct code, perhaps a plugin.  However, given what I've seen in Java, I think some folks can destroy a codebase even without implicits.   The fundamental problem still remains:   Someone is given no oversight and commit rights to code.  

I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken

This is a great place to re-hash discussions, especially if you feel the environment has changed, or you have no content to add.   Don't hesitate to bring things up.  Discussions like these are very healthy for the community, assuming it doesn't devolve.

I agree with the gist of everything you have written here, Josh, but I assume you meant "or if you have _new_ content to add".
Cheers
 -- Martin
dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: problems of scala complexity

On Fri, Nov 18, 2011 at 21:56, Kenneth McDonald wrote:
> I know from experience that given enough people, developers who are
> completely incompetent in a technology will nonetheless use the extreme
> abilities of that technology. For example, I once spent several nasty months
> fixing the "code" of a "developer" who knew virtually nothing about C++, but
> who nonetheless decided she could overload operators at her discretion. Do
> you have any idea how difficult it is to understand code where "+"  means
> "accumulate into a queue"?

I assume the code was something like: "q + e". Do you think it would
be easier to understand the code if it was "q.plus(e)" or "q.add(e)"?

Tony Morris
Joined: 2008-12-19,
User offline. Last seen 30 weeks 4 days ago.
Re: problems of scala complexity


On Nov 20, 2011 4:44 AM, "Josh Suereth" <joshua [dot] suereth [at] gmail [dot] com> wrote:
>
>
>
> On Fri, Nov 18, 2011 at 6:56 PM, Kenneth McDonald <ykkenmcd [at] gmail [dot] com> wrote:
>>
>> I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
>>
>>     However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
>>
>> Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
>>
>> More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
>>
> This mindset has led to the greatest atrocities in engineering management.  No two engineers are the same.   We all have different capabilities, and the features we choose to work on in a code base reflects that.   Making sure engineers can maintain code is *different* than treating them like replacable cogs.
>
>  
>>
>> I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.
>
>
> I completely disagree with the assumption that FP style code can't be engineered by many.   Scalaz does itself a disservice in two ways:
>
> (1)  Non-existent documentation.   This is *just as bad* as that old legacy codebase we're all forced to maintain with 1k's of lines of non-documented junk code

I truly find it amazing that this is repeated so readily given the mountains of documentation out there. It is as if we could choke the world with even more documentation, just so we could increase the occurrence of repetition of this statement.

Aside from the fact that scalaz makes much more rigorous *machine checked* type system guarantees about the behaviour of functions than a typical scala program/library/user does, and aside from the mountain of papers out there documenting exactly the concepts implemented, and aside from the runnable usage examples, and aside from the articles written by people who switched off their blinkers, learned the material and wrote about it, and aside from machine run specifications, then what documentation are you alluding to?

There doesn't exist a scala library out there with more than 10% of the documentation of scalaz. This fact coupled with the ferver with which the contrary is so readily protested fascinates me endlessly.

It's simply cognitive blindness; I can think of no better hypothesis matching observations in reality. Where do you think the many people who overcome this illusory hurdle got their learning material from? That question is not rhetorical; think about the answer carefully.

> (2) Re-inventing itself every revision.    Scalaz is tough because it changes so frequently.  Luckily 6.x series has been maintained for a while and stable-ish.

It didn't reinvent itself. It is quite stable. You might be referring to the need to adjust to changes and contentions in scala itself. Scalaz aims to be *useful* so if scala decides to change its type inference slightly, or perhaps order of initialisation, scalaz must adjust accordingly in order to maintain the thesis. This is aside from all the contentions that arise from inherent properties of scala. Many have tried and fizzled attempting to resolve all of these contentions. Nobody likes shaving yaks, but it must be done as a consequence sometimes, *including the occasions when others choose to deny the existence of these consequences*.

>
> Assuming the Scalaz represents functional programming in scala on the whole is bogus.

It doesn't at all, but if you are functional programming, you're going to reinvent a good deal of scalaz. Denialists have very few tactics around this fact, which is itself refreshing.

>
> Treating engineers as replacable cogs is downright insulting.   
>>
>>
>> I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?
>>
>
> Let's look at the real problem: You had an engineer who was committing poor code into the codebase with no supervision.   I think we've all run into this problem *regardless of the language*.  I ran into this problem more often on Java teams and less often with Scala teams.  Poor process and hiring does not necessitate a problem of language, but of the company doing the hiring, or its development process.   Good engineers will be able to hire other good engineers.   There's a lot of smart people out there, that if recongized by a company can ensure a good, smooth development process.   I don't think I've ever walked into a shop without at least one guy who knew what's up.  Some may not have enough of the boss's ear to turn around the process, but this is a *human* problem.
>  
>>
>> Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
>
>
> Right, if your company requires this to ensure correct code, perhaps a plugin.  However, given what I've seen in Java, I think some folks can destroy a codebase even without implicits.   The fundamental problem still remains:   Someone is given no oversight and commit rights to code.
>  
>>
>>
>> I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
>>
>> Ken
>
>
> This is a great place to re-hash discussions, especially if you feel the environment has changed, or you have no content to add.   Don't hesitate to bring things up.  Discussions like these are very healthy for the community, assuming it doesn't devolve.
>
>
>

vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
Re: Re: problems of scala complexity
Watching interns in our company, I do not observe any "complexity" complaints; they just do it. The coding style is not that good, too many statics and vars; and have to train them to do unittesting properly; and they use foldLeft just to calculate a max of an iterable; but that's all pretty simple and technical and easy to train.

What's interesting, the interns hardly ever use type parameters; and they leisurely mix Either (which I was enforcing), Option and nulls. But they do not have much Java experience either, so it's all the same to them.

Again, they don't seem to see any special "complexity". Seems like for someone who is not used to decades of Java, it's a language like any other. Easier than Haskell.

Thanks,
-Vlad


On Sat, Nov 19, 2011 at 6:31 AM, martin odersky <martin [dot] odersky [at] epfl [dot] ch> wrote:
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.

Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.

Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.

Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.
This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.

Can best practices be influenced by tools, such as style checkers? Maybe. It's certainly something we want to pursue. But it would be silly to delegate responsibility for forming best practices to these tools only.

[Cross-posted to scala-user, because it relates to quite a few threads there as well]

 -- Martin


dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: problems of scala complexity

On Sat, Nov 19, 2011 at 18:42, Tony Morris wrote:
>
>> (1)  Non-existent documentation.   This is *just as bad* as that old
>> legacy codebase we're all forced to maintain with 1k's of lines of
>> non-documented junk code
>
> I truly find it amazing that this is repeated so readily given the mountains
> of documentation out there. It is as if we could choke the world with even
> more documentation, just so we could increase the occurrence of repetition
> of this statement.

Or it could be that the documentation is not in the correct place.

> Aside from the fact that scalaz makes much more rigorous *machine checked*
> type system guarantees about the behaviour of functions than a typical scala
> program/library/user does, and aside from the mountain of papers out there

Yeah, well, most people expect documentation to be in English, not in
type declarations. In fact, most people consider type declarations to
be "source code", and define "documentation" to be "not source code".
Disagree all you want with this perspective, but don't come
complaining when people act like people do.

> documenting exactly the concepts implemented, and aside from the runnable
> usage examples, and aside from the articles written by people who switched

Runnable examples? Mmmmm... that sounds suspiciously like "source
code". See above.

> off their blinkers, learned the material and wrote about it, and aside from

Blogs exist where documentation fails.

> machine run specifications, then what documentation are you alluding to?

Well, open http://scalaz.github.com/scalaz/scalaz-2.9.1-6.0.2/doc/index.html#scalaz....
See those 16 out of 69 methods that have some text in English below
it? Well, that's one thing people call "documentation", and I'll let
the numbers speak for themselves.

Another example of things people call "documentation" is this:
http://download.oracle.com/javase/6/docs/technotes/guides/collections/ov....
You might think this is bad for some reason, for all I know. If that's
the case, then just substitute "something bad" for "documentation"
whenever people talk about it. But _don't_ substitute "source code"
for "documentation".

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Re: problems of scala complexity

On Sat, Nov 19, 2011 at 18:46, Vlad Patryshev wrote:
> Watching interns in our company, I do not observe any "complexity"
> complaints; they just do it. The coding style is not that good, too many
> statics and vars; and have to train them to do unittesting properly; and
> they use foldLeft just to calculate a max of an iterable; but that's all
> pretty simple and technical and easy to train.
>
> What's interesting, the interns hardly ever use type parameters; and they
> leisurely mix Either (which I was enforcing), Option and nulls. But they do
> not have much Java experience either, so it's all the same to them.
>
> Again, they don't seem to see any special "complexity". Seems like for
> someone who is not used to decades of Java, it's a language like any other.
> Easier than Haskell.

Given what COBOL looks like, I'm pretty sure COBOL programmers thought
all other languages exceedingly weird and complex. I don't know how
many of them ever transitioned to another language, but that's
irrelevant -- new programmers learned new programming languages. Java
has quite a lot of COBOL potential: it might well outlive all of us,
their programmers might not ever switch to another language, but it
may well decrease in importance until few people would ever consider
learning it.

The complexity to *new programmers* is a much more important metric
than the complexity to existing programmers, and, yet, it is always
the latter that people talk about. Go figure.

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Re: problems of scala complexity

On Sat, Nov 19, 2011 at 18:46, Vlad Patryshev wrote:
> Watching interns in our company, I do not observe any "complexity"
> complaints; they just do it. The coding style is not that good, too many
> statics and vars; and have to train them to do unittesting properly; and
> they use foldLeft just to calculate a max of an iterable; but that's all
> pretty simple and technical and easy to train.
>
> What's interesting, the interns hardly ever use type parameters; and they
> leisurely mix Either (which I was enforcing), Option and nulls. But they do
> not have much Java experience either, so it's all the same to them.
>
> Again, they don't seem to see any special "complexity". Seems like for
> someone who is not used to decades of Java, it's a language like any other.
> Easier than Haskell.

Given what COBOL looks like, I'm pretty sure COBOL programmers thought
all other languages exceedingly weird and complex. I don't know how
many of them ever transitioned to another language, but that's
irrelevant -- new programmers learned new programming languages. Java
has quite a lot of COBOL potential: it might well outlive all of us,
their programmers might not ever switch to another language, but it
may well decrease in importance until few people would ever consider
learning it.

The complexity to *new programmers* is a much more important metric
than the complexity to existing programmers, and, yet, it is always
the latter that people talk about. Go figure.

Lex
Joined: 2010-02-28,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity
I think that paradoxically Scala is less complex than Java.

The complexity in Java arises from the lack of the right tools to get the job done. So you end up reimplementing the same functionality many time, or pick one of many non-compatible libraries that do so for you. On the ohter hand Scala provides many of such tools right out of the box. So the only complexity is to learn your tools once.

One perception of complexity comes from the functional side of Scala, which looks scary to anverage Java programmer. Another perception of complexity comes from the language flexibility, which looks like custom syntax for everything to an untrained eye. I think a I good way to combat this would be to put together a quick guide on the special syntax, and hammer that early in early on.

Here is a quick list of things that need to be covered before anyone is shown a real piece of Scala code:

blocks resulting in values (also no return statement)
functions
apply() / update()
operators
pattern matching


On Sat, Nov 19, 2011 at 3:56 PM, Daniel Sobral <dcsobral [at] gmail [dot] com> wrote:
On Sat, Nov 19, 2011 at 18:46, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
> Watching interns in our company, I do not observe any "complexity"
> complaints; they just do it. The coding style is not that good, too many
> statics and vars; and have to train them to do unittesting properly; and
> they use foldLeft just to calculate a max of an iterable; but that's all
> pretty simple and technical and easy to train.
>
> What's interesting, the interns hardly ever use type parameters; and they
> leisurely mix Either (which I was enforcing), Option and nulls. But they do
> not have much Java experience either, so it's all the same to them.
>
> Again, they don't seem to see any special "complexity". Seems like for
> someone who is not used to decades of Java, it's a language like any other.
> Easier than Haskell.

Given what COBOL looks like, I'm pretty sure COBOL programmers thought
all other languages exceedingly weird and complex. I don't know how
many of them ever transitioned to another language, but that's
irrelevant -- new programmers learned new programming languages. Java
has quite a lot of COBOL potential: it might well outlive all of us,
their programmers might not ever switch to another language, but it
may well decrease in importance until few people would ever consider
learning it.

The complexity to *new programmers* is a much more important metric
than the complexity to existing programmers, and, yet, it is always
the latter that people talk about. Go figure.

--
Daniel C. Sobral

I travel to the future all the time.

Lex
Joined: 2010-02-28,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity
I think that paradoxically Scala is less complex than Java.

The complexity in Java arises from the lack of the right tools to get the job done. So you end up reimplementing the same functionality many time, or pick one of many non-compatible libraries that do so for you. On the ohter hand Scala provides many of such tools right out of the box. So the only complexity is to learn your tools once.

One perception of complexity comes from the functional side of Scala, which looks scary to anverage Java programmer. Another perception of complexity comes from the language flexibility, which looks like custom syntax for everything to an untrained eye. I think a I good way to combat this would be to put together a quick guide on the special syntax, and hammer that early in early on.

Here is a quick list of things that need to be covered before anyone is shown a real piece of Scala code:

blocks resulting in values (also no return statement)
functions
apply() / update()
operators
pattern matching


On Sat, Nov 19, 2011 at 3:56 PM, Daniel Sobral <dcsobral [at] gmail [dot] com> wrote:
On Sat, Nov 19, 2011 at 18:46, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
> Watching interns in our company, I do not observe any "complexity"
> complaints; they just do it. The coding style is not that good, too many
> statics and vars; and have to train them to do unittesting properly; and
> they use foldLeft just to calculate a max of an iterable; but that's all
> pretty simple and technical and easy to train.
>
> What's interesting, the interns hardly ever use type parameters; and they
> leisurely mix Either (which I was enforcing), Option and nulls. But they do
> not have much Java experience either, so it's all the same to them.
>
> Again, they don't seem to see any special "complexity". Seems like for
> someone who is not used to decades of Java, it's a language like any other.
> Easier than Haskell.

Given what COBOL looks like, I'm pretty sure COBOL programmers thought
all other languages exceedingly weird and complex. I don't know how
many of them ever transitioned to another language, but that's
irrelevant -- new programmers learned new programming languages. Java
has quite a lot of COBOL potential: it might well outlive all of us,
their programmers might not ever switch to another language, but it
may well decrease in importance until few people would ever consider
learning it.

The complexity to *new programmers* is a much more important metric
than the complexity to existing programmers, and, yet, it is always
the latter that people talk about. Go figure.

--
Daniel C. Sobral

I travel to the future all the time.

Arif Mustafa
Joined: 2011-11-08,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity
great points @Aleksey ... what I have noticed is the sentax-complexity that does get in the way... and yes functional concepts to some degree ...

best regards

Arif


On Sat, Nov 19, 2011 at 5:19 PM, Aleksey Nikiforov <lexn82 [at] gmail [dot] com> wrote:
I think that paradoxically Scala is less complex than Java.

The complexity in Java arises from the lack of the right tools to get the job done. So you end up reimplementing the same functionality many time, or pick one of many non-compatible libraries that do so for you. On the ohter hand Scala provides many of such tools right out of the box. So the only complexity is to learn your tools once.

One perception of complexity comes from the functional side of Scala, which looks scary to anverage Java programmer. Another perception of complexity comes from the language flexibility, which looks like custom syntax for everything to an untrained eye. I think a I good way to combat this would be to put together a quick guide on the special syntax, and hammer that early in early on.

Here is a quick list of things that need to be covered before anyone is shown a real piece of Scala code:

blocks resulting in values (also no return statement)
functions
apply() / update()
operators
pattern matching


On Sat, Nov 19, 2011 at 3:56 PM, Daniel Sobral <dcsobral [at] gmail [dot] com> wrote:
On Sat, Nov 19, 2011 at 18:46, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
> Watching interns in our company, I do not observe any "complexity"
> complaints; they just do it. The coding style is not that good, too many
> statics and vars; and have to train them to do unittesting properly; and
> they use foldLeft just to calculate a max of an iterable; but that's all
> pretty simple and technical and easy to train.
>
> What's interesting, the interns hardly ever use type parameters; and they
> leisurely mix Either (which I was enforcing), Option and nulls. But they do
> not have much Java experience either, so it's all the same to them.
>
> Again, they don't seem to see any special "complexity". Seems like for
> someone who is not used to decades of Java, it's a language like any other.
> Easier than Haskell.

Given what COBOL looks like, I'm pretty sure COBOL programmers thought
all other languages exceedingly weird and complex. I don't know how
many of them ever transitioned to another language, but that's
irrelevant -- new programmers learned new programming languages. Java
has quite a lot of COBOL potential: it might well outlive all of us,
their programmers might not ever switch to another language, but it
may well decrease in importance until few people would ever consider
learning it.

The complexity to *new programmers* is a much more important metric
than the complexity to existing programmers, and, yet, it is always
the latter that people talk about. Go figure.

--
Daniel C. Sobral

I travel to the future all the time.


ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: Re: problems of scala complexity
On Sat, Nov 19, 2011 at 3:46 PM, Vlad Patryshev <vpatryshev [at] gmail [dot] com> wrote:
 and they use foldLeft just to calculate a max of an iterable

Yay!  I would just as soon do away with redundant extra methods like max and sum and rely upon people to use fold and/or reduce.  Memorizing more methods which you can use instead of powerful generic ones is not an unqualified win.  But in any case, if they think, "Huh, I need to find the largest thing here" and they conclude "Oh, I'll just do a fold!" then I think you've got good people and/or training.

  --Rex

Tony Morris
Joined: 2008-12-19,
User offline. Last seen 30 weeks 4 days ago.
Re: problems of scala complexity


On Nov 20, 2011 7:49 AM, "Daniel Sobral" <dcsobral [at] gmail [dot] com> wrote:
>
> On Sat, Nov 19, 2011 at 18:42, Tony Morris <tmorris [at] tmorris [dot] net> wrote:
> >
> >> (1)  Non-existent documentation.   This is *just as bad* as that old
> >> legacy codebase we're all forced to maintain with 1k's of lines of
> >> non-documented junk code
> >
> > I truly find it amazing that this is repeated so readily given the mountains
> > of documentation out there. It is as if we could choke the world with even
> > more documentation, just so we could increase the occurrence of repetition
> > of this statement.
>
> Or it could be that the documentation is not in the correct place.

It could be; but I think there are more likely explanations.

>
> > Aside from the fact that scalaz makes much more rigorous *machine checked*
> > type system guarantees about the behaviour of functions than a typical scala
> > program/library/user does, and aside from the mountain of papers out there
>
> Yeah, well, most people expect documentation to be in English, not in
> type declarations. In fact, most people consider type declarations to
> be "source code", and define "documentation" to be "not source code".

No they don't. You have a selection bias. So do I.

Watch this. Most people are absolutely adamant that your statement is wrong. That's because it is. I was able to make this claim by restricting myself to people who understand the subject matter at hand. Of course they see your statement is wrong. To most people, it is bleedingly obvious!

More seriously, I agree there are a lot of people who believe your statement. They are wrong. What now? Are you offering to join the agenda of educating those who seek it out? If not what? There are many people who have overcome this very exact hurdle; it's tough work though.

> Disagree all you want with this perspective, but don't come
> complaining when people act like people do.

I'm well aware of the popular views. There is an enormous amount of documentation in English out there; to be, clear, a FUCKING OVERWHELMING amount that I doubt I will get through in my life time.

>
> > documenting exactly the concepts implemented, and aside from the runnable
> > usage examples, and aside from the articles written by people who switched
>
> Runnable examples? Mmmmm... that sounds suspiciously like "source
> code". See above.

Yes, runnable examples are extremely useful by virtue of their being machine checked.

>
> > off their blinkers, learned the material and wrote about it, and aside from
>
> Blogs exist where documentation fails.

Bollocks. Blogs exist because people learn and want to share it with others who do more than pay lip service to the goal of learning.

>
> > machine run specifications, then what documentation are you alluding to?
>
> Well, open http://scalaz.github.com/scalaz/scalaz-2.9.1-6.0.2/doc/index.html#scalaz.Identity.
> See those 16 out of 69 methods that have some text in English below
> it? Well, that's one thing people call "documentation", and I'll let
> the numbers speak for themselves.

What if many people are wrong? It's not as if there aren't countless examples of many people sharing the same mistake, surviving only by patting each other on the back, confirming the perpetuity of the mistake.

>
> Another example of things people call "documentation" is this:
> http://download.oracle.com/javase/6/docs/technotes/guides/collections/overview.html.
> You might think this is bad for some reason, for all I know. If that's
> the case, then just substitute "something bad" for "documentation"
> whenever people talk about it. But _don't_ substitute "source code"
> for "documentation".
>

Its not bad; its just clumsy and error-prone, and subsequently inefficient. There are far better ways of achieving comprehension of a subject using oh I don't know, maybe COMMUNICATION SKILLS or something. Oh wait I forgot; I don't have those; I was born, with this understanding and everyone else is excluded from sharing it. Cheap stab sorry, but a bit of introspection is desperately in order around here.

> --
> Daniel C. Sobral
>
> I travel to the future all the time.

kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: problems of scala complexity
You are very much correct Justin - the world did not end.

However, as far as I am concerned C++ is now a dead language. In spite of whatever else anyone else believes I will never again start any new projects with C++ for any reason whatsoever - although I can still see many reasons to write code in C sometimes. Also, as I now wield considerable influence in my own organization I would do everything in my power to prevent any new projects starting in C++ as I believe with my heart an soul it would detrimental to our organization to do so. I do not think I am being elitist (but I am being passionate) as there are so many better choices than C++ such as Java or even C#, and even Scala now.

My point is, I do not want to see Scala end up where C++ is now - the mess that it is. At the time C++ was the state of the art and I even passionately advocated it for a while. What I truly hope for is that the Scala community learn from the mistakes that were made with C++ and try to avoid them. Many of the mistakes that were made with C++ were not even the language design per se, rather they were the immaturity of the culture and community that was using and then abusing C++.

In particular, I really do want to advocate using Scala in our projects and in my organization - but ten years from now I do now want to look back and regret it - they way I now regret advocating C++ once.

If I may use another analogy. I am not an American, but I hear people complain all the time about the American tax system - it is too complex. Some people would simplify it to the point of the tuple (9%, 9%, 9%) - although that is just performance art based on SIM City - but the reality is that it needs something more complex than that to work effectively, yet people still have a very valid point that it is now too complex.

I feel this argument is reasonable as there are people with valid concerns about the complexity of Scala and it serves us all well to address those concerns constructively rather than dismiss or invalidate them. It may seem to you that some of us are catastrophizing C++, but to me C++ is a very real catastrophe of what happens when we ignore these very issues.

Cheers, Eric

On 2011-11-18 9:57 PM, Justin du coeur wrote:
CAO26FW3Vq4yXjao5w8NjFwEiYnE5F6VKnY5bFt4Q0cUUBLtMDw [at] mail [dot] gmail [dot] com" type="cite">

I'm still trying to decide if I think this argument is reasonable, or rationalization.

I mean, C++ was fabulously complex for its day, full of features that you didn't want the average programmer going near, but the world didn't end - a little education and coding guidelines sufficed just fine.  (Ditto for Ada 95, but admittedly that didn't achieve such reach.)

I understand the argument reasonably well.  But history suggests to me that it is probably more catastrophizing than anything else - a problem mostly solveable by coding guidelines...

On Nov 18, 2011 6:56 PM, "Kenneth McDonald" <ykkenmcd [at] gmail [dot] com" rel="nofollow">ykkenmcd [at] gmail [dot] com> wrote:
I am moving this from scala-user to scala-debate upon request. First, a bit of context (copied):
    However, as I've thought more about it, I've realized that what enterprises need is _controllable_ complexity. If you have 2,000 software engineers using Scala (which is what we all hope for, right?), then some of them _will_ use the most complex features because they think it's cool, regardless of corporate guidelines.
Next, to put this into my own personal perspective: Until recently, I dismissed arguments that Scala was too complex on the grounds that "you can always use as simply a more productive Java".
More recently, I have seen arguments that convinced me that a significant problems with Scala was that _the possibility of using it an an unduly complex manner restricted its corporate applicability_. I see this as a highly valid point. (Large) corporations need to expect that engineers are, to some degree, interchangeable. I think even Google must have that approach these days. It should be expected that an engineer can be dumped into another engineers' job and be able, int not too long, to pick up on what is going on.
I don't believe this is possible with "full Scala". For example, look at Tony M. and (in addition) scalaz. How many engineers could pick up on code engineered in that universe? Very, very few.
I know from experience that given enough people, developers who are completely incompetent in a technology will nonetheless use the extreme abilities of that technology. For example, I once spent several nasty months fixing the "code" of a "developer" who knew virtually nothing about C++, but who nonetheless decided she could overload operators at her discretion. Do you have any idea how difficult it is to understand code where "+"  means "accumulate into a queue"?
Given, than , I refer back to the (implicit question) of my original post: does it make sense to allow the enterprise to control the degree of complexity of Scala that is used? (I think it does)
I understand that such a topic may be part of the scala language discussions. If so, apologies, I have not seen it.
Ken
kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: Re: problems of scala complexity

On 2011-11-19 4:15 AM, Bernd Johannes wrote:
> Am Samstag, 19. November 2011, 02:09:24 schrieb Erik Engbrecht:
>> I'd phrase the question another way.
>>
>> Given a large organization that needs to maintain the ability to move
>> people between projects, and a language like Scala that allows for some
>> very diverse forms of expression, how does one keep the intersection of the
>> two from exploding?
>>
>> I'm not sure it's possible.
> While I dismiss the option to disable scala features I see the beauty in being
> able to "spot" "critical" sections somehow.

I very much agree.

> What I am missing currently is a survey giving some basic facts about what
> furthers understanding and what blocks understanding if someone is about to
> read some given section of code. "Critical" would be anything that makes it
> unecessarily hard to understand or follow a concept / solution that is
> implemented (the "what it does").
>
> That's not to be mixed with the complexity of a concept/solution in itself. If
> I don't understand the concept/solution (the "why") in itself I won't be able
> to figure out the meaning of code implementing that concept/solution in any
> language.
>
> Existing code metrics (for different languages) try to capture aspects of this
> "what it does" problem (and there has been some related research) - but I am
> not aware of any good code metrics for scala.
>
> If we had such code metrics we could tag the code and try to align metric
> signatures with "comprehension effort". This would give enterprises a valuable
> instrument to spot source parts which should be reworked.
>
> I think that would help...
>
> Greetings
> Bernd

I believe you are very much thinking in the right direction Bernd.

For millennium (is that the right word?) there has been the notion of
artisan masters and apprentices. Apprentices would study, train and work
under the supervision of the masters until they themselves would become
masters. Often the apprentices would do much or most of the real work,
but the masters would routinely inspect their work and intervene or
guide when necessary.

It can be difficult doing serious code reviews all the time to make sure
that novices get the guidance they need or that mavericks are reined in
when necessary. If we had tools that could help automate this sort of
review we could make it easier for the masters to check on the work of
the apprentices.

Cheers, Eric

kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: problems of scala complexity

On 2011-11-19 6:31 AM, martin odersky wrote:
> Some remarks:
>
> First, the thread and many like it seems too negatve to me. Scala is
> used in a large and growing number of enterprises, some of them with
> more than 100 devs working with it. These people just get on with the
> job (and love it for the most part); they don't find Scala's
> ``complexity'' too daunting.

You are very correct Martin, there have been many threads that
negatively criticize the complexity of Scala - and many have been
unproductive or counterproductive.

Sorry to read you see this thread as negative - I do not see it that way
at all. You are absolutely correct that many people are happy with Scala
just the way it is. What I believe this thread is attempting to do is to
constructively satisfy those people who do find Scala too daunting and
offer solutions to make it less daunting for them.

I do not believe this thread is designed to negatively criticize Scala
for being too complicated, I think many of us accept Scala for what it
is. The problems of Scala complexity should not always be problems to be
disputed, they should also be problems to embrace as challenges to
solve. I believe this thread is designed to find ways to safely include
those people, especially the undecided or cautious, into the community
and culture of Scala.

>
> Second, I believe we have come to realize that complexity and power
> are pretty much aligned for Scala.
> Take away the complexity and you take away the power. Here I mean
> power in the sense: "Number of concepts that you can describe
> precisely using your language". I want to get away from the common
> argument that all Turing complete languages are equivalent in power
> anyway.

One good step I have seen lately is moving the narrative away from
trying to reduce or take away the complexity of Scala or any of its
power. I really like the idea of tools to help us best use the language.
In the early days of C the compiler diagnostics were a joke, but someone
wrote lint and it helped many people make better use of C. These days I
am truly amazed at the quality of the diagnostics of the Java compilers
and the IDEs - these automated tools make Java even more accessible to
more programmers, and even less complex. I am often amazed at how well
Eclipse can guide me into proper use of Java or best practices.

If there are people who are smart enough to invent languages like Scala
- there are surely people smart enough to imagine, design and build
tools to make Scala more accessible to more people. If you are smart
enough and experienced enough to ride Scala 'bareback' so to speak, more
power to you, but it does not mean we cannot also invest in better
saddles and stirrups for the rest of us.

>
> Third, if you look at other languages, there is always a set of "best
> practices" developed that come with it and that are used as
> guidelines. Certainly Java has a rich culture of best practices. And
> that cultures changes over time, as developments in Java EE show.

No disagreement here.

>
> Since Scala's enterprise use is still young, best practices have still
> a some way to develop and stabilize.

Truly. As we go along can we not find some way to automate the support
of those best practices?

> This is your chance! If you put out some clean libraries with easy-to
> use APIs you have a great chance to influence the future best
> practices for Scala, as long as they are still in flux. I wish we'd
> concentrate more on these aspects than wringing our hands.

Clean libraries and APIs alone do not solve the problems. Also, I do not
see us wringing our hands any longer, I think this thread is actually
going somewhere productive and should be encouraged.

>
> Can best practices be influenced by tools, such as style checkers?
> Maybe. It's certainly something we want to pursue. But it would be
> silly to delegate responsibility for forming best practices to these
> tools only.

I totally agree. Airbus tried to over automate the cockpit and the
result was the autopilot overrode the real pilots and landed the
aircraft in a forest at an airshow. These days there is a lot of effort
to further automate things in the cockpit, but it is generally accepted
now that the human pilot is ultimately in charge. Rather than making
human pilots redundant, we try to make them better pilots.

I am advocating giving the software developers, senior software
developers and software architects the tools to monitor and assess the
code quality and complexity, and maybe event suggest better ways to do
things. I have found findbugs exceedingly useful on many occasions and
have even used it to analyze our code base and report back to our team
my concerns about some of the dicey practices I found in the code base.

Let's not limit Scala's power and promise by restricting features -
rather let's build tools to help us make better use of Scala.

>
> [Cross-posted to scala-user, because it relates to quite a few threads
> there as well]
>

kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: problems of scala complexity

On 2011-11-19 6:31 AM, martin odersky wrote:
> Some remarks:
>
> First, the thread and many like it seems too negatve to me. Scala is
> used in a large and growing number of enterprises, some of them with
> more than 100 devs working with it. These people just get on with the
> job (and love it for the most part); they don't find Scala's
> ``complexity'' too daunting.

You are very correct Martin, there have been many threads that
negatively criticize the complexity of Scala - and many have been
unproductive or counterproductive.

Sorry to read you see this thread as negative - I do not see it that way
at all. You are absolutely correct that many people are happy with Scala
just the way it is. What I believe this thread is attempting to do is to
constructively satisfy those people who do find Scala too daunting and
offer solutions to make it less daunting for them.

I do not believe this thread is designed to negatively criticize Scala
for being too complicated, I think many of us accept Scala for what it
is. The problems of Scala complexity should not always be problems to be
disputed, they should also be problems to embrace as challenges to
solve. I believe this thread is designed to find ways to safely include
those people, especially the undecided or cautious, into the community
and culture of Scala.

>
> Second, I believe we have come to realize that complexity and power
> are pretty much aligned for Scala.
> Take away the complexity and you take away the power. Here I mean
> power in the sense: "Number of concepts that you can describe
> precisely using your language". I want to get away from the common
> argument that all Turing complete languages are equivalent in power
> anyway.

One good step I have seen lately is moving the narrative away from
trying to reduce or take away the complexity of Scala or any of its
power. I really like the idea of tools to help us best use the language.
In the early days of C the compiler diagnostics were a joke, but someone
wrote lint and it helped many people make better use of C. These days I
am truly amazed at the quality of the diagnostics of the Java compilers
and the IDEs - these automated tools make Java even more accessible to
more programmers, and even less complex. I am often amazed at how well
Eclipse can guide me into proper use of Java or best practices.

If there are people who are smart enough to invent languages like Scala
- there are surely people smart enough to imagine, design and build
tools to make Scala more accessible to more people. If you are smart
enough and experienced enough to ride Scala 'bareback' so to speak, more
power to you, but it does not mean we cannot also invest in better
saddles and stirrups for the rest of us.

>
> Third, if you look at other languages, there is always a set of "best
> practices" developed that come with it and that are used as
> guidelines. Certainly Java has a rich culture of best practices. And
> that cultures changes over time, as developments in Java EE show.

No disagreement here.

>
> Since Scala's enterprise use is still young, best practices have still
> a some way to develop and stabilize.

Truly. As we go along can we not find some way to automate the support
of those best practices?

> This is your chance! If you put out some clean libraries with easy-to
> use APIs you have a great chance to influence the future best
> practices for Scala, as long as they are still in flux. I wish we'd
> concentrate more on these aspects than wringing our hands.

Clean libraries and APIs alone do not solve the problems. Also, I do not
see us wringing our hands any longer, I think this thread is actually
going somewhere productive and should be encouraged.

>
> Can best practices be influenced by tools, such as style checkers?
> Maybe. It's certainly something we want to pursue. But it would be
> silly to delegate responsibility for forming best practices to these
> tools only.

I totally agree. Airbus tried to over automate the cockpit and the
result was the autopilot overrode the real pilots and landed the
aircraft in a forest at an airshow. These days there is a lot of effort
to further automate things in the cockpit, but it is generally accepted
now that the human pilot is ultimately in charge. Rather than making
human pilots redundant, we try to make them better pilots.

I am advocating giving the software developers, senior software
developers and software architects the tools to monitor and assess the
code quality and complexity, and maybe event suggest better ways to do
things. I have found findbugs exceedingly useful on many occasions and
have even used it to analyze our code base and report back to our team
my concerns about some of the dicey practices I found in the code base.

Let's not limit Scala's power and promise by restricting features -
rather let's build tools to help us make better use of Scala.

>
> [Cross-posted to scala-user, because it relates to quite a few threads
> there as well]
>

Adam Jorgensen
Joined: 2011-04-17,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity
Ugh, all this debate about complexity. 

Weaker programmers will always find a way to hang themselves.
Nerfing Scala is not going to fix that.
Better to nerf the weak programmers than the language.
kolotyluk
Joined: 2010-06-04,
User offline. Last seen 5 weeks 15 hours ago.
Re: problems of scala complexity

I don't think we should be having a 'debate about complexity' - rather
we should be having a debate about 'what to do about complexity' (even
if it is only perceived as complex by some people).

...and (some) strong programmers will always find a way to give other
programmers more rope and cause to hang themselves.

We don't need to 'nerf' Scala (or anyone), we just need to give people
less experienced with Scala more tools to better deal with the Scala we
have now.

Cheers, Eric

On 2011-11-19 9:04 PM, Adam Jorgensen wrote:
> Ugh, all this debate about complexity.
>
> Weaker programmers will always find a way to hang themselves.
>
> Nerfing Scala is not going to fix that.
>
> Better to nerf the weak programmers than the language.

huynhjl 2
Joined: 2011-03-26,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

Hi Tony,

Recently while trying to answer this: https://twitter.com/#!/dibblego/status/130796120107532289

I looked at the code for MA(http://scalaz.github.com/scalaz/
scalaz-2.9.1-6.0.2/doc.sxr/scalaz/MA.scala.html)

I found that there is foldMap and foldMapDefault. The signature
difference between the two is the use of Foldable versus Traverse.
I've indirectly used Foldable and Traverse before, though I'm no
expert, I get a sense of what they can do.

Some testing showed that they yield the same result (on this
particular instance).

scala> val list = List(101,102, 103)
list: List[Int] = List(101, 102, 103)

scala> list.foldMap(i => (i, 1))
res1: (Int, Int) = (306,3)

scala> list.foldMapDefault(i => (i, 1))
res2: (Int, Int) = (306,3)

Why use one versus the other one? The signature doesn't tell me that
when it works on either case. It looks like most scala collections can
be lifted/converted into Traverse and Foldable. I then took a detour
and searched for foldMap and foldMapDefault and haskell. But that
didn't answer my question.

So I had to dig into what the code does, but for foldMapDefault it
wasn't obvious because I don't know what Const does (an enigmatic:
"Used to generate Phantom Applicative Functors and categories from a
Monoidal type A". Ok in restrospect it sorts of make sense but it's
hard, because Const is not informative as a name). Eventually I got a
sense of Const from http://scalaz.github.com/scalaz/scalaz-2.9.1-6.0.2/doc.sxr/scalaz/exampl...

But I feel that a bit of documentation like "use foldMap when abc over
foldMapDefault" or vice versa would be helpful and save time. Also
known issues like this could be documented as well:

scala> (1 to 10000).toList.foldMap(i => (i, 1))
res4: (Int, Int) = (50005000,10000)

scala> (1 to 10000).toList.foldMapDefault(i => (i, 1))
[stack overflows]

Overall, learning to use scalaz is challenging yet rewarding. But I
think that lack of documentation makes it harder than necessary.

--Jean-Laurent

On Nov 19, 6:02 pm, Tony Morris wrote:
> On Nov 20, 2011 7:49 AM, "Daniel Sobral" wrote:
>
[snip]
> > Yeah, well, most people expect documentation to be in English, not in
> > type declarations. In fact, most people consider type declarations to
> > be "source code", and define "documentation" to be "not source code".
>
> No they don't. You have a selection bias. So do I.
>
> Watch this. Most people are absolutely adamant that your statement is
> wrong. That's because it is. I was able to make this claim by restricting
> myself to people who understand the subject matter at hand. Of course they
> see your statement is wrong. To most people, it is bleedingly obvious!
>
> More seriously, I agree there are a lot of people who believe your
> statement. They are wrong. What now? Are you offering to join the agenda of
> educating those who seek it out? If not what? There are many people who
> have overcome this very exact hurdle; it's tough work though.
[snip]

Jesper Nordenberg
Joined: 2008-12-27,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

Eric Kolotyluk skrev 2011-11-20 04:16:
> However, as far as I am concerned C++ is now a dead language.

Well, the rest of the world don't agree with you. C++ is still a
commonly used language, and yet to be replaced in many areas. And with
C++11 coming around it's still evolving and improving.

I'm not saying C++ is a nice language to work with, far from it, but it
gets the job done.

> My point is, I do not want to see Scala end up where C++ is now - the
> mess that it is. At the time C++ was the state of the art and I even
> passionately advocated it for a while. What I truly hope for is that the
> Scala community learn from the mistakes that were made with C++ and try
> to avoid them. Many of the mistakes that were made with C++ were not
> even the language design per se, rather they were the immaturity of the
> culture and community that was using and then abusing C++.

Hmmm, kinda hard to control the entire community. I mean you can decide
what to put in the stdlib (and now the Typesafe stack), but you can't
control what developers will use your language for (and that's a good
thing IMO). If there is a language feature to use/abuse, developers will
do so.

Btw, what mistakes in the C++ world are you referring to?

> I feel this argument is reasonable as there are people with valid
> concerns about the complexity of Scala and it serves us all well to
> address those concerns constructively rather than dismiss or invalidate
> them. It may seem to you that some of us are catastrophizing C++, but to
> me C++ is a very real catastrophe of what happens when we ignore these
> very issues.

I don't see C++ as a catastrophe, it's a result of compromises (for
example C compatibility), some good ideas (for example generic
programming) and some bad ones (for example templates). Scala is quite
similar, but with less bad ideas :)

/Jesper Nordenberg

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: problems of scala complexity


On Sun, Nov 20, 2011 at 5:55 AM, Eric Kolotyluk <eric [dot] kolotyluk [at] gmail [dot] com> wrote:
On 2011-11-19 6:31 AM, martin odersky wrote:
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.

You are very correct Martin, there have been many threads that negatively criticize the complexity of Scala - and many have been unproductive or counterproductive.

Sorry to read you see this thread as negative - I do not see it that way at all. You are absolutely correct that many people are happy with Scala just the way it is. What I believe this thread is attempting to do is to constructively satisfy those people who do find Scala too daunting and offer solutions to make it less daunting for them.

I am absolutely for discussing the best way to make Scala more approachable for newcomers and large teams.  I just wanted to stress that we should not start with a too negative point of view of the status quo. Scala is already making nice progress among these groups. But of course we should search ways to help it further along.
Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.

One good step I have seen lately is moving the narrative away from trying to reduce or take away the complexity of Scala or any of its power. I really like the idea of tools to help us best use the language. In the early days of C the compiler diagnostics were a joke, but someone wrote lint and it helped many people make better use of C. These days I am truly amazed at the quality of the diagnostics of the Java compilers and the IDEs - these automated tools make Java even more accessible to more programmers, and even less complex. I am often amazed at how well Eclipse can guide me into proper use of Java or best practices.

If there are people who are smart enough to invent languages like Scala - there are surely people smart enough to imagine, design and build tools to make Scala more accessible to more people. If you are smart enough and experienced enough to ride Scala 'bareback' so to speak, more power to you, but it does not mean we cannot also invest in better saddles and stirrups for the rest of us.
On the small scale, I believe you are right. I am pretty confident these tools will come for Scala. But on the large scale, I do not see tools criticizing systems architecture just yet. 


Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.

No disagreement here.


Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.

Truly. As we go along can we not find some way to automate the support of those best practices?
Yes, but that's a second step. We need to develop them first!

This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.

Clean libraries and APIs alone do not solve the problems.

No, but they are important. Not so much from the user perspective but to set an example to others how code and APIs should be structured and formulated. For instance, you know one thing I have come to regret? That's having put /: and :\ as aliases for foldLeft and foldRight into collections. I thought I had good reasons to do so. In particular
  (zero /: xs) (op)
keeps the relative order of the zero and the list xs in the expansion of the fold:
  zero op x_1... op x_n 
Whereas 
  xs.foldLeft(zero)(op)
reverses them. And, if we talk just about this library, I still think these reasons are valid. But as an example for other libraries it was the wrong choice. It gave an implicit encouragement to use symbolic operators in libraries where they are not necessary. And, I think the current set of core libraries uses too many symbolic operators (and, to be clear, I am not talking about scalaz here, that's on a different planet altogether).  
Also, I do not see us wringing our hands any longer, I think this thread is actually going somewhere productive and should be encouraged.
That's great! 


Can best practices be influenced by tools, such as style checkers? Maybe. It's certainly something we want to pursue. But it would be silly to delegate responsibility for forming best practices to these tools only.

I totally agree. Airbus tried to over automate the cockpit and the result was the autopilot overrode the real pilots and landed the aircraft in a forest at an airshow. These days there is a lot of effort to further automate things in the cockpit, but it is generally accepted now that the human pilot is ultimately in charge. Rather than making human pilots redundant, we try to make them better pilots.

I am advocating giving the software developers, senior software developers and software architects the tools to monitor and assess the code quality and complexity, and maybe event suggest better ways to do things. I have found findbugs exceedingly useful on many occasions and have even used it to analyze our code base and report back to our team my concerns about some of the dicey practices I found in the code base.

Let's not limit Scala's power and promise by restricting features - rather let's build tools to help us make better use of Scala.

+100 here.
Cheers
 -- Martin
odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: problems of scala complexity


On Sun, Nov 20, 2011 at 5:55 AM, Eric Kolotyluk <eric [dot] kolotyluk [at] gmail [dot] com> wrote:
On 2011-11-19 6:31 AM, martin odersky wrote:
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.

You are very correct Martin, there have been many threads that negatively criticize the complexity of Scala - and many have been unproductive or counterproductive.

Sorry to read you see this thread as negative - I do not see it that way at all. You are absolutely correct that many people are happy with Scala just the way it is. What I believe this thread is attempting to do is to constructively satisfy those people who do find Scala too daunting and offer solutions to make it less daunting for them.

I am absolutely for discussing the best way to make Scala more approachable for newcomers and large teams.  I just wanted to stress that we should not start with a too negative point of view of the status quo. Scala is already making nice progress among these groups. But of course we should search ways to help it further along.
Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.

One good step I have seen lately is moving the narrative away from trying to reduce or take away the complexity of Scala or any of its power. I really like the idea of tools to help us best use the language. In the early days of C the compiler diagnostics were a joke, but someone wrote lint and it helped many people make better use of C. These days I am truly amazed at the quality of the diagnostics of the Java compilers and the IDEs - these automated tools make Java even more accessible to more programmers, and even less complex. I am often amazed at how well Eclipse can guide me into proper use of Java or best practices.

If there are people who are smart enough to invent languages like Scala - there are surely people smart enough to imagine, design and build tools to make Scala more accessible to more people. If you are smart enough and experienced enough to ride Scala 'bareback' so to speak, more power to you, but it does not mean we cannot also invest in better saddles and stirrups for the rest of us.
On the small scale, I believe you are right. I am pretty confident these tools will come for Scala. But on the large scale, I do not see tools criticizing systems architecture just yet. 


Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.

No disagreement here.


Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.

Truly. As we go along can we not find some way to automate the support of those best practices?
Yes, but that's a second step. We need to develop them first!

This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.

Clean libraries and APIs alone do not solve the problems.

No, but they are important. Not so much from the user perspective but to set an example to others how code and APIs should be structured and formulated. For instance, you know one thing I have come to regret? That's having put /: and :\ as aliases for foldLeft and foldRight into collections. I thought I had good reasons to do so. In particular
  (zero /: xs) (op)
keeps the relative order of the zero and the list xs in the expansion of the fold:
  zero op x_1... op x_n 
Whereas 
  xs.foldLeft(zero)(op)
reverses them. And, if we talk just about this library, I still think these reasons are valid. But as an example for other libraries it was the wrong choice. It gave an implicit encouragement to use symbolic operators in libraries where they are not necessary. And, I think the current set of core libraries uses too many symbolic operators (and, to be clear, I am not talking about scalaz here, that's on a different planet altogether).  
Also, I do not see us wringing our hands any longer, I think this thread is actually going somewhere productive and should be encouraged.
That's great! 


Can best practices be influenced by tools, such as style checkers? Maybe. It's certainly something we want to pursue. But it would be silly to delegate responsibility for forming best practices to these tools only.

I totally agree. Airbus tried to over automate the cockpit and the result was the autopilot overrode the real pilots and landed the aircraft in a forest at an airshow. These days there is a lot of effort to further automate things in the cockpit, but it is generally accepted now that the human pilot is ultimately in charge. Rather than making human pilots redundant, we try to make them better pilots.

I am advocating giving the software developers, senior software developers and software architects the tools to monitor and assess the code quality and complexity, and maybe event suggest better ways to do things. I have found findbugs exceedingly useful on many occasions and have even used it to analyze our code base and report back to our team my concerns about some of the dicey practices I found in the code base.

Let's not limit Scala's power and promise by restricting features - rather let's build tools to help us make better use of Scala.

+100 here.
Cheers
 -- Martin
ojow
Joined: 2009-10-21,
User offline. Last seen 37 weeks 3 days ago.
Re: problems of scala complexity

I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.- if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more- the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'- the only thing we need to bust the 'complexity' myth is good libraries/frameworks

ojow
Joined: 2009-10-21,
User offline. Last seen 37 weeks 3 days ago.
Re: problems of scala complexity

I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.- if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more- the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'- the only thing we need to bust the 'complexity' myth is good libraries/frameworks

Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: Re: problems of scala complexity
Oh absolutely!  It also doesn't help that many of our current "high profile" libraries are particularly heavy on symbolic method names.  Things are improving in at least two notable libraries though:
- Akka has culled its symbols down to essentially just ! and ?- scalaz is near the end of a rewrite that will make it far easier to use non-symbolic equivalents for many concepts

Specs2 uses more symbols that specs1, but they're tightly contained and well documented, so this isn't a great concern.  I'm not so convinced about the mixed identifiers (e.g. be_==), but it does offer alternative notations and I'm generally comfortable allowing slightly different rules to apply in a test framework.
Lift seems to be using ever more symbols and mixed identifiers (e.g. #> and unsafe_!), but the range of web frameworks now available for Scala means that developers have alternatives to chose from if they disagree with Lift's decisions.
Databinder Dispatch is one of the few libraries remaining that is still symbol-heavy, not moving towards a design with at least the *option* of fewer symbols, and doesn't really have a viable alternative (for example, nothing else I know of can offer OAuth support out of the box).  The saving grace of dispatch is that it uses a convention which is internally very consistent.  Usage of Dispatch is also likely to be constrained to just a small corner of any codebase.

On 20 November 2011 13:06, Oleg Galako <ojowoo [at] gmail [dot] com> wrote:
I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.- if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more - the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'- the only thing we need to bust the 'complexity' myth is good libraries/frameworks


Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: Re: problems of scala complexity
Oh absolutely!  It also doesn't help that many of our current "high profile" libraries are particularly heavy on symbolic method names.  Things are improving in at least two notable libraries though:
- Akka has culled its symbols down to essentially just ! and ?- scalaz is near the end of a rewrite that will make it far easier to use non-symbolic equivalents for many concepts

Specs2 uses more symbols that specs1, but they're tightly contained and well documented, so this isn't a great concern.  I'm not so convinced about the mixed identifiers (e.g. be_==), but it does offer alternative notations and I'm generally comfortable allowing slightly different rules to apply in a test framework.
Lift seems to be using ever more symbols and mixed identifiers (e.g. #> and unsafe_!), but the range of web frameworks now available for Scala means that developers have alternatives to chose from if they disagree with Lift's decisions.
Databinder Dispatch is one of the few libraries remaining that is still symbol-heavy, not moving towards a design with at least the *option* of fewer symbols, and doesn't really have a viable alternative (for example, nothing else I know of can offer OAuth support out of the box).  The saving grace of dispatch is that it uses a convention which is internally very consistent.  Usage of Dispatch is also likely to be constrained to just a small corner of any codebase.

On 20 November 2011 13:06, Oleg Galako <ojowoo [at] gmail [dot] com> wrote:
I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.- if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more - the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'- the only thing we need to bust the 'complexity' myth is good libraries/frameworks


Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: problems of scala complexity


On Nov 20, 2011 2:55 PM, "Kevin Wright" <kev [dot] lee [dot] wright [at] gmail [dot] com> wrote:
>
> Oh absolutely!  It also doesn't help that many of our current "high profile" libraries are particularly heavy on symbolic method names.  Things are improving in at least two notable libraries though:
>
> - Akka has culled its symbols down to essentially just ! and ?

Worth noting there is that both those methods have a nominal alternative (tell/ask)

> - scalaz is near the end of a rewrite that will make it far easier to use non-symbolic equivalents for many concepts
>
> Specs2 uses more symbols that specs1, but they're tightly contained and well documented, so this isn't a great concern.  I'm not so convinced about the mixed identifiers (e.g. be_==), but it does offer alternative notations and I'm generally comfortable allowing slightly different rules to apply in a test framework.
>
> Lift seems to be using ever more symbols and mixed identifiers (e.g. #> and unsafe_!), but the range of web frameworks now available for Scala means that developers have alternatives to chose from if they disagree with Lift's decisions.
>
> Databinder Dispatch is one of the few libraries remaining that is still symbol-heavy, not moving towards a design with at least the *option* of fewer symbols, and doesn't really have a viable alternative (for example, nothing else I know of can offer OAuth support out of the box).  The saving grace of dispatch is that it uses a convention which is internally very consistent.  Usage of Dispatch is also likely to be constrained to just a small corner of any codebase.
>
>
> On 20 November 2011 13:06, Oleg Galako <ojowoo [at] gmail [dot] com> wrote:
>>
>> I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.
>> - if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more
>> - the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'
>> - the only thing we need to bust the 'complexity' myth is good libraries/frameworks
>
>
>

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: problems of scala complexity


On Nov 20, 2011 2:55 PM, "Kevin Wright" <kev [dot] lee [dot] wright [at] gmail [dot] com> wrote:
>
> Oh absolutely!  It also doesn't help that many of our current "high profile" libraries are particularly heavy on symbolic method names.  Things are improving in at least two notable libraries though:
>
> - Akka has culled its symbols down to essentially just ! and ?

Worth noting there is that both those methods have a nominal alternative (tell/ask)

> - scalaz is near the end of a rewrite that will make it far easier to use non-symbolic equivalents for many concepts
>
> Specs2 uses more symbols that specs1, but they're tightly contained and well documented, so this isn't a great concern.  I'm not so convinced about the mixed identifiers (e.g. be_==), but it does offer alternative notations and I'm generally comfortable allowing slightly different rules to apply in a test framework.
>
> Lift seems to be using ever more symbols and mixed identifiers (e.g. #> and unsafe_!), but the range of web frameworks now available for Scala means that developers have alternatives to chose from if they disagree with Lift's decisions.
>
> Databinder Dispatch is one of the few libraries remaining that is still symbol-heavy, not moving towards a design with at least the *option* of fewer symbols, and doesn't really have a viable alternative (for example, nothing else I know of can offer OAuth support out of the box).  The saving grace of dispatch is that it uses a convention which is internally very consistent.  Usage of Dispatch is also likely to be constrained to just a small corner of any codebase.
>
>
> On 20 November 2011 13:06, Oleg Galako <ojowoo [at] gmail [dot] com> wrote:
>>
>> I've been using Scala for about 2 years (10 years of Java before that), and i've decided to post here just because of how absolutely precise (in my opinion) Martin's points are.
>> - if you just do your job with Scala instead of looking for reasons why it is complex or something like that, it just starts to work in your hands and you like it more and more
>> - the 'complexity' feeling is mostly the feeling of freedom from (or absence of) 'best practices'
>> - the only thing we need to bust the 'complexity' myth is good libraries/frameworks
>
>
>

Stefan Wagner
Joined: 2011-04-08,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 20.11.2011 11:20, schrieb martin odersky:

> That's having put /: and :\ as aliases for foldLeft and foldRight into
> collections. I thought I had good reasons to do so. In particular
>
> (zero /: xs) (op)
>
> keeps the relative order of the zero and the list xs in the expansion of
> the fold:
>
> zero op x_1... op x_n
>
> Whereas
>
> xs.foldLeft(zero)(op)
>
> reverses them.

I'm not very polyglott in programming languages, and my first
impression, when I saw them was OMG! I'll never get that! But soon I saw
a presentation on video - not sure by whom, which explained the /: as
part from a tree:

op /
/ \ /
op xs(1) / (xs (1))
/ \ /
init xs(0) / (xs (0))

(I hope it will survive the email layout.)

It was a very easy to remember and beautiful explanation, and to my own
surprise, I understood it very fast and learned it in half an hour.

In contrast, I don't know till today which of /: and :\ is 'foldLeft'
and which is foldRight. Okay - the shown example is 'foldLeft', which I
only remember indirectly, because in most cases I use /: and I realized,
most of the times, people use foldLeft, and that both match.

Another observation:
When I first stumbled over the arrow in C++: foo-> bar (x); it raised my
curiosity. After knowing, what it meant, and how to use it, it was a
pleasure to use something new which looked a little mysterious to
newbies. Yes - this is a little bit childish, but aren't we all a little
bit childish?
I guess it is a double-edged sword: it can attract curiosity, if you use
exotic constructs or method names, and it can distract the fearfull
(which shouldn't mean that I am courageous) or more conservative people.

Simon Ochsenreither
Joined: 2011-07-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity
Folding is not always an acceptable choice performance-wise. Look at the disaster of folding in Range#sum for example.
runaro
Joined: 2009-11-13,
User offline. Last seen 32 weeks 2 days ago.
Re: problems of scala complexity
"I seem to recall recently someone suggested some sort of switches to control which language features could be enabled."

That sounds pretty complex.

Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity
No, but they are important. Not so much from the user perspective but to set an example to others how code and APIs should be structured and formulated. For instance, you know one thing I have come to regret? That's having put /: and :\ as aliases for foldLeft and foldRight into collections. I thought I had good reasons to do so. In particular
  (zero /: xs) (op)
keeps the relative order of the zero and the list xs in the expansion of the fold:
  zero op x_1... op x_n 
Whereas 
  xs.foldLeft(zero)(op)
reverses them. And, if we talk just about this library, I still think these reasons are valid. But as an example for other libraries it was the wrong choice. It gave an implicit encouragement to use symbolic operators in libraries where they are not necessary. And, I think the current set of core libraries uses too many symbolic operators (and, to be clear, I am not talking about scalaz here, that's on a different planet altogether).  
Don't feel bad about this Martin. I always use :\ and /:, though I'm nowhere near a power user. Why? Because I known that ":" is the "binding side", which lets me identify the "terminal case", which lets me figure  out how to assemble everything. (Yes, I always have to go through this mental process--not brilliant like the rest of you :-) ). In contrast, I can _never_ remember the correct arg order for foldLeft and foldRight. I really don't find those names meaninful at all.
Ken
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity
No, but they are important. Not so much from the user perspective but to set an example to others how code and APIs should be structured and formulated. For instance, you know one thing I have come to regret? That's having put /: and :\ as aliases for foldLeft and foldRight into collections. I thought I had good reasons to do so. In particular
  (zero /: xs) (op)
keeps the relative order of the zero and the list xs in the expansion of the fold:
  zero op x_1... op x_n 
Whereas 
  xs.foldLeft(zero)(op)
reverses them. And, if we talk just about this library, I still think these reasons are valid. But as an example for other libraries it was the wrong choice. It gave an implicit encouragement to use symbolic operators in libraries where they are not necessary. And, I think the current set of core libraries uses too many symbolic operators (and, to be clear, I am not talking about scalaz here, that's on a different planet altogether).  
Don't feel bad about this Martin. I always use :\ and /:, though I'm nowhere near a power user. Why? Because I known that ":" is the "binding side", which lets me identify the "terminal case", which lets me figure  out how to assemble everything. (Yes, I always have to go through this mental process--not brilliant like the rest of you :-) ). In contrast, I can _never_ remember the correct arg order for foldLeft and foldRight. I really don't find those names meaninful at all.
Ken
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity

>
> - Akka has culled its symbols down to essentially just ! and ?

Worth noting there is that both those methods have a nominal alternative (tell/ask)


As someone who has used (and written :-( ) APIs that attempt to satisfy everyone by providing multiple symbols for the same operation, I disagree rather strongly with this approach. IMHO, Akka should have gone with "tell" and "show". Alternatively, if they had gone with "!" and "?", I would have been less happy, but would not consider it a significant problem since these symbols will be omnipresent in Akka-based code, so the the cost of learning them is very low compared to their utility.
But providing both unnecessarily increases the amount of info a programmer must know, and more importantly, raises that prospect that a programmer who has used Akka in a "consistent" environment might encounter the other usage occasionally and be temporarily stymied by it.
It's not a huge issue, this is not horrible design. But I thing in the net, it's negative.

Ken
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: problems of scala complexity

>
> - Akka has culled its symbols down to essentially just ! and ?

Worth noting there is that both those methods have a nominal alternative (tell/ask)


As someone who has used (and written :-( ) APIs that attempt to satisfy everyone by providing multiple symbols for the same operation, I disagree rather strongly with this approach. IMHO, Akka should have gone with "tell" and "show". Alternatively, if they had gone with "!" and "?", I would have been less happy, but would not consider it a significant problem since these symbols will be omnipresent in Akka-based code, so the the cost of learning them is very low compared to their utility.
But providing both unnecessarily increases the amount of info a programmer must know, and more importantly, raises that prospect that a programmer who has used Akka in a "consistent" environment might encounter the other usage occasionally and be temporarily stymied by it.
It's not a huge issue, this is not horrible design. But I thing in the net, it's negative.

Ken
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

On Saturday, November 19, 2011 8:31:19 AM UTC-6, martin odersky wrote:
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.
 I had started my threads after seeing several comments from enterprise origins concerned about the complexity of Scala, and almost simultaneously encountering some of these problems myself. But this is all anecdotal, admittedly. Is there any way of polling enterprise sites to find out what their concerns _really_ are? 

Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.
 Turing equivalency was always a Straw Man. However, some of the power of Scala does end requiring some quite sophisticated mechanics--for example, "CanBuildFrom" and implicit params. "implicit" isn't difficult to understand, but its implications are, and it doesn't take much of a need to go beyond basic use of collections to run into those implications. 
Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.
 Because Java is _so much_ less expressive than Scala, its best practices will have been much easier to formulate, I believe. 

Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.
This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.
 I will echo a commenter I read ahead to--APIs are the smallest and easiest part. I believe my "rex" api (https://github.com/KenMcDonald/rex) for dealing with regular expressions in a higher-level manner is pretty clean--but that was easy because I really didn't exercise Scala features. The real challenge lies in such things as:    1) How to make complex type sigs readable. (I say make type params readable words, Tony M. says opposite. Obviously I'm right :-), but seriously, what is "best practice" here?)    2) When/how to use implicit params? (I don't even have a clue)    3) When to use highly abstract functionals, vs. more verbose but more concrete "lower-level" calls.
I could probably think of several more _major_ issues. The points are, these don't even exist in the Java universe, and they are not easy to answer. Developing "best practices" for Scala is going to be _much_ harder than for Java.
Cheers,Ken 
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: problems of scala complexity

On Saturday, November 19, 2011 8:31:19 AM UTC-6, martin odersky wrote:
Some remarks:

First, the thread and many like it seems too negatve to me. Scala is used in a large and growing number of enterprises, some of them with more than 100 devs working with it. These people just get on with the job (and love it for the most part); they don't find Scala's ``complexity'' too daunting.
 I had started my threads after seeing several comments from enterprise origins concerned about the complexity of Scala, and almost simultaneously encountering some of these problems myself. But this is all anecdotal, admittedly. Is there any way of polling enterprise sites to find out what their concerns _really_ are? 

Second, I believe we have come to realize that complexity and power are pretty much aligned for Scala.
Take away the complexity and you take away the power. Here I mean power in the sense: "Number of concepts that you can describe precisely using your language". I want to get away from the common argument that all Turing complete languages are equivalent in power anyway.
 Turing equivalency was always a Straw Man. However, some of the power of Scala does end requiring some quite sophisticated mechanics--for example, "CanBuildFrom" and implicit params. "implicit" isn't difficult to understand, but its implications are, and it doesn't take much of a need to go beyond basic use of collections to run into those implications. 
Third, if you look at other languages, there is always a set of "best practices" developed that come with it and that are used as guidelines. Certainly Java has a rich culture of best practices. And that cultures changes over time, as developments in Java EE show.
 Because Java is _so much_ less expressive than Scala, its best practices will have been much easier to formulate, I believe. 

Since Scala's enterprise use is still young, best practices have still a some way to develop and stabilize.
This is your chance! If you put out some clean libraries with easy-to use APIs you have a great chance to influence the future best practices for Scala, as long as they are still in flux. I wish we'd concentrate more on these aspects than wringing our hands.
 I will echo a commenter I read ahead to--APIs are the smallest and easiest part. I believe my "rex" api (https://github.com/KenMcDonald/rex) for dealing with regular expressions in a higher-level manner is pretty clean--but that was easy because I really didn't exercise Scala features. The real challenge lies in such things as:    1) How to make complex type sigs readable. (I say make type params readable words, Tony M. says opposite. Obviously I'm right :-), but seriously, what is "best practice" here?)    2) When/how to use implicit params? (I don't even have a clue)    3) When to use highly abstract functionals, vs. more verbose but more concrete "lower-level" calls.
I could probably think of several more _major_ issues. The points are, these don't even exist in the Java universe, and they are not easy to answer. Developing "best practices" for Scala is going to be _much_ harder than for Java.
Cheers,Ken 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland