News for hackers. Stuff that matters.
Re:100x better approach to software? by mistermann on Monday April 23, 2012 @02:05PM (#3880121)
In my relatively short time (~20 years) in the software industry (in the "enterprise software" corporate development world on the MS platform), it is my personal perception that it now takes nearing 10 times the LOC &/or classes &/or complexity in general to implement the same functionality now, using modern "improved" software architecture and design patterns, than it used to writing code the "old" way we did things when I started out.

I'm deliberately very conscious of keeping an open mind and trying to discover just what it is that I don't "get" about the way things are done these days. I look at some of the incredibly complex software implementations of really very simple functionality these days, and for the life of me I just can't understand why people write things to be so complex.

Now and then I just can't restrain myself and I'll ask "why didn't you just do it this way" (often with a proof of concept implementation) and the normal response is blank stares, and a changing of the subject shortly thereafter. This is not just with individuals, this happens in groups, and no one (so it seems) feels anything is out of order. Not surprisingly, implementing new features takes far longer than things used to, at least according to my perception.

So, unless I am out of my mind, a 10x improvement could easily be realized (at least in the world of "enterprise" software), just by unadopting some of the practices adopted in the last decade or so.

Re:100x better approach to software? by T-hawk on Monday April 23, 2012 @06:02PM (#3881192)
The difference is in creep of functionality and expectations. So much stuff that wasn't even on the table 10 or 20 years ago is now expected so inherently that it's not even set out in the requirements. All those extra classes, complexity, and layers of abstraction do have purposes. We can continue talking about the Microsoft stack; my experience is there too. Yes, in older days you could knock together a report with ten lines of database code and a form in Visual Basic or even Access.

But expectations change. Your fat client VB Win32 app isn't good enough in a world where everyone expects to have every piece of functionality accessible with no client installation, using a web browser. Now you're rewriting it in ASP. Now you have to deal with sessions (which VB gave you for free just by virtue of the fact that the program ran continuously in memory), concurrency, logging, IIS hosting, and loads of other complexity. The functionality gains are huge over your VB program: easy access for multiple distributed users. It's just not so visible since it's just an expectation of the platform.

Five years later, now your standalone ASP pages are losing out to slicker competitors. Now every good site has on every page a banner and breadcrumb trail and sidebar menu and search box. That's not something that ASP does, unless you fake it with piles of server-side includes inserted into every page. So you move to ASP.NET with its concepts of master pages and HTTP pipeline modules and hierarchical controls. These give loads of functionality over and above older ways of doing things, even if you use only a small part of it. Multipliers of effort now exist in places and degrees that weren't previously possible.

Now your business wants federated single-sign-on with a partner web site and company. This wasn't even conceivable for a desktop Win32 app twenty years ago. But now you can implement it by invoking a few WIF library calls from the correct layers of abstraction. Sure, it'll take longer and more complexity than your single login box in your VB desktop application. But it's flexible and scalable in ways previously unimagined.

Or think about the back end. Twenty years ago, that was an Access or Sybase database where 5000 rows was a lot. Now modern database platforms scale past five billion rows, on any number of servers across a farm, with all sorts of automated procedures for live backups and encryption and failover and sharding and whatever else.

Maybe you're thinking of SQL Server Reporting Services? Yeah, it seems like it takes a long time to implement that compared to a one-off report with some charting control. But you get whopping loads of functionality along for the ride: pagination, filtering, printer formatting, linkage to CRUD actions, ability to clone the report for editing. You don't think about the functionality because it just comes as expected with the platform. And yes, some of the complexity will leak out into your application code ("no, don't page-break between the transactions for stock sale and cash credit.") But paying the price on an apparently slower or overengineered implementation really can give you highly leveraged multipliers of effort.

Recalibrate your notion of "same functionality" and you'll see why the software industry has gone where it has.

Re:100x better approach to software? by mistermann on Monday April 23, 2012 @10:27PM (#3882144)
I don't really disagree with anything you've said here at all...yes, the software as a whole that we're deploying today is different and more complex in many ways...or, perhaps a more correct statement is its ecosystem is more complex?

So yes, there is a lot more overhead now on top of strict functionality, but this isn't what I was referring to - I'm talking more about once you've taken the hit of all these now necessary environment/ecosystem issues and you need to implement a very specific piece of functionality. There are an infinite number of ways to implement something, and I find it to be increasingly common that the most complicated implementations seems to be preferred. It seems once someone learns some design patterns, from that point forward they are determined to use them.

Rare is the programmer in the "enterprise" world who will acknowledge the fact that there are multiple ways, of varying complexity, to implement something.

A good example in my opinion of two sides of this argument, both sides far more qualified than me, was when Robert Martin (Uncle Bob) was on the StackOverflow podcast to discuss some of the issues (attacks) Joel had made on Bob's advocacy of SOLID principles, test coverage, etc. My take on the discussion was that Joel was genuinely trying to understand why Bob considered the complexity of his advocated designs absolutely critical to developing software, and without it, you will fail (or should be fired). However, his argument was unconvincing to me. If these principles are so important, then why can't you make a compelling argument for them that experienced practitioners can understand? And again, if they are so important that you ignore them at your own peril, how is so much software written successfully while ignoring these principles.

I think that side of the camp would do a big favor to itself by becoming a little humbler and intellectually honest.

Re:100x better approach to software? by Groxx on Monday April 23, 2012 @11:01PM (#3882222)
How much have those 'most complicated' options created the ability to build such a vast increase in expectations in relatively small amounts of work? Without a few several-thousand LOC gems, my Rails code would take longer and be more error-prone, and wouldn't play well with gems A through Z (excepting maybe Q). The fact that I can grab 5 random interesting gems, try them out, and then discard them with a very small amount of work on my part is phenomenally valuable, and wouldn't be possible if they weren't as well encapsulated as they often are.
Re:100x better approach to software? by mistermann on Tuesday April 24, 2012 @10:03AM (#3883954)
This would be an example of where putting significant thought into design and extensibility would be well worthwhile, because the target audience is so massive.

The typical enterprise code will never be reused, it will never be "extended", but there's a decent chance it will have to undergo slight modifications.

Most enterprise programmers, perhaps contrary to their image of themselves and their projects, are not working on the next ROR, are not sending a rocket to the moon, are not building an app that requires google-class scalability.

Re:100x better approach to software? by Groxx on Tuesday April 24, 2012 @12:35PM (#3884734)
Many enterprise programmers have to deal with lots of other programmers, who they may not talk to, who are of vastly varying skills. They might literally need to protect their code from someone else's misuse, so it can be fixed later if needed without far-reaching complications.

Which sounds a lot like an open source project, except that those involved may not be interested in what they're doing. I'd argue that makes them more dangerous, so a greater level of encapsulation may be warranted.

Re:100x better approach to software? by SomeCallMeTim on Monday April 23, 2012 @02:51PM (#3880335)
I've experienced this myself in the "religion" of OOD (in which I admit I used to be a fervent believer).

I once showed my brother a Ruby script I'd written with lots of clean encapsulation and a pile of reusable code -- and then he showed me how he would have hacked it together in 1/10 the code by NOT trying to design it to be "extensible."

There's obviously a balance that you can strive for -- sometimes it IS best to design code to be reused. But in this case, unless my code were reused something like 20 times, I would have ended up with NET fewer lines of code by simply taking the NON OOD approach. And fewer lines of code means fewer opportunities for bugs.

At this point I try to mix OOD with other paradigms, taking advantage of the strengths of each. Sometimes OOD IS the right answer still, but honestly most of the time it isn't. And OOD is verbose compared to other paradigms, especially when you're using a paradigm-agnostic language. (I suspect if you tried to code in Java this way it would fight you at every step, for instance.)

Re:100x better approach to software? by felipemnoa on Monday April 23, 2012 @06:11PM (#3881234)
>>and then he showed me how he would have hacked it together in 1/10 the code by NOT trying to design it to be "extensible."

Hacks like this do come back and bite you in the rear big time when latter on you want to extend it. Unless you are planning to trow it away or never modify it, it is a really bad idea.

Re:100x better approach to software? by Scaevolus on Monday April 23, 2012 @08:09PM (#3881716)
Programs have inertia roughly proportional to their size.

Extending a small program is almost always easier than a large program-- except for the special case where the large program was designed with the specific extension you're making in mind.

Re:100x better approach to software? by astrodust on Monday April 23, 2012 @10:21PM (#3882120)
You sound like a person who's never had to debug a hairball of a Perl program that looks more line-noise than source code.

You can do just as much damage by being too concise as being too verbose.

Re:100x better approach to software? by mistermann on Monday April 23, 2012 @10:36PM (#3882173)
> You can do just as much damage by being too concise as being too verbose.

Very true in my experience. Why do something in 3 lines of easy to understand code whose intention is obvious, when you can do the same thing with a clever and obscure one-line hack that will impress your colleagues?

Re:100x better approach to software? by SomeCallMeTim on Tuesday April 24, 2012 @12:47PM (#3884812)
FYI, in the comparison above, there were no clever one-line hacks that were completely unreadable. OO code just takes more lines.
Re:100x better approach to software? by mistermann on Monday April 23, 2012 @10:33PM (#3882166)
Can you give an example of how a lack of consideration of extensibility might come back to bite one?

And please not a contrived straw man example that is obvious to everyone reading, something that one might legitimately do in the real world for reasons of simplicity and expediency, that could turn out to be a genuinely painful experience when it becomes necessary to extend. (Obviously I don't expect an essay, but I'd appreciate if you could try to give us an idea in a reasonable amount of text.)

Re:100x better approach to software? by SomeCallMeTim on Tuesday April 24, 2012 @12:50PM (#3884847)
The point is that there's a time and place for OOD, but small scripts that may or may not even be reusable isn't often one of them.

But you can write as much code as you feel comfortable with, I won't stop you. I'm instead using the insights I learned above to write less code.

And sometimes awkward things result, and I refactor. But a lot of the time the "awkward thing" is trying to get OO code to conform to a problem that doesn't benefit from it.

Re:100x better approach to software? by ralph on Monday April 23, 2012 @03:19PM (#3880478)
I'd echo that view, also with twenty years of (Unix) programming behind me. The start of the slippery slope seemed to be object-orientation; yes, it can be ideal in some areas, helps re-use if done well, but since the majority of source is of average quality or worse it often seems to just add obfuscation, layers to wade through, contortions to fit the solution to the OO model the language provides, and poor names because so many need to be created that it becomes tedious. Contrast with Go's interfaces.

Design patterns have also had an overall negative effect IMHO. Useful as a lingua franca for theoretical discussion they've again been over-adopted and the vocabulary has become so large, and sometimes imprecise, lessening their usefulness, that it sometimes seems like a geek version of the management-speak for which we criticise the pointy-haired.

"Controlling complexity is the essence of computer programming" — Brian Kernighan. I often find the above add more complexity than they're worth.

Re:100x better approach to software? by pavel_lishin on Monday April 23, 2012 @02:36PM (#3880265)
Do the added LOC/complexity/classes make it easier to change the software later? As I understand it, all of those things aren't there to make it easier to start; they're there to make software easier to maintain.
Re:100x better approach to software? by loup-vaillant on Monday April 23, 2012 @02:54PM (#3880348)
I'm pretty certain that more code is more difficult to maintain, period.

Before you modify anything, you have to find the relevant piece of code, understand it, and understand all the dependencies' interfaces (or even part of their implementation, if the abstractions leak). I can't recall specific experimental result, but it seems, well, obvious, that all the above will be more difficult if there is more code to examine.

Now you could argue that you could shrink the size of the code that one have to examine before making a modification, by increasing total code size. I don't believe it. Increased modularity means more code re-use in the first place, and therefore a smaller program.

Re:100x better approach to software? by johndcook on Monday April 23, 2012 @04:48PM (#3880891)
Agreed. I imagine most unnecessary code is justified by saying that it will make the code easier to maintain, even though it usually has opposite effect. It pays to be very skeptical of your ability to predict the future.
Re:100x better approach to software? by mistermann on Monday April 23, 2012 @02:59PM (#3880381)
That is typically how the design is "sold", but in practice I've found that either the anticipated changes are never required, or are such that the "flexible" design doesn't work for the changes that are eventually needed.

Meanwhile, you have to live with this same complexity everywhere in your system; wrapping your head around the simplest implementations is very time consuming, onboarding new developers is unnecessarily slow, making minor tweaks to production apps no one has touched for 2 years is slow and dangerous.

Re:100x better approach to software? by CoolGuySteve on Monday April 23, 2012 @09:38PM (#3881996)
I know exactly what you mean. The only time I ever got an answer, I was briefly working at a large bank and it was something along the lines of reducing 'touch-points'. The theory being that the more you have to alter the code later, the more likely you are to introduce new bugs.

I think it's kind of bullshitty to write 1000 lines of code with the expectation that they'll be better written now then later when you have a clearer view of the requirements, but there it is.

The whole mess with design patterns and their indirection machine gun reminds me of this move: http://1.bp.blogspot.com/_zzQgqacqhjI/Sf-oiHCviUI/AAAAAAAAAT...

Look, only one touchpoint! Much more reliable now.

Re:100x better approach to software? by slewis on Monday April 23, 2012 @02:11PM (#3880144)
Can you provide a concrete examples?
Re:100x better approach to software? by mistermann on Monday April 23, 2012 @03:15PM (#3880460)
Ok, here's one extremely simple example....

Say you have a screen where you have to show sales for an individual customer.

One way of doing this is, within the screen that requires this data, querying sales by that customer using the dynamic sql feature provided by the ORM you are already using. One line of code, and it exists in the source code exactly where it is consumed at runtime.

Another way of doing this is writing a stored procedure that returns the same data and accepts customer name as an argument. Now, this SP has to be exposed through <n> application layers before the UI can ultimately call it. So now, you have a very specific (and obscure) stored procedure, that has to be exposed in <n> layers of application tiers.

Now imagine you need sales for an individual customer, but now only for products from a particular manufacturer, and imagine the two ways that could be implemented. Rinse and repeat for every other distinct data retrieval use case you have.

This is just one type of an implementation style that can be made excessively complex. Now throw some new design patterns that you just read about into the mix. Now, on top of your <n> app tiers, you now get several additional wrapper classes on top of all this, so a simple select from your database ends up with a call stack 12 levels deep with 6 levels of indirection.

And if you suggest perhaps there's an alternate way, you're an outcast. At the very least, one would hope you could have an open-minded discussion about the relative merits of the two approaches. But this is just my experience, YMMV.

Re:100x better approach to software? by slewis on Monday April 23, 2012 @08:19PM (#3881759)
That's a good example and it does suck. Sounds like enterprisey java-land that we HNers love to hate on so much.
Re:100x better approach to software? by baddox on Monday April 23, 2012 @05:09PM (#3880985)
See Donald Knuth's thoughts on the "menace" of reusable code: http://www.informit.com/articles/article.aspx?p=1193856.