Live data from Hacker News

Scala Considered Harmful For Large Projects?

kirkwylie.blogspot.com

31–40 of 57 posts

Re: Scala Considered Harmful For Large Projects?

#31
post #22

Earlier quoted context omitted.

No code is readable right off the bat. I mean you need to see it (meaning look at it in your editor), piece it together in your brain, and then place it in the context of the rest of the code. Of course, that doesn't sound like a big deal, but it adds up. Some code might be readable more quickly but again, it's about tradeoffs. To take an extreme example, suppose the "instantly" readable method results in 10000 lines…

If your code isn't readable right off the bat, you're doing it wrong. At one place I worked I had a BA who was nosey and came and tried looking over my shoulder at one point at some file manipulation code I'd written. Now I used to put a lot of time and effort into writing nice neat code, but this was something for me alone, so I hadn't bothered putting in the comments that I normally would. Anyway, because I wanted…

I think there's a confusion of micro- and macro-readability in this thread. You are describing micro-readability, IMO. I've read lots of code where it was clear what each line of code did, but not at all clear what the end result was, or why it was being done.

Furthermore, there's dramatic disagreement about what is actually more readable. I have an ongoing debate with a coworker about the relative readability of

    widgets.each |w|
      return true if w.can_frobnicate?
    end
    return false
vs

    widgets.any?(&:can_frobnicate?)
He insists he can read the first faster and more easily than the second. My contention is that he isn't actually reading the first, but performing a visual pattern match and guessing what it does. I've actually found examples where this seemingly-trivial idiom is implemented incorrectly, which I think supports that claim.

At any rate, though, as long as readability is subjective, I think all the rest of this debate is in question.

Re: Scala Considered Harmful For Large Projects?

#32
post #29

I know everyone loves their high powered languages, but I'm afraid the author is right. The more developers, the more conformity you need. I'm doing a personal project in OCaml, and I absolutely love it. I like to think it keeps my medium size code base from ever turning into a large code base. But Ocaml has so many features that two programmers can write in such different styles that it might as well be a different…

The more developers, the more conformity you need.

If you need a language to enforce coding standards, you have some big problems in your group!

Re: Scala Considered Harmful For Large Projects?

#33
post #15

I really disagree with the author in terms of metaprogramming. One thing in particular jumps out at me: > Ultimately, a programming language that's useful for large-scale programming projects needs to have clear, unambiguous grammar and syntax so that any developer familiar with the project and the language can instantly figure out what's going on. Wow. There are just so many things wrong with this statement. Let me…

Regarding 1, there are languages that do not have a clear, unambiguous (to my reading, formalized ) grammar yet possess compilers. Examples include classical FORTRAN, Forth and (if I'm feeling particularly trollish today) C++.

In fact, the list of languages with formalized syntax and grammar is a very short one. I'm thinking of languages like Haskell and ML.

Re: Scala Considered Harmful For Large Projects?

#34

Earlier quoted context omitted.

But I think this argument with respect to Java is flawed anyway, or was for a long time. EJB 3 and JPA is enormously much better, but back in the bad old days of J2EE you had these 'no go areas' anyway. You kind of slapped a couple of interfaces down, and then hoped that the magic code generator of the App Server would do the right thing (if configured properly). How is that any different from having a "if you don't…

I'm no fan of the language myself, but you're going overboard to try to dig a reason to trash Java out of this.

??? I'm not trashing Java. Did you read the article? I was making an analogy between the risk of having a language like Scala, which would mean there was stuff the Java-only people would not understand (which is what the article claims), with the black box auto-generated code produced by early J2EE (which is similarly a no-fly zone).

Believe me, you'll know when I'm trashing Java, because I'll use the g word.

Re: Scala Considered Harmful For Large Projects?

#35

Earlier quoted context omitted.

If your code isn't readable right off the bat, you're doing it wrong. At one place I worked I had a BA who was nosey and came and tried looking over my shoulder at one point at some file manipulation code I'd written. Now I used to put a lot of time and effort into writing nice neat code, but this was something for me alone, so I hadn't bothered putting in the comments that I normally would. Anyway, because I wanted…

I think there's a confusion of micro- and macro-readability in this thread. You are describing micro-readability, IMO. I've read lots of code where it was clear what each line of code did, but not at all clear what the end result was, or why it was being done. Furthermore, there's dramatic disagreement about what is actually more readable. I have an ongoing debate with a coworker about the relative readability of wid…

"You are describing micro-readability, IMO. I've read lots of code where it was clear what each line of code did, but not at all clear what the end result was, or why it was being done."

No. Unless you consider chunks of 90-100 lines of code to be micro, in which case I think your point is irrelevant, you have effectively defined the terms of the debate such that you've argued yourself right out of it. Also, your terms are silly, if looking at 100 lines of code is micro, what is macro? Looking at 10,000 lines of code simultaneously? you must have a very generous boss to have bought you such a large monitor!!!

The test of readability which I administered was at the unit level, not the individual line of code level.

I think you make a good minor point about why. The why is incredibly important. This is something that people who say they don't bother with comments because comments get out of date blah blah blah get wrong. A comment is not there to say what you are doing, a comment is there to say why you are doing it, or what you want to achieve. Also, comments should be kept up to date. It costs practically nothing to slip in a:

// bugfix for bug #127; forgot to snorgle the barr

just above your change

Re: Scala Considered Harmful For Large Projects?

#36
post #19
post #5

Earlier quoted context omitted.

Well, take a look at this sample ( http://dispatch.databinder.net/Common_Tasks ) and see if you can figure out what all those operators do just by looking at them :) Thats the kind of abuse possible with languages such as Scala, Haskell or c++ templates.

Take a look at this sample ( http://static.springsource.org/spring/docs/2.5.x/api/org/spr... ) and see if you can figure out how to use these classes just by looking at them. That's the kind of abuse possible with languages such as Java. --- Seriously. Every new API that you intend to use has a learning curve, some more significant than others. Every new API is a new "language".

It's not really a fair objection. AOP isn't part of Java, it is an ugly hack that someone bolted onto the outsides of it.

Seriously. You write your Java code, you compile it, and then in the night the evil AOP pixies sneak in and slip chunks of bytecode into your compiled classes.

Re: Scala Considered Harmful For Large Projects?

#37
post #28
post #17

I'm learning Scala now and am impressed by its difficulty. Not since I learned C++ in college have I needed to spend the same amount of time and effort learning a language, and the arguments given here against Scala are exactly the arguments you hear against C++. That's heartening to me. C++ is a great language for people who 1) know the language, and 2) use it sensibly (which often means humbly.) There's all kinds o…

I used Boost Spirit in my dissertation project for the parsing: https://github.com/scotts/cellgen/blob/master/src/cellgen_gr... I would not choose it again. With what I wanted to do, the performance was poor. Spirit just had to deep-copy the parse tree it was generating way too much. I liked having all of my source in C++, which meant not having to embed C++ in ANTLR or yacc. But I'm not sure that was worth it. Perha…

Is there a reason you didn't just handcode a recursive descent parser?

Re: Scala Considered Harmful For Large Projects?

#38
post #28

Earlier quoted context omitted.

I used Boost Spirit in my dissertation project for the parsing: https://github.com/scotts/cellgen/blob/master/src/cellgen_gr... I would not choose it again. With what I wanted to do, the performance was poor. Spirit just had to deep-copy the parse tree it was generating way too much. I liked having all of my source in C++, which meant not having to embed C++ in ANTLR or yacc. But I'm not sure that was worth it. Perha…

Is there a reason you didn't just handcode a recursive descent parser?

Yes. It's a waste of time. Why should I hand-code a parser for C when it's a solved problem? Note that the source code I linked to calls into an already existing Spirit grammar for C (which I made some modifications to, mainly so I could get more information back from the parse tree).

Hand coding a parser is generally not a good use of your time. There are many tools available to generate a parser based on a BNF grammar. I used my project as an opportunity to learn one of them.

Re: Scala Considered Harmful For Large Projects?

#39
post #17

I'm learning Scala now and am impressed by its difficulty. Not since I learned C++ in college have I needed to spend the same amount of time and effort learning a language, and the arguments given here against Scala are exactly the arguments you hear against C++. That's heartening to me. C++ is a great language for people who 1) know the language, and 2) use it sensibly (which often means humbly.) There's all kinds o…

One of my CS professors made the remark that C++ seemed like it had been designed by people who thought that there was a tax on keyboard symbols. So rather than using new symbols that were on a standard keyboard but not part of the language already, they just reused the old symbols either as is or in strange new combinations. When I look at Scala it gives me that same feeling. Additionally, they seem to come from the…

I don't see any symbols on my keyboard that weren't already used in C except @ and ` (backtick.)

P.S. I forgot about $.

Re: Scala Considered Harmful For Large Projects?

#40

Earlier quoted context omitted.

The obvious comeback being large Java projects considered harmful.

Obvious but not worthwhile, as the issue isn't Java, it's multiple languages on a project.

Well more to the point, single large monolithic projects are best avoided in general. The only reason Java is brought into it is that codebases in Java tend to get pretty big before they do anything useful.
Post reply on HN