News for hackers. Stuff that matters.
Re:Paul Graham on Spaghetti Code by nnq on Thursday April 18, 2013 @11:48PM (#5574678)
I haven't read the book and dunno about PG's definition of spaghetti code, but "we can make all these types of modifications without even looking at the rest of the code" sounds like the opposite of what all people I know call sc. I thought that a necessary property of spaghetti code is that almost everything is connected in a way so you can't make a change by only changing something in one place because everything is connected in weird ways because of the lack of structure, so you need to keep the whole program in your head while working on it.

Isn't the whole point of well structured programs to be able to work on them while holding as little of the program in your head as possible, so you can work on part of it and be able to "make all these types of modifications without even looking at the rest of the code"? If you have a program that can "evolve" successfully without the need for anyone to "hold it in its head", then a large team can work on it and you can usually replace a 10x programmer with a swarm of 1x ones, basically a pointy haired boss's wet dream...

Re:Paul Graham on Spaghetti Code by laureny on Friday April 19, 2013 @12:28AM (#5574822)
> I haven't read the book and dunno about PG's definition of spaghetti code, but "we can make all these types of modifications without even looking at the rest of the code" sounds like the opposite of what all people I know call sc.

That was exactly my thought as well, I had to reread the part twice to make sure. This is the definition of maintainable (or maybe even well-designed) code when all its parts are carefully isolated.

Re:Paul Graham on Spaghetti Code by hmbg on Friday April 19, 2013 @02:07AM (#5575141)
I think the point is that writing code on isolated parts without thinking about the overall purpose and architecture of the program leads to bloat, repeated functionality and diverging paradigms/conventions in the same codebase. I agree that's not the traditional definition of spaghetti code, but it's a problem in many large software projects.

Adding that together, well designed code is the foundation of really bad code. That could explain a lot.

Re:Paul Graham on Spaghetti Code by brudgers on Friday April 19, 2013 @08:33AM (#5576252)
The quotation is nearly twenty years old. For context that's before Java [practically speaking] and before C++ was standardized - and when programmers of Graham's age had a background using PEEK and POKE and GOTO in BASIC or exposure to assembly and the older programmers had often seen plugboards in use.

I won't guess at Graham's definition today. He can speak for himself, anyway. But it resonated with me in the context of Rich Hickey's ideas - particularly "Are We There Yet?" http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hic...

As I understand it, an issue with [some] object systems is that when objects are made by aggregation, rather than inheritance, they are of a different type than each of their components. And this requires the programmer to write some code [however minimal] for the new type in order to reimplement any desirable feature of the objects from which it is composed.

In other words, the behavior of an aggregate of objects is undefined. Hickey's comparison is to data. Which he claims aggregates into more data. When, I ask myself "what is data?" lisp-a-cadabra - it's code. Which is the [structuralist] way in which I read Graham's note.

Re:Paul Graham on Spaghetti Code by michaelochurch on Thursday April 18, 2013 @11:59PM (#5574716)
If you have a program that can "evolve" successfully without the need for anyone to "hold it in its head", then a large team can work on it and you can usually replace a 10x programmer with a swarm of 1x ones, basically a pointy haired boss's wet dream...

Why is that the PHB's wet dream? I mean, by observation I agree with you. That is the case, so I am not challengingyou on that. But what could be the underlying reason, seeing as 10x programmers are only 1.5-3.0x as expensive?

It seems like PHBs shoot themselves in the foot, repeatedly, without mercy.

Re:Paul Graham on Spaghetti Code by gnaritas on Friday April 19, 2013 @12:09AM (#5574761)
PHB's tend to measure themselves by how many people they're in charge of; better 10 guys than 1 that's productive as 10. PHB's aren't entrepreneur types, they're middle managers who require underlying to justify their existence, the more the better.
Re:Paul Graham on Spaghetti Code by michaelochurch on Friday April 19, 2013 @12:18AM (#5574793)
That's been my feeling about it, too. Headcount and control rather than actual productivity. Also, I feel like middle managers have a terrible incentive profile. If an underling really shines, then it reflects well on the underling. If one underperforms or makes a mess, boss gets shat on for not keeping them in line. It's easy to rip on middle managers, but they have a shitty job and it's not their fault. It's just structured badly.

I think it's easier to understand why middle managers are the way they are once one understands their incentive structure. They participate in an employee's downside but not upside (she did it herself) so of course they're going to be the way they are.

I may be radical but I think open allocation is the only answer for software development. All the nonsensical process that grows up around closed allocation seems archaic and stifling. I think typical middle management is useless. What you really need are HR-independent mentors. Aside from mentoring, the other thing managers can do (firing) should be so rare in a well-run company that you only need one per few hundred people.

Re:Paul Graham on Spaghetti Code by gingerlime on Friday April 19, 2013 @04:00AM (#5575442)
I recommend reading about the Gervais principle![1]

[1]http://www.ribbonfarm.com/2009/10/07/the-gervais-principle-o...

Re:Paul Graham on Spaghetti Code by dpritchett on Friday April 19, 2013 @09:39AM (#5576551)
When Michael read about the Gervais principle it inspired about 100,000 words of response: http://michaelochurch.wordpress.com/?s=gervais&submit=Se...
Re:Paul Graham on Spaghetti Code by gingerlime on Friday April 19, 2013 @02:36PM (#5578035)
thanks for the link!
Re:Paul Graham on Spaghetti Code by michaelochurch on Friday April 19, 2013 @09:51AM (#5576615)
If you have the time, you might want to check out my blog. I've covered that topic in exacting detail.
Re:Paul Graham on Spaghetti Code by gingerlime on Friday April 19, 2013 @02:35PM (#5578031)
just had a quick look and am as excited reading this as checking out more espisodes of 'the office'! (I only started watching the american version recently. Originally I dismissed it as just another copy-cat of the original UK, but I'm beginning to get into it).

I didn't read any of it yet, but just the thought of having more to read about it makes my life already better :)

EDIT: I just realised who I was "recommending" this too. Well, at least it was worth it for me :)

Re:Paul Graham on Spaghetti Code by enupten on Friday April 19, 2013 @12:23AM (#5574804)
.. brought to you by her Majesty's Civil service. http://en.wikipedia.org/wiki/Yes_Minister
Re:Paul Graham on Spaghetti Code by vorg on Friday April 19, 2013 @05:59AM (#5575769)
The ten 1x programmers tend to turn against the 10x programmer before he/she has time to manifest, to protect their own 10 jobs.
Re:Paul Graham on Spaghetti Code by michaelochurch on Friday April 19, 2013 @09:47AM (#5576597)
Very fucking true. Also dangerous is the 2.5x who thinks he's a 10x, convinces management of this, and then drives out everyone better.

(For my part, I'm only a 6-8x. I'm fairly new to software and I also spend too much fucking time on activism.)

Re:Paul Graham on Spaghetti Code by geon on Friday April 19, 2013 @01:33AM (#5575068)
They would also have trouble identifying the 10x programmer to begin with, and with the pointy haired-ness have trouble retaining them.
Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @04:32AM (#5575519)
It is trivial to identify a 10x programmer.

Take any project (or platform) that uses quirky and individualistic style, preferably written in an obscure language. Any programmer that has been working with such a project for a year or two, would be a 5x programmer. Any programmer that has actually started that project would be a 10x programmer. Why? Because an amount of effort that any developer, unfamiliar with an obscure approach has to spend is 50x.

Re:Paul Graham on Spaghetti Code by geon on Friday April 19, 2013 @04:34AM (#5575527)
So a 10x programmer is one who writes crappy code? I think you have your definition backwards.
Re:Paul Graham on Spaghetti Code by coldtea on Friday April 19, 2013 @05:05AM (#5575614)
>One who writes quirky and individualistic code. Not crappy. It could be well organized. And even good. And even solve the problem, at the time when it was written. But. If that code is approachable by any regular developer, when the original programmer would not be 10x. And management and peers wouldn't think about the original developer as 10x.

Nope, still got it backwards.

The characteristic of a 10X programmer is how FAST he can write GOOD code that solves a particular problem. Neither individualistic, nor quirky. He doesn't even have to read Ayn Rand.

If it's not code that his 1x coworkers can understand, then he's not 10X, just show-offish and hackish.

To give some examples: Dennis Ritchie and Brian Kernighan. Linus Torvalds. Poul-Henning Kamp. Zed Shaw. Notch. John Carmack.

All of those are/were very much 10X programmers. But no obscure languages and nothing quirky and particularly individualistic about their code.

I think you have mixed the notion of the 10X programmer with the notion of the "cowboy coder" (with traces of crazy genius, e.g the autonomous, quirky, Lisp/Haskell/J/whatever yielding programmer who completes some huge project in his own peculiar way in a short amount of time).

Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @05:32AM (#5575683)
The problem is, that the consensus about a particular developer in a particular project -- to call that developer "10x, 1x 0.1x" -- is a consensus of peers and management.

And peers almost always lack the information to make the objective call. If they'd had that information, they wouldn't have called that developer a 10x. And that's one of the reasons, why you never see normal people calling themselves 10x, by the way.

Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @04:58AM (#5575589)
One who writes quirky and individualistic code. Not crappy. It could be well organized. And even good. And even solve the problem, at the time when it was written.

But. If that code is approachable by any regular developer, when the original programmer would not be 10x. And management and peers wouldn't think about the original developer as 10x.

But if, the code is quirky and individualistic... a funny thing happens. Suddenly whoever works (or can rise up and work with that code for whatever reason) is 10x. And peers and management would see them as 10x.

I've seen that quite a number of times. Many times as 10x, as 1x and even a few as 0.1x.

Re:Paul Graham on Spaghetti Code by geon on Friday April 19, 2013 @05:16AM (#5575641)
Good code is dead simple to read and understand. That is what makes it good, because sooner or later, someone will need to read it and maintain it.

Getting to that point is difficult, and may require a 10x programmer. But the end result is simplicity.

Re:Paul Graham on Spaghetti Code by klibertp on Friday April 19, 2013 @09:31AM (#5576520)
I think you misunderstand grand-parent. Once again I will use a quicksort example - we all know quicksort, even if not iterative, then surely recursive version, right? Ok, so here goes quicksort implementation that is dead simple and easy to read:

    quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)
It's in J. Someone who wrote this has much higher chance of being 10x than someone who implemented the same algorithm in Python. That's all I think grandparent wanted to say and if so then I agree completely.
Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @09:14PM (#5579417)
Someone who wrote this has much higher chance of being called 10x by peers and management. And someone who has to support that code has much higher chance of being called 0.1x by pears and management.
Re:Paul Graham on Spaghetti Code by yen223 on Friday April 19, 2013 @12:30AM (#5574832)
Risk management.

Assuming the PHB can hire 10 junior devs or 1 senior dev at the same cost:

If you have 10 junior devs and 1 decides to quit, the PHB can swap him out fairly easily - he just has to wait for graduation day.

If you have 1 senior dev and he decides to quit, the PHB's hands are severely tied, especially if the company is located in a place where talent is lacking.

This is also the reason why mainstream languages will likely remain popular forever in the enterprise world - no one wants to take a chance on a language that only 5% of devs know.

Re:Paul Graham on Spaghetti Code by eru on Friday April 19, 2013 @01:15AM (#5575008)
> This is also the reason why mainstream languages will likely remain popular forever in the enterprise world - no one wants to take a chance on a language that only 5% of devs know.

Unless they have a legacy system. Or what percentage of developers know Cobol these days?

Re:Paul Graham on Spaghetti Code by kyllo on Friday April 19, 2013 @01:40AM (#5575080)
They're not taking a chance on a language only 5% of devs know, precisely because they know how painful it is to be chained to a legacy system. So they do every new project in the industry standard language, which is Java.

Problem is, the industry standard used to be COBOL. Sooner or later, if/when Java falls out of vogue and stops evolving, they will end up with two legacy systems instead of just one.

Re:Paul Graham on Spaghetti Code by dagw on Friday April 19, 2013 @02:33AM (#5575216)
I can't find the link right now, but I saw an ad from a technical school here in Sweden only a couple of weeks ago advertising their new 1 year Cobol developer program.
Re:Paul Graham on Spaghetti Code by yen223 on Friday April 19, 2013 @02:53AM (#5575256)
I'm not surprised. Over here in Malaysia, almost all banks still run a COBOL backend.
Re:Paul Graham on Spaghetti Code by dagw on Friday April 19, 2013 @05:03AM (#5575606)
Yea I remember the ad listing a number of large Swedish banks and insurance companies that still use COBOL as an argument for why you should learn COBOL and why it would be easy to get a job afterwards.
Re:Paul Graham on Spaghetti Code by flyinRyan on Friday April 19, 2013 @11:26AM (#5577134)
This is a good point, but it serves to point out what others are not bringing up. The truth is, managers know programmers aren't cogs and can never be. How could they not? The issue is that their managers believe or really want to believe that programmers are cogs, so the lower manager can cut all experienced programmers and replace them with the cheapest labor they can find. What shows up in the short term is a cost savings, and therefor probably a promotion. Yes, since these new programmers don't know the system it's destined for failure, but who cares? By the time that happens the PHB will be in a new position and no longer responsible for this mess they made.

The true plague or our industry and everyone else's is short term thinking, and I don't see how it could be fixed at this point.

Re:Paul Graham on Spaghetti Code by justanotherbody on Friday April 19, 2013 @02:14AM (#5575159)
You've just proven the point. Commit to the popular language because finding maintainers in X years will be that much easier
Re:Paul Graham on Spaghetti Code by nnq on Friday April 19, 2013 @04:38AM (#5575539)
I think people are not as rational as they seem and it's basically a form of power hunger - PHBs feel more powerful when the distance between them and their employees is larger: one feels much more powerful having 10 people well below him than having 1 person a little below him, and 10x programmers that also have social skills in a company where IT matters will have a say in lots of things, even not IT related and even if not in a direct way, so they end up closer to the PHB on the power scale than each of the 10 1x ones, which is a bad feeling... Now if the 10x is totally lacking in social skills and introvert, that's ok for the PHB, but if lacking in social skills and more of an extrovert, it's bad again, because although he wouldn't have a say in things because he's "the smart asshole", he'll make everyone, including the PHB, feel and look stupid (and they probably will be 20 iq point below him and they'll know it and feel somewhat demoralized by him).

Basically the 10x guy is uncomfortable for all guys above him (not only in software but in any other field that has a 10x skill gradient) that lack self-control, self-knowledge and people skills (what's called "being wise"), and most PHBs are "very not wise".

Re:Paul Graham on Spaghetti Code by rizzom5000 on Friday April 19, 2013 @12:31AM (#5574834)
But what could be the underlying reason, seeing as 10x programmers are only 1.5-3.0x as expensive?

I'd venture that it's because something like less than x% of all programmers are elite; where x is some number between 5 and 10.

In this case, if you are PHB and have a budget of y for staff (where y <= average) and time variable of z (where z <= average) for a release date - it would appear that you are an incompetent PHB if you believe you can hire an elite programmer to solve your problem(s).

Re:Paul Graham on Spaghetti Code by yummyfajitas on Friday April 19, 2013 @07:01AM (#5575921)
Why is that the PHB's wet dream?

Because it makes the business more failure tolerant. Finding even one 10x guy is tough - many teams will have only 1 or 2 of them, and a swarm of 1x guys.

If the 10x guy is on vacation, quits, or has something more important to do, you can throw one of the 1x guys at it.

You don't need nefarious "I hate the 10x cause I'm a psychopathic PHB" motives to explain this one.

Re:Paul Graham on Spaghetti Code by flyinRyan on Friday April 19, 2013 @10:58AM (#5576975)
You're absolutely right. This is what is meant by spaghetti code; everything is connected and you can't tell what is connected to what until you start pulling things out.

I've only worked on one or two code bases that were truly spaghetti code and I replaced them both completely in short order.

Re:Paul Graham on Spaghetti Code by Ensorceled on Thursday April 18, 2013 @11:39PM (#5574645)

    "The object-oriented model makes it easy to build up programs by accretion."
On a similar note that object-oriented model makes it easy to write code when you don't understand the problem yet. "I know I'll need a Patient and a Doctor and a Diagnosis ..." Soon you have all these pretty objects and interfaces and Patient and Doctor inherit from Person and ...

I've seen people with literally dozens of objects who still had no idea what they were building or why and couldn’t answer basic questions about the problem domain.

Re:Paul Graham on Spaghetti Code by michaelochurch on Thursday April 18, 2013 @11:51PM (#5574688)
Alan Kay's idea of OOP-- encapsulate complexity behind a simple interface, and separate the two while preferring stability in the latter-- was utterly sound and right. He wasn't saying, "go off and write opaque, complicated objects". He was talking about what to do when complexity becomes inevitable.

The SQL database (a brilliant, wonderful thing despite the hatred it gets) is an example. When you write a query, you don't tell it which indexes to hit and how to micromanage details. You send a declarative query to this "black box" that, most of the time, does the right thing.

I think Objects are a good thing, but they should be rare. Very rare. As with macros, only use them when the simpler tools (referentially transparent functions, immutable data) won't do. Files are a case where the object metaphor makes sense-- there's a bunch of tightly-wound connected state, and I/O is inherently stateful.

The problem with "OOP" is that it's "programming as micromanaging, inept businessmen understand it". Instead of math, it's Factories and Visitors and other nonsensical "big picture" bullshit that doesn't map in any coherent, reliable way to the underlying substrate (mathematics, logic) of computation. I'm sorry, but programming is a game where if one doesn't understand the details, one doesn't understand the fucking big picture (which is made up of extremely important details).

Re:Paul Graham on Spaghetti Code by _sh on Friday April 19, 2013 @12:48AM (#5574891)
Files are a case where the object metaphor makes sense-- there's a bunch of tightly-wound connected state, and I/O is inherently stateful.

And user interface widget libraries, which are all about I/O. Even Racket's widget toolkit leverages the superb racket/class encapsulation mechanism.

Re:Paul Graham on Spaghetti Code by tikhonj on Friday April 19, 2013 @03:34AM (#5575381)
For UI code, you should check out functional reactive programming (FRP). It essentially provides first class time-varying values instead of implicitly modelling time with mutable state.

This makes UI code more declarative and allows you to create things like neat combinators. As an example, it's very easy to write a function like `when' with FRP, which could be used like this (code roughly from a game of life app I wrote):

    when (not <$> paused) (step <$ time)
Here `time' is just a stream of events every x milliseconds. So what this code does is create a stream of step events which represent stepping the life simulation forward at each time step, as long as the game isn't paused. `paused' is a value based on a button, but it could easily have multiple inputs.

So you get signals and event streams like `paused' and `time' from UI widgets (or the system), and then combine them into new streams that you can plug directly into UI widgets. This then lets the widgets themselves be much simpler structures with not internal state. In essence, this replaces arbitrary mutable state with an explicit dependence on time which leaves less room for making mistakes while also making it easier to write high-level functions like `when'.

There's a ton of other cool things you can do--this is just an example meant to illustrate the sort of abstractions you can use; it is by no means exhaustive!

I've found that FRP leads to much nicer UI code than callback-based OOP.

Re:Paul Graham on Spaghetti Code by michaelochurch on Friday April 19, 2013 @09:45AM (#5576588)
FRP seems deeply awesome. Thanks for explaining it.
Re:Paul Graham on Spaghetti Code by eru on Friday April 19, 2013 @01:17AM (#5575014)
We get by without OOP in the widget library (creatively called Widget) we use for a Haskell-flavoured language at work.
Re:Paul Graham on Spaghetti Code by flyinRyan on Friday April 19, 2013 @11:33AM (#5577170)
>the superb racket/class encapsulation mechanism.

Superb? The racket class system strikes me as awful/embarrassing. The language at least looks functional in nature, but to do OO they implemented this ridiculous single dispatch mechanism (manually calling "send" no less!). Why on earth didn't Racket end up with a CLOS like system? They could have made anything they wanted, and yet they ended up with a system that will require people to write the Visitor pattern. Shocking.

Re:Paul Graham on Spaghetti Code by _sh on Friday April 19, 2013 @07:42PM (#5579224)
Although it looks impoverished, it's really just a foundation for developing your own abstractions, and syntactic sugar goes a long way (I've bound the Alt-> key to → and use it for 'send').

CLOS-like systems can be built on structs with the racket/generic module and Typed Racket makes multimethods trivial.

Re:Paul Graham on Spaghetti Code by alipang on Friday April 19, 2013 @04:10AM (#5575472)
The SQL database (a brilliant, wonderful thing despite the hatred it gets) is an example. When you write a query, you don't tell it which indexes to hit and how to micromanage details. You send a declarative query to this "black box" that, most of the time, does the right thing.

That sounds very much to me like 'A SQL database is an abstraction', and very little like 'A SQL database is somehow related to OO'. In facts it's really unnatural to map objects to relations, which is why you need yet another ORM abstraction on top of it, just to satisfy the OO silver bullet.

Re:Paul Graham on Spaghetti Code by Ensorceled on Friday April 19, 2013 @07:52AM (#5576083)

   "Alan Kay's idea of OOP-- encapsulate complexity behind a simple interface, and separate the two while preferring stability in the latter-- was utterly sound and right. He wasn't saying, "go off and write opaque, complicated objects". He was talking about what to do when complexity becomes inevitable."
I agree completely, I was only pointing out another problem with OOP (or, if you will, OOP done poorly) is that it leads to the trap I mention.
Re:Paul Graham on Spaghetti Code by praptak on Friday April 19, 2013 @03:29AM (#5575365)
I know a company that used to ask in all seriousness "How would you model a car in an OO way?" during interviews, with the expected answer along the lines of Car, Engine, four instances of Wheel and so on. My friend totally stumped the interviewer asking him about the purpose of the modeling. You know, this revolutionary idea that a DMV might model a car slightly differently than a car mechanic.

Late nineties, good times, OO was the silver bullet back then :)

Re:Paul Graham on Spaghetti Code by Ensorceled on Friday April 19, 2013 @08:08AM (#5576138)
Yeah, I was asked to model a graphics program in an interview and got into a argument about why circles should not be a subclass of ellipse. I explained that, yes, mathematically it's a degenerate case, but in a graphics package circles have different algorithms and different user interfaces. They actually have more in common with squares than ellipses.

After about 10 minutes of no progress, I suddenly realized I would be working with and for idiots so I excused myself from the rest of the process.

Re:Paul Graham on Spaghetti Code by praptak on Friday April 19, 2013 @08:26AM (#5576225)
Yeah, Liskov Substitution Principle. I believe that (mutable) circle and (mutable) ellipse is the chief example of the bad kind of inheritance wrt to this rule.
Re:Paul Graham on Spaghetti Code by vsync on Friday April 19, 2013 @12:05PM (#5577328)
I'm reminded of Pirsig's comments on the multiple ways you could break down a motorcycle, for example.

The tyranny of the dominant decomposition is no joke, especially when single inheritance and single dispatch are so popular.

Re:Paul Graham on Spaghetti Code by mcmire on Thursday April 18, 2013 @11:46PM (#5574670)
I've never understood these sorts of statements. You can write spaghetti code in a functional language too. Instead of objects floating around, you have functions. Instead of objects interacting with each other in various ways, you have functions interacting with each other in various ways. You can "build programs by accretion" in any language. Ultimately it all comes down to complexity. Simple code is simple, complex code is complex. You're not going to magically get around this by switching to a functional language. Right?
Re:Paul Graham on Spaghetti Code by wtetzner on Friday April 19, 2013 @12:15AM (#5574782)
Well, if you're really programming in a function way, then you're not using side effects (or at least, the side effects are constrained). That means things are local, and you can safely compose functions without causing the behavior of other parts of the program to change.
Re:Paul Graham on Spaghetti Code by bdamm on Friday April 19, 2013 @01:52AM (#5575113)
Spoken like a true academic.
Re:Paul Graham on Spaghetti Code by tikhonj on Friday April 19, 2013 @03:04AM (#5575296)
Or, you know, a software engineer. Good software engineers, after all, value things like low coupling; composability is like a stronger version of low coupling. (That is, composable things are not tightly coupled but decoupled things are not necessarily composable.)
Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @04:01AM (#5575445)
Good software engineers certainly value low couplings. Unless it is a coupling with some code written in an obscure language with extreme (and masochistic) approach and with no common sense.
Re:Paul Graham on Spaghetti Code by kenbot on Friday April 19, 2013 @05:59AM (#5575767)
I'm not at all sure what your point is. There's nothing controversial about the benefits of referential transparency and immutable state, for modularity, composition and simplicity. What is obscure to you? It won't be to everyone.
Re:Paul Graham on Spaghetti Code by ozataman on Friday April 19, 2013 @01:23AM (#5575033)
The biggest thing in this regard a language like Haskell has going for it is purity, and therefore the concept of "no global state" taken to an extreme. Add to that referential transparency (which is a highly related concept anyway) and you get pretty strong "equational reasoning" where it is quite easy to trace, accurately, what's happening in a chain of calls - it's all transformation of data structures passing through.

If by "functional language" you mean JavaScript, then that's a completely different matter... :-)

Re:Paul Graham on Spaghetti Code by dchichkov on Friday April 19, 2013 @03:39AM (#5575399)
Whatever you do, don't let some baby with a hammer to take some abstract and high concepts to the extreme, ruin your project and learn from it. Not in your project.

In the production code, stay with the mainstream. And limit your extreme approaches to research grade code, with limited lifetime.

Re:Paul Graham on Spaghetti Code by ozataman on Saturday April 20, 2013 @07:19PM (#5583203)
We use Haskell in mission critical production code at my company and we are very happy with it. So do many banks in their pricing models and many other areas of application.

This may mean that we can't just go hire your average programmer, but we have also had a bizarrely low rate of bugs in production despite a high level of inherent complexity in what we do.

Re:Paul Graham on Spaghetti Code by dchichkov on Sunday April 21, 2013 @12:07AM (#5583810)
Based on what I've seen, codebases, that use non-mainstream languages and technologies have a tendency to fracture into parts written in a mix of languages and disappear in the rubble.

So let's wait a few years, and see, shall we?

(It's not that I don't like, or don't use shiny 'new' toys. It's just that in the long run it really really helps to use these toys only in the 'research grade' code. Depending on anything even a tiny bit out of industry mainstream in your key production code is a huge liability few years down the line.)

Re:Paul Graham on Spaghetti Code by unoti on Friday April 19, 2013 @12:09AM (#5574758)
Where I come from, we derisively called this "Lasagna code." It's not tangled like spaghetti, but there are many, many layers.
Re:Paul Graham on Spaghetti Code by btilly on Friday April 19, 2013 @01:27AM (#5575053)
See http://www.paulgraham.com/noop.html for an essay from Paul Graham about a dozen years ago that expanded on the dislike that he had then for OO code.

I do not fully agree with his opinion there, but he certainly has some valid points.

Re:Paul Graham on Spaghetti Code by mynameishere on Thursday April 18, 2013 @11:45PM (#5574667)
This has a specific name.

http://c2.com/cgi/wiki?RavioliCode

Re:Paul Graham on Spaghetti Code by Osiris on Thursday April 18, 2013 @11:46PM (#5574669)
* What this often means, in practice, is that it provides a structured way to write spaghetti code. *

I've had to refactor code that my co-workers have written several times because they end up throwing code in a class where it works but doesn't "belong".

For example, the REST API I'm building has thin controllers, thick domains, and thin data access layer with various supporting models. I had a co-worker write a Domain object that acted like a model (a single object that should be instantiated, properties set, and a calculation function run).

I had to refactor all his code out into a reusable model and then build helper functions in the domain for the controller to consume.

Whenever I see that I need to do the same type of operation in multiple places, it tells me that code should probably be consolidated into a structured class to make sure that any bugs in the code can be fixed in one place instead of a dozen.

So in a way the code was structured in a class but was still a mess. OOP isn't just about classes and inheritance but about structure, architecture, and how classes interact with each other.

Re:Paul Graham on Spaghetti Code by lttlrck on Friday April 19, 2013 @06:56AM (#5575909)
When you 'had him write it' maybe you should have specified it more clearly.
Re:Paul Graham on Spaghetti Code by tyang on Thursday April 18, 2013 @11:43PM (#5574660)
This is why almost all good investors pass on startups with weak or no technical cofounders.
Re:Paul Graham on Spaghetti Code by absconditus on Friday April 19, 2013 @12:31AM (#5574835)
What? Most of the business world runs on spaghetti code sold by successful software companies. Success has almost nothing to do with technical skill.
Re:Paul Graham on Spaghetti Code by michaelochurch on Thursday April 18, 2013 @11:41PM (#5574649)
I wrote about this last summer: http://michaelochurch.wordpress.com/2012/08/15/what-is-spagh...

Inheritance (typically assumed to be part of OO, but not a requirement) is a big part of it. It gets nasty pretty quickly. Inheritance is the 21st-century goto, although it shares features with the even wonkier "comefrom" of INTERCAL.

Spaghetti code isn't just "bad code" but a specific kind of bad code where understanding a piece in isolation requires pinging about an ungodly number of places. There are a lot of causes of that, but usually it's poor software management and bad development practices.

Re:Paul Graham on Spaghetti Code by rhizome on Friday April 19, 2013 @12:07AM (#5574751)
"Inheritance breaks encapsulation," the elders said, and as with all extremes, they each have their problems. Language is a lossy codec for math/logic/thoughts, computer languages no less so.
Re:Paul Graham on Spaghetti Code by timr on Friday April 19, 2013 @12:25AM (#5574811)
The "elders" never said that. They invented inheritance because there was a need for it.

Inheritance is a great way to maintain encapsulation in the face of a messy world. Unchecked composition quickly gets you to a world where everything has to be public anyway.

Re:Paul Graham on Spaghetti Code by rhizome on Friday April 19, 2013 @02:00AM (#5575133)
It's just a figure of speech.
Re:Paul Graham on Spaghetti Code by brudgers on Friday April 19, 2013 @08:33AM (#5576248)
My understanding is that it originates with plugboards. See the third image in this recent article:

http://www.pcworld.com/article/249951/if_it_aint_broke_dont_...

Re:Paul Graham on Spaghetti Code by ank286 on Friday April 19, 2013 @02:15AM (#5575162)
This is a case of coherence vs coupling, which is lost by OO developers. Everything is so tightly coupled that more spaghetti code is written up to not break the coupling, making the code more incoherent overall.
Re:Paul Graham on Spaghetti Code by orokusaki on Thursday April 18, 2013 @11:47PM (#5574675)
This is Amazon affiliate spam... check the `tag=...` in the book link.
Re:Paul Graham on Spaghetti Code by olaf on Friday April 19, 2013 @03:10AM (#5575325)
People who critisize OOP for its bad applications have mostly not understood it.