News for hackers. Stuff that matters.
Re:Scala use is less good than Java use for at least half of... by wiredfool on Tuesday September 06, 2011 @07:30PM (#2967705)
<blockquote>"We live in a world where the average developer writes 3,250 lines of code per year (about 20 per day). This is going into Eclipse, pressing the "give me pattern X" and filling in the blanks, then going to a few meeting and calling it a day.</blockquote>

Maybe I'm out of the loop, but is it really this bad out there in the real world?

Re:Scala use is less good than Java use for at least half of... by freshhawk on Tuesday September 06, 2011 @10:04PM (#2968045)
Absolutely.

I took some high paying contractor gigs through an agency a few years ago because I wanted to figure out what direction to take in the next phase of my career, the cash was great and I'd never worked in the fortune 500 / government contractor kind of space before.

I wasn't that surprised when I got told that I was now their second developer (out of a few dozen) who "actually writes code in his free time sometimes! isn't that crazy!" since I was prepared for big company suit world.

The reality was right in line with the quote, if not worse.

Re:Scala use is less good than Java use for at least half of... by fadzlan on Wednesday September 07, 2011 @08:05AM (#2969220)
This kinda remind me of a lunch that I have with an old friend. I was asking him (he works at a fairly large company) if he knows anybody who learns or codes stuff that is outside of their working area, and his answer is, possibly in the whole building that he works, there isn't another one.

Myself being a optimist, I don't believe that statement, there is probably someone. It has to be. Then again it could just be my wishful thinking.

Re:Scala use is less good than Java use for at least half of... by freshhawk on Wednesday September 07, 2011 @09:56PM (#2972299)
I've started to think that it is wishful thinking. That was a big realization from that experience, that my echo chamber of programming sites and blogs and friends was not representative of programmers as a whole at all.

I also saw the appeal of that side of the industry. These guys all had way more varied hobbies and family lives since the programming stuff is "just my job" and had a good stable career path because any motivation we in the hacker news crowd would spend on learning new cool stuff they spend on jockying for position in the big office social/political world.

The lure of the office drone never got me though, it was too obvious to me that you are just selling the best part of your day for most of the week during the best part of your life only for money, since the actual hours are spent doing something you are marginally competent at and find uninspiring.

Re:Scala use is less good than Java use for at least half of... by barrkel on Tuesday September 06, 2011 @08:54PM (#2967899)
Yes. In one particular business domain: much of the time is spent nailing down requirements, then adjusting very complex conditionals (so much of the business-spec requirements will be almost legalese nests of conditional clauses - in the insurance domain I have in mind, written by actuaries), tweaking UI, and fairly exhaustive testing.
Re:Scala use is less good than Java use for at least half of... by crenshaw on Tuesday September 06, 2011 @07:36PM (#2967718)
I think that's an exaggeration. In the real world you spend a week trying to track down a nasty bug -- the net result is two new lines of code in a week. Or writing a bunch of new tests or creating a new test harness. Or designing new features. Or figuring out a way to rearchitect your code to add a new feature in a way such that any new similar features don't require code change at all.

I thought we had gotten past LoC as a measure of programmer productivity?

Re:Scala use is less good than Java use for at least half of... by outworlder on Tuesday September 06, 2011 @09:32PM (#2967970)
We have. But we still have to write something, don't we?
Re:Scala use is less good than Java use for at least half of... by michaelochurch on Tuesday September 06, 2011 @11:55PM (#2968278)
Sure, but there's an order of magnitude difference in average difficulty (at least) per LoC in legacy maintenance vs. green-field development, and most software jobs are in the former camp. It's true that 20-40 LoC/day is a fast clip in most of the software industry; it's not true that this results from laziness or too many meetings.

Hacker News gives us a rose-colored view of the software industry-- one in which knowing about functional programming and agile methodologies (regardless of whether one intends to use them) is a prerequisite for being considered literate, and in which 200 line-per-day development on new invention is something people can actually get paid for. That's now how the average developer experiences software.

Re:Scala use is less good than Java use for at least half of... by SoftwareMaven on Wednesday September 07, 2011 @12:36AM (#2968380)
If what you are measuring doesn't give you data you can really make decisions with, it is worse than no data. You'll be tempted to make a decision because you have that data.

BTW, this is one of my startup rules: measure what's important. Decide what's important by how it would affect your decision-making.

Re:Scala use is less good than Java use for at least half of... by outworlder on Tuesday September 06, 2011 @09:31PM (#2967969)
Yes.

However, that depends on who you ask. Specifically, try banks (and other financial institutions), Fortune 500 companies (exclude the more tech savvy such as Google, Microsoft as the code that does get written is meaningful), and anywhere that is infested with suits.

And, by the way: I believe that, out of the 20, 15 are XML.

Re:Scala use is less good than Java use for at least half of... by super_mario on Tuesday September 06, 2011 @07:45PM (#2967740)
That has not been my experience. I just wrote a script to compute my stats for the last 10 years. I did roughly 20,000 lines of code per year (this is not counting comments and empty lines, if that is included then this goes up to 35,000 lines). Oh, and I prefer VIM to Eclipse :D.

But using LOC as a measure of work quality or suitability for learning another language is really ludicrous. I would really hope that most people in the industry and Java programmers in particular are capable of learning Scala. I like to think that suitability of the language for a task is a quality of a language not the programmer. Yes, all languages in use are Turing complete, but some are better suited for certain tasks. The question we should be asking is what kinds of projects Scala excels at, and what kinds of applications is it really good for?

Re:Scala use is less good than Java use for at least half of... by outworlder on Tuesday September 06, 2011 @09:35PM (#2967976)
> Oh, and I prefer VIM to Eclipse

And yet think you are part of the group mentioned by the article?

Re:Scala use is less good than Java use for at least half of... by michaelochurch on Tuesday September 06, 2011 @11:49PM (#2968267)
It's not about meetings, incompetence, or lax work hours. It's the reality of software maintenance.

Lines of code is an awful metric of productivity but, yes, that figure of 3250 is accurate. Between 1,000 and 10,000 LoC per year is normal for a software engineer in the industry, and the rate is often closer to the lower number.

Note also that code of average architectural quality will require about 1 maintenance day per year per 80 LoC just by virtue (vice?) of existing. (Paul Graham: a full-time maintenance engineer can own 20,000 lines of code.) LoC are a cost: if we rate a developer's time (including benefits, office space, etc.) at $80/hour and charge each LoC for 4 years, we pay $32 per line of code in maintenance. (We spend $2-3 per line to write it.) That is, IMO, a pretty accurate estimate of what we pay for software.

If you write at 500 LoC/day under ideal circumstances but you're writing code that's merely average in architectural integrity, the maintenance problem will catch up with you very quickly.

It's a lot better to write 150 lines per day of great code (200-300 including unit tests and debugging utilities) and maintain that pace than to start out at 500+ but stall out late in the project. Great programmers don't write code at college-project speeds; they write in such a way that they can sustain triple-digits in perpetuity.

A single developer solves this problem by refactoring the code when necessary and incrementally improving the architecture so as to reduce the maintenance cost. It's only by doing this that projects beyond about 15,000 lines of code per person (75% maintenance burden if code is of average quality) are even feasible.

It's not just a problem of incompetent developers. Maintenance imposes a 70 to 90% overhead on most important projects in large companies, just because these projects become difficult or impossible to refactor and fix and their "broken windows" patterns of decline take on a life of their own. Individual developers can refactor aggressively when their maintenance burden breaks 50% (70% being a crisis) but this is not usually feasible for multi-developer enterprise projects that have changed hands several times.

The more progressive large companies now actively discourage any mention of LoC in performance reviews. First, deleting unnecessary code is one of the best things a person can do for a code base. Second, if someone in a big company generates 250 LoC/day reliably over years, it doesn't always mean that person is a great programmer; it could mean that, or it could mean that he's always taking the fun, "green field" projects and passing the legacy maintenance (on which 10 LoC/day is a typical clip) to others.

Re:Scala use is less good than Java use for at least half of... by vorg on Wednesday September 07, 2011 @12:09AM (#2968318)
> Second, if someone in a big company generates 250 LoC/day reliably over years, it doesn't always mean that person is a great programmer; it could mean that, or it could mean that he's always taking the fun, "green field" projects and passing the legacy maintenance (on which 10 LoC/day is a typical clip) to others.

This is what I call the Dirty Little Secret of Corporate IT shops: The mediocre programmers spin a story and slag off others to get the jobs developing new systems or rewrites in new technology to pad their CV; the programmers with aptitude end up in maintenance roles digging deep through the said code to fix all the bugs afterwards and make that software usable, while the mediocre programmers who wrote it are already in their next jobs doing it again.

Re:Scala use is less good than Java use for at least half of... by gaius on Wednesday September 07, 2011 @04:38AM (#2968809)
I absolutely agree with this. One of my more flighty cow-orkers sent round this link yesterday - calling maintenance programmers "the residue". Yeah, him and his mates have been talking non stop about how shit systems X, Y and Z are, how they could do so much better etc. Meanwhile, that system, that I maintain is paying all of our salaries. And those boys have produced something approximating... sod all. While getting paid by the revenues generated by that old code.

http://brucefwebster.com/2008/04/11/the-wetware-crisis-the-d...

Re:Scala use is less good than Java use for at least half of... by bartwe on Wednesday September 07, 2011 @09:47AM (#2969468)
Inversely I have had experiences with maintenance coders going like mercenaries into code i wrote and without respect for architecture or future extensions making changes because they didn't understand the code and we're not interested in the concepts behind it.
Re:Scala use is less good than Java use for at least half of... by gruseom on Wednesday September 07, 2011 @12:27PM (#2970142)
going like mercenaries into code i wrote and without respect for architecture or future extensions making changes because they didn't understand the code and we're not interested in the concepts behind it

This is a problem even when the maintenance programmer is not a mercenary. Check out the essay by Peter Naur (the N in BNF) called "Programming as Theory Building". It's one of the best things ever written about software (albeit in disappointingly bloodless language) and explains this masterfully. http://alistair.cockburn.us/ASD+book+extract%3A+%22Naur,+Ehn...

The essential point is that source code and documentation, no matter how well-written and extensive, are insufficient for understanding a large system. You have to have the "theory" (the article explains what this means) and for this you have to have someone who knows the theory.

Re:Scala use is less good than Java use for at least half of... by Flow on Wednesday September 07, 2011 @11:05AM (#2969778)
I've been afraid of this too.

I wrote a system in C# that used immutable data and actually used that to do rollbacks when evaluating a scenario failed. My fears was that since there are no "val" and really bad immutable collections in C#+.Net the maintenance coder would probably remove list.AsReadOnly() and putting in public on setters as part of fixes to bugs.

That didn't happen though, the maintenance guy was really smart and got the ideas without me explaining much more than mentioning immutability.

But this is why languages like Scala are important. Immutability and similar design(patterns) are a result of discipline and sometimes convention in languages like Java and C#. It's bound to fail due to humans being humans.

Re:Scala use is less good than Java use for at least half of... by geraldalewis on Wednesday September 07, 2011 @01:27AM (#2968474)
Why would ones ability to "spin stories and slag off others" be exclusive to their programming ability? I almost want to argue that they're demonstrating some form of communication skills, which may translate to more readable/maintainable code? ... Maybe that's a stretch.
Re:Scala use is less good than Java use for at least half of... by chipsy on Wednesday September 07, 2011 @02:11AM (#2968579)
There are people who hustle for the business, and people who hustle only for themselves. We're talking about the latter.
Re:Scala use is less good than Java use for at least half of... by SomeCallMeTim on Wednesday September 07, 2011 @01:51AM (#2968537)
I wrote and maintained most of a (2d) video game library over the course of four years. Almost entirely by myself. I just looked, and it comes to something like 80000 lines of code.

So you're saying I was maintaining code that was ultimately enough for four full-time maintenance engineers while developing two games as lead, supporting other developers to put together nearly 100 games based on that library (I was also externally-facing support), AND designing and implementing the beginning of the next revision of the library)?

And people also raved about my support, to the point where it felt like I had a fan club. Maybe the bar is just that much higher in video game development; I'm certainly not even the most efficient developer I know.

I did refactor the code from time to time, though there were a lot of games based on this library by the end that I couldn't risk breaking, so I couldn't change the public API. Mostly I just wrote it to be solid the first time around. It was the fourth or fifth time I'd written a similar game library; after a while you get the hang of it, you know? Not to say there were never bugs, but they were (almost) always easy to find and fix, since the architecture was solid.

My only point really is that rules of thumb like the one about 20k lines of code per maintenance engineer can be off by an order of magnitude or more, if you've got the right code and the right developer. I'd estimate that no more than about 40% of my time at the end was taken up by maintenance, and it was probably more like 25%. And a lot of my "maintenance" time was spent fixing bugs in other developers' games that they just couldn't find, and that weren't in my code at all.

Re:Scala use is less good than Java use for at least half of... by gaius on Wednesday September 07, 2011 @05:37AM (#2968929)
Working on other people's code has a much higher overhead. Before you can make any change, you have to understand how it interacts with the rest of it. It's not unrealistic to spend days studying it, then minutes changing it. Then you move on to yet another unfamiliar codebase - and by the time you get back to the first, months have passed, you've forgotten all about it, and other people have been changing it too so you need to relearn it.

This is why when I interview people who say they've been programming since they were 10, I don't really care - because the experience of working on your own code is radically different from working on an existing codebase.

Re:Scala use is less good than Java use for at least half of... by SomeCallMeTim on Thursday September 08, 2011 @02:12PM (#2974983)
Yeah, fixing other people's code takes longer, most of the time. I did frequently have to fix bugs in other people's game code, though I've done games long enough that usually I would know how to dig and find the issue pretty quickly.

It didn't typically take more than a day or two to find such bugs, even if the original developer (working on their own code) had tried to find it for weeks and had given up. I could always come in with fresh eyes, and I know most of the ways that people write games, good and bad. In one case I had their "intractable" bug fixed in less than a half hour, having never seen their code before.

So I think I'd probably still pass that interview question, though I'm not looking for a job right now. ;)

Re:Scala use is less good than Java use for at least half of... by wladimir on Wednesday September 07, 2011 @07:09AM (#2969119)
That's overly harsh. Having long-time programming experience does help, also in understanding other people's code faster. It's almost impossible to be programming since your 10th and never been confronted with other people's code in one way or another. Either through open source collaboration, reverse engineering, or even studying/improving example code.

(also it means that they are pretty fanatical programmers thus that they're self-motivated)

Re:Scala use is less good than Java use for at least half of... by michaelochurch on Wednesday September 07, 2011 @10:38AM (#2969631)
My only point really is that rules of thumb like the one about 20k lines of code per maintenance engineer can be off by an order of magnitude or more, if you've got the right code and the right developer.

Yes. Absolutely. That number applies to average code and there are obviously ways to push it out if a person cares (which you did, since it was your project and 4 years of your life were on the line). For example, unit tests add LoC but improve code health.

Re:Scala use is less good than Java use for at least half of... by SomeCallMeTim on Thursday September 08, 2011 @02:27PM (#2975044)
I didn't think to add in the LoC from tests...that's about another 8k lines, if that matters.

Game code is...notoriously hard to unit test. We had some functional (?) tests that would do complete screen renders and check the resulting bitmap against a "correct" result, though that was mostly for verifying the code worked correctly on all target platforms, and some unit tests for classes like the string class that were relatively easy to create useful tests for, but far from complete coverage. Most HN developers would probably consider the coverage pathetic, I'd guess, and I rarely even ran the tests (they were mostly for QA).

I've actually never seen anyone create unit tests for actual game code. I've heard about it being done, but it's a rare exception rather than the rule. The religion of "Test First" hasn't really caught on in game development.

Most of the "business logic" (so to speak) changes so fast as you're developing a game it that creating unit tests to verify it doesn't make sense. Also, a lot of the behaviors are "fuzzy" or visual, and unit tests can't tell you if the results feel right -- for that you just have to play the game. Some of the more structural parts of a game's code could COULD stand to be tested, but in general it's not considered to be valuable enough to offset the cost.

Re:Scala use is less good than Java use for at least half of... by barnaby on Wednesday September 07, 2011 @01:58AM (#2968553)
Agreed. My net total for LOC written in the past year is probably -700, because I've refactored so much verbose code.

I don't know how to count unit tests in such a metric though... because I took a code base from 2% code coverage to 70% and that meant writing something like 200 LOC in unit tests alone per day, even though the actual code being refactored under these tests diminished in size.

Re:Scala use is less good than Java use for at least half of... by bartwe on Wednesday September 07, 2011 @09:48AM (#2969471)
I'd count the unittest code too, it needs to be maintained too.
Re:Scala use is less good than Java use for at least half of... by esrauch on Wednesday September 07, 2011 @10:30AM (#2969601)
It's easier to maintain unit tests if you write unit unit tests for them.
Re:Scala use is less good than Java use for at least half of... by sirclueless on Wednesday September 07, 2011 @11:17AM (#2969849)
You laugh, but if someone accidentally shipped some code in their unit test library that made assertEqual(1, 2) always return true I might be a very unhappy camper.
Re:Scala use is less good than Java use for at least half of... by fadzlan on Wednesday September 07, 2011 @08:00AM (#2969209)
Well, this does not address one of his core argument, which is basically coding for average Java developer is just one small part from his/her day activity.

Especially in the case of maintenance of existing legacy system, where most of the activity resolves around understanding existing code, writing is just a small part of it. If maintaining the system needs to be financially feasible, hiring expensive Scala developer may not be the best idea to maintain the system. Unless of course, using Scala outweights the benefits of using Java even with the potential financial cost.

Re:Scala use is less good than Java use for at least half of... by silon on Wednesday September 07, 2011 @04:27AM (#2968792)
Note also that code of average architectural quality will require about 1 maintenance day per year per 80 LoC just by virtue (vice?) of existing. (Paul Graham: a full-time maintenance engineer can own 20,000 lines of code.)

This is true in my personal observation. I mostly wrote two pieces of software rougly 50,000 lines each, and it's my limit of manageability. Will need splitting up and modularizing if it needs to get larger.

Re:Scala use is less good than Java use for at least half of... by vorg on Tuesday September 06, 2011 @11:58PM (#2968287)
When the programmers in these places take over the hiring process, they actively keep out anyone who can code better than average to protect their jobs. Many banks and insurance companies IT shops fall into this category.
Re:Scala use is less good than Java use for at least half of... by eengbrec on Tuesday September 06, 2011 @08:08PM (#2967795)
I would say in many places it is, but the numbers are often misleading. I'm not completely familiar with how we count it, but I believe when we count ELOCs (Effective Lines of Code) not only is the time people spend writing code counted, or even all the time spent by people who write code, but all the time by people spend on the "software engineering" portion of the project. That can include managers, requirements development, configuration managers, system administrators, QA, the people who collect metrics, etc.

So the number is really more reflective of how much an organization lumps under "software engineering" and how much general overhead its processes incur than it is of the productivity of individual programmers.

Re:Scala use is less good than Java use for at least half of... by srparish on Tuesday September 06, 2011 @08:01PM (#2967773)
Assuming lines of code is a valid argument, all the more reason to make sure those lines are doing as much as possible.