News for hackers. Stuff that matters.
Re:Fighting Complexity in Software Development by Chyzwar on Thursday July 04, 2019 @07:32PM (#20358672)
In mature OOP you have ways to write nice models and have good validations. https://guides.rubyonrails.org/active_record_validations.htm...

I will argue that the complexity of software development is not because of OOP vs Functional. Tooling, documentation, quality of libraries and people are what matter most. Ruby was a massive success is largely attributed to above. We are humans, we can understand and deal with a fixed amount of complexity if I can offload some of it to a framework, library or tool I will have more time to work on my problem.

Every time I try to play with anything Functional I got hit by a bus of undocumented frameworks(Erlang), multiple standard libraries (ocaml), competing half finished implementations (lisp), arcane tooling (scala), no tooling (Haskell) and broken tooling (F# on Linux).

Re:Fighting Complexity in Software Development by jes5199 on Thursday July 04, 2019 @08:40PM (#20359025)
but have you ever had to maintain a ruby project after the first year? The cost just goes up and up, and I think it’s because the language is so hostile to static analysis.
Re:Fighting Complexity in Software Development by losteric on Thursday July 04, 2019 @10:03PM (#20359363)
Yes. I've been working on an corporate internal RoR tool that launched in 2010. Various engineers over the years continued releasing new features and updating language/framework development... when I earlier this year, development/maintenance cost was no higher than any other software of that nature and age.

Cost only goes up and up when engineers go overboard with "clever" Ruby magic... which is human error, don't blame the tool.

Re:Fighting Complexity in Software Development by vharuck on Friday July 05, 2019 @09:48AM (#20362464)
>Cost only goes up and up when engineers go overboard with "clever" Ruby magic... which is human error, don't blame the tool.

I've only used a few languages in production for my non-developer job, but I've noticed very different frequencies of "clever" code between them.

R: This is my primary language. I love it, but it almost encourages clever coding. There are 10 ways to do any task without even touching third-party packages.

Python: My secondary language at work. Clever coding is definitely possible in Python, but the language's syntax makes it easy to spot. Detection isn't as good as prevention but it's better than nothing.

(I also grudgingly use SAS, but won't waste my time looking for ways it encourages clear coding.)

Re:Fighting Complexity in Software Development by jumpinalake on Thursday July 04, 2019 @08:57PM (#20359114)
Couldn’t agree more. I was part of a $30 million Rails project that got unmanageable and burned after 2-3 years. Golang is so much more forgiving to human error.
Re:Fighting Complexity in Software Development by jaequery on Friday July 05, 2019 @02:21AM (#20360256)
30M. Well there’s your problem. I can just imagine the premature optimizations and the bloated abstraction that went in the planning phases.
Re:Fighting Complexity in Software Development by wayoutthere on Friday July 05, 2019 @09:46AM (#20362444)
Yeah, welcome to enterprise development (regardless of programming language). Every VP fancies themselves as the next Steve Jobs and like to be uncompromising about delivering their vision. Which ironically ends up as design by committee when you have that many assholes in a room unwilling to back down but also needing to save face.

And to be fair, most of the premature optimization and bloated abstractions are just your architects sitting around bored for 6 months while the project sponsors argue over reporting minutiae (but won’t approve the designs until their pet features are pulled in on the roadmap). They know the entire feature list is going to get changed at the last minute as the political winds shift, so they’re designing an overbuilt architecture to CYA for whatever random bullshit someone will pull a week before a deadline.

Re:Fighting Complexity in Software Development by james_s_tayler on Saturday July 06, 2019 @01:51AM (#20368174)
It's not even about programming languages at this point. It's Peopleware. People are the number 1 cause of all problems in software.
Re:Fighting Complexity in Software Development by taeric on Thursday July 04, 2019 @11:15PM (#20359564)
Have you maintained anything after the first year where that wasn't the case? Especially if you had a high degree of churn on the developers.

I'll grant that it is easier in more stable API environments. But we are our own worst enemies in that race.

Re:Fighting Complexity in Software Development by jes5199 on Friday July 05, 2019 @01:36AM (#20360083)
if I pick up an old Java project, it might be a mess, but I'll be able to rename methods, refactor classes, and upgrade libraries until it gets into shape - and I'll have a fair amount of confidence that it'll keep working while I do that, because metaprogramming is rare, APIs are fairly stable, and the IDE will mostly be able to understand what the code is doing. In a ruby project - especially in a Rails project - you can never know for sure what code is calling what. There's no "Find usages" tool that can be relied on. And then, all your dependencies will have completely changed their APIs and behaviors, and they'll have a complex matrix of incompatibilities that means that you might have to upgrade several libraries at a time and rewrite a lot of code just to keep things working.
Re:Fighting Complexity in Software Development by taeric on Friday July 05, 2019 @11:05PM (#20367518)
Apologies for the slow response.

I honestly can't compare to a rails app, as I don't have the experience. I can say that modern dev practices worry me with the constant upgrade train on api standards. On the one side, progress is quite nice. On the flipside, what you describe in "all your dependencies have completely changed their APIs" is just as annoying in Java as it is in any language. More so if someone has helpfully split your codebase into as many supposedly independent parts as they can.

More than that, it is amusing that many of the refactoring tools that you reference actually began in more dynamic languages. I've seen that folks that rely on their IDE to be able to refactor have a habit of making codebases that they have to use an IDE to refactor. I grant it could just be confirmation bias.

Re:Fighting Complexity in Software Development by tannhaeuser on Friday July 05, 2019 @01:47AM (#20360124)
> metaprogramming is rare

In Java? Not really. Spring has been around since 2003 or so.

Re:Fighting Complexity in Software Development by michaelcampbell on Friday July 05, 2019 @09:04AM (#20362212)
Having a framework do metaprogramming, and using that framework is one thing. I think that they mean user-level metaprogramming. This is MUCH more evident in dynamic languages.
Re:Fighting Complexity in Software Development by sam_lowry_ on Friday July 05, 2019 @02:32AM (#20360312)
I guess he was referring not to metaprogramming in the common sense, but to the change of behaviour of built-in methods and classes.
Re:Fighting Complexity in Software Development by tannhaeuser on Friday July 05, 2019 @05:23AM (#20361061)
Ah, I thought that's called "monkey patching".
Re:Fighting Complexity in Software Development by lsd5you on Thursday July 04, 2019 @08:58PM (#20359118)
And probably also the non-local effects of using a framework - and a fairly magic one at that. All the effects of which are understood when creating the functionality, but the maintainer (even when it is the author) has a much harder time with probably only a partial understanding with certain things being out of mind.
Re:Fighting Complexity in Software Development by gitgud on Friday July 05, 2019 @04:28AM (#20360803)
I would stay Dynamic languages like Ruby are inherently more flexible and powerful, which more easily leads to complexity in the system... (if left unchecked)
Re:Fighting Complexity in Software Development by cottsak on Thursday July 04, 2019 @09:01PM (#20359136)
Agree. You can write terse, maintainable, well encapsulated, testable and readable code in most any language. The problem is about the humans not the language they select.

But yes, complexity is also a major problem.

Re:Fighting Complexity in Software Development by alkonaut on Friday July 05, 2019 @05:01AM (#20360949)
What I have learned is that what makes a language (or platform, or tool) "good" isn't how easy it is to write good code, but how hard it is to write bad code. Does a beginner following the path of least resistence, on a tight schedule, end up with maintainable code or not?

I'd argue that this is the weakness with (the traditional) OO languages. An experienced developer with plenty of time can write good software with almost any tool. But that's not what's interesting. I want to see tools that not just lets but rather guides inexperienced developers into making maintainable software.

Things like "no nulls" or "immutable by default" in Rust and most functional languages are two examples of such designs. OO itself doesn't necessarily mean the developers get trapped in poor code, but the traditional 3 (C++, Java, C#) sure do give developers lots of guns to shoot at their feet. Perhaps not mainly because they are OO, but because they inherited some poor fundamental decisions about mutability and nulls (from C) and about inheritance as a default method of abstraction (from C++) etc.

Re:Fighting Complexity in Software Development by pytester on Friday July 05, 2019 @05:59AM (#20361237)
>isn't how easy it is to write good code, but how hard it is to write bad code

In many languages they make it harder to write bad code but they do so at the expense of delivering functionality quickly. There's a clear trade off there - one which is often very project dependent (some projects primarily need to develop functionality quickly; others prioritize stability).

The problem of slowing down development becomes particularly pronounced when developing something where the biggest risk isn't building the thing wrong, but building the wrong thing. It's extremely expensive to use a very strict language if you're developing code where requirements are highly in flux and cannot be discerned up front.

Ideally general purpose languages should enable a smooth transition from coding up a prototype/MVP all the way to production-hardened, spotlessly clean code.

I like rust a lot but I would only use it to write very low level code where the requirements are cast in stone and speed and stability is of the utmost importance. It's a lovely language but it's very slow to build stuff in, and in almost all cases it should be used to rewrite something existing rather than to build it anew.

Re:Fighting Complexity in Software Development by alkonaut on Friday July 05, 2019 @06:25AM (#20361369)
I agree - in a prototyping phase it may be beneficial to be able to throw something together. The problem is that what you throw together is invariably the base for the real thing. The motto of "design one to throw away" is great, but I haven't seen it applied as much as it should.

Using a "stiff" set of tools might slow down the first stages of prototyping, but it also makes the prototype easier to modify as requirements change. The question I suppose is simply where the equilibrium occurs. I.e. does Rust or F# make a thing that is easier to modify (because of less coupling) already after one or two months, or only after one or two years?

Re:Fighting Complexity in Software Development by pytester on Friday July 05, 2019 @06:41AM (#20361449)
>The problem is that what you throw together is invariably the base for the real thing.

This isn't invariable at all. More often what you throw together gets thrown away. I'd estimate this happens to more (working) code I've written over my career than not. The hardest thing to get right is often getting the contours of a tool right and ascertaining what it should do - not making it work right after it has proven itself.

>Using a "stiff" set of tools might slow down the first stages of prototyping, but it also makes the prototype easier to modify as requirements change.

This is only really the case where the prototype was fundamentally solving the right problem in the right way to begin with and the subsequent changes are incremental in nature. If the design of, say, a microcomponent is flawed from the outset or it did the wrong thing and you have to re-do it, those "stiff" tools slow you down.

Using an extremely strict set of tools in a prototyping environment also invariably means a lot of extra up front work dealing with the tools' attempts to protect you from bugs which have an extremely low probability of occurring and/or an extremely low cost when they do occur.

If F# or rust or haskell really was quicker and more effective in a prototyping environment as well as when writing production hardened code, programmers would likely eventually converge on only using them. That isn't what is happening.

Re:Fighting Complexity in Software Development by morgancmartin on Friday July 05, 2019 @09:29AM (#20362335)
> If F# or rust or haskell really was quicker and more effective in a prototyping environment as well as when writing production hardened code, programmers would likely eventually converge on only using them. That isn't what is happening.

This does not seem to me to be a safe assumption to make. The market is irrational. There is no reason to believe popularity has any significant correlation to the effectiveness of a tool.

Re:Fighting Complexity in Software Development by AnimalMuppet on Friday July 05, 2019 @01:30PM (#20364210)
> The market is irrational.

To some degree. But programmers are not, in general, easily herded, even by other programmers.

> There is no reason to believe popularity has any significant correlation to the effectiveness of a tool.

Programmers are not stupid. They are not totally ineffective at pushing management to use sane tools. One or both of those would have to be true for your statement to be true.

Well, you may say, it's a slow process. But Haskell has been out there for more than 30 years. F# is 14 years old, and supported by Microsoft. These languages have had plenty of time for programmers to notice that they were actually more effective in the real world.

Re:Fighting Complexity in Software Development by spronkey on Saturday July 06, 2019 @08:56AM (#20369426)
> This is only really the case where the prototype was fundamentally solving the right problem in the right way to begin with and the subsequent changes are incremental in nature. If the design of, say, a microcomponent is flawed from the outset or it did the wrong thing and you have to re-do it, those "stiff" tools slow you down.

This. So, so, so, so much this.

I absolutely agree that getting the contours of the tool right (nice analogy there) is (one of) the hardest parts. The main issue I find when using strict, type-driven FP langs for "first draft" style implementations is that I waste time with the unavoidable ceremony that most of these languages require, when what I really want to be doing is probing around to discover the rough edges. The "my last name is Curry" style of FP almost requires you to declare these edges up front as you code.

I actually find that TDD is even more useful in FP contexts than in procedural - mainly because a) it's a good way to help think about the shape of the tool before building it, and b) the FP implementations are often more mentally complex with recursion, pattern matching, and other such things that (IMO) require more brainpower to grok than simple procedures, and to be honest I just find myself needing the tests so I don't go mad trying to be a human compiler. I think even the most staunch TDD fanatics wouldn't try to argue that it's a fast way to prototype.

These days I find myself reaching for dynamic languages with gradual typing for prototypes that might hit production (JS+TS, Python, even PHP). When I'm satisfied with the general shape, I'll add a few type hints here and there to make my IDE friendlier. After a while, usually at the point where there are large additions to requirements, I'll find myself rewriting at least a chunk of the original in a completely different manner, usually in a more type-driven manner, usually with a more FP slant, and often in a different language with more strictness.

I would like to see more mainstream languages support both type-driven FP and simple procedural code without using Haskell-inspired syntaxes or turning into the incomprehensible mess that is Scala. Java is slowly morphing that way, but it still lacks some of the FP fundamentals for when you do want to go full-zealot.

Re:Fighting Complexity in Software Development by tomp on Friday July 05, 2019 @08:29AM (#20361996)
> some projects primarily need to develop functionality quickly; others prioritize stability

But they get the ballance completely wrong. In Python, I can just write code that returns some object or None (Python equivalent of null). In Java/C/C++ I can't - I have to appease the type system (i.e. declare the return type), but there is also no way to even later tell the compiler that it can't be null!

Re:Fighting Complexity in Software Development by pjmlp on Friday July 05, 2019 @10:15AM (#20362654)
On the other hand, very few languages are capable to rival C++, Java, C# in terms of tooling and available libraries.
Re:Fighting Complexity in Software Development by fnordsensei on Friday July 05, 2019 @07:36AM (#20361713)
On the other hand, it seems a bit wild to propose that tools don’t have inherent affordances of their own.

What complicates assessment is that for many attributes, it’s impossible to assess the tool and the user in isolation. This is not unique to programming languages.

Re:Fighting Complexity in Software Development by jacknj on Friday July 05, 2019 @02:46AM (#20360372)
When you mention "no tooling (Haskell)" what do you mean? I am using Haskell (mostly for hobby projects) and am wondering what I am missing out on, since I feel the tools available is sufficient.
Re:Fighting Complexity in Software Development by apta on Friday July 05, 2019 @08:31PM (#20366954)
This is already achievable using annotations in Java or attributes in C#, in a less verbose way. You just tag your method parameter with `@Valid` or `[Valid]` or what have you, and the framework you're using automatically ensures that the validations you specified on the data model are valid at that point in time.
Re:Fighting Complexity in Software Development by pjmlp on Friday July 05, 2019 @10:13AM (#20362642)
The irony is that Smalltalk already offered many FP patterns.

In the end multi-paradim languages will win.

What many FP advocates fail to acknowledge is that all FP languages that got some kind of mainstream adoption, might be FP first, but they are actually multi-paradigm.

Re:Fighting Complexity in Software Development by tabtab on Friday July 05, 2019 @04:03PM (#20365402)
No FP language has gotten mainstream adoption. Mainstream languages may have had FP features added, but that's different.

I confess I don't "get" the benefits of FP for the type of applications I work on. Most examples are for a domain completely different, make unrealistic assumptions about domain patterns of change that I actually see, or fill in for weaknesses of a given language's OOP model.

Re:Fighting Complexity in Software Development by pjmlp on Friday July 05, 2019 @04:53PM (#20365816)
I mean those FP languages that enjoy some commercial use like Common Lisp, Clojure, Scala, F#, OCaml and Haskell.

All of them also expose OOP concepts.

Re:Fighting Complexity in Software Development by tabtab on Friday July 05, 2019 @05:37PM (#20366083)
Lisp is flexible enough to be just about every paradigm. Too much flexibly can be a problem in some circumstances, but I don't want to get into yet another "Lisp fight" here about that. There are hundreds on the internet already.
Re:Fighting Complexity in Software Development by merlincorey on Friday July 05, 2019 @03:24AM (#20360519)
> competing half finished implementations (lisp)

As well as one of the most complete specifications in ANSI Common Lisp.

Re:Fighting Complexity in Software Development by agumonkey on Friday July 05, 2019 @06:09AM (#20361286)
I'm curious about lispers. I thought quicklisp made a lot of things frictionless.
Re:Fighting Complexity in Software Development by walshemj on Friday July 05, 2019 @09:39AM (#20362393)
I think the argument is that for a lot of cases OOP isn't the right paradigm