Live data from Hacker News

Fighting Complexity in Software Development

github.com

111–117 of 117 posts

Re: Fighting Complexity in Software Development

#111

Earlier quoted context omitted.

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 require…

>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 its…

> 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

#112
post #13

I feel like I’ve responded this before, but I feel like people often attribute their increased knowledge of how to develop systems without bugs to the new fancy language they switched to. Fact is they could build better software in the old language as well, assuming they started from scratch.

Figuring out the Mikado method was one of the bigger shocks of my career. I thought I already knew all this stuff, and of course once I saw it I could explain it all. But knowing something is true and seeing it first hand can be a very different experience.

The simpler solution is often hard to see. We get attached to the wrong details or suffer sunk cost fallacies.

When you switch languages the cost of porting is higher, so it shouldn’t be a surprise that you end up with something much simpler. And if the target language attracted you because it makes some part of the problem simpler, that’s important but maybe not the dominant contributing factor to the experience.

Re: Fighting Complexity in Software Development

#113
post #69

``` type CardNumber = private CardNumber of string with member this.Value = match this with CardNumber s -> s static member create str = ``` Haha, no thank you >OOP languages for modern applications gives you a lot of troubles, because they were designed for a different purposes For which purposes if not software development exactly?

> For which purposes if not software development exactly?

Well, if you recognize only 1 category "software development", I can't help you. C was designed for software development as well, but you wouldn't chose it to do web development, I hope? It's a good tool when you need to develop something small and resource efficient. OOP fits good when you don't have much of concurrency, but you manage complex states in memory (which you do with help of objects and inheritance). And functional programming fits well when you need to manage data flow applications.

And truth is in a big complex system you need a decent support of both FP and OOP. Point is that languages like C# decently support only OOP.

Re: Fighting Complexity in Software Development

#114
post #19
post #5

Earlier quoted context omitted.

Sometimes it's hard to disentangle if a conversation is having an upward trending trajectory, or if you just happen to pay attention more to the links that mention some subject you happened to have caught an interest in.

Yeah, I’ve been hearing a lot about the Baader-Meinhof effect recently

Was this intentionally a subtle self-referential joke? Or was that an accident?

Re: Fighting Complexity in Software Development

#115
post #51
post #38

Earlier quoted context omitted.

> The problem is when you want validation errors which contains the field name, and a descriptive error message. Oh you want them localised as well? So the above example would become something like this: if (!string.IsNullOrEmpty(card.CardNumber) && CardNumberRegex.IsMatch(card.CardNumber)) validationContext.add("CardNumber", Localizer.MessageFor("InvalidCCNumber")); if (x.ExpirationMonth 12) validationContext.add("E…

Your starting to build your own validation library inside that validation context. Inside I presume it must be creating some kind of error object to a list. Next problem, rename a field on the object using a refactoring tool. You now have to change validation code to change the field name. You may forget about the validation code if your not looking at it. You have good tests though so you would probably would catch…

> Your starting to build your own validation library inside that validation context.

I'm building a simple composite data structure, outside of NPM this is not remotely a library. With a bit of luck not even that, I'm a bit rusty but I think the MVC framework had one built in to handle this.

> Next problem

I already addressed it, a lambda function instead of a string that can extract the property name, but your right that nameof might be a better option these days.

> The class is getting a lot responsibility, and you want to seperate validation out into its own class responsible for that. Maybe extract to a validation object which operates on a request/command class?

I already have, the actual validation is in a static method somewhere, so it has only one responsibility and the validation context is mostly a simple data structure, that's not too much responsibility.

> Might point is you eventually you end up building something like fluent validation. With own set of default rules, validation classes etc. Maybe fluent validation is overly complicated but I'd rather get the speed boost of using a well tested library that I already know instead of gradually refactoring into something custom.

It's not an unbounded problem with lot's of gotchas down the line, it's a well known and simple to solve problem that practically everyone has seen before. What you're ignoring is the complexity of adding a dependency in general and the complexity of this library in particular. Adding a dependency is not a free lunch, it has a cost in time, mental overhead and maintenance. This particular dependency increases the complexity of your code and delivers practically nothing. As for the speed boost, assuming it's true does not mean it reduces complexity, faster (initial) dev time very often comes at the cost of creating more complexity.

Re: Fighting Complexity in Software Development

#116
post #102

Earlier quoted context omitted.

Much of the time the "big picture" isn't local. That's just the nature of the big picture by definition. I find it better to put "big picture" stuff in the RDBMS, including UI issues (see "Table-Oriented" nearby), and keep only local details in code. For example, the menus and navigation can almost all be tracked and managed in the RDBMS. It's easier to query and study the structure that way because I can sort, searc…

I honestly have no idea what you're talking about.

I suppose it would take a fully coded example really explain it. I cannot provide one at this time.

Re: Fighting Complexity in Software Development

#117
post #33
post #27

Earlier quoted context omitted.

Erm surely ability is important as well. Programming is no different in this regard to pro sports - some people have more talent (which probably in turn breaks down into innate attributes, determination and learning opportunity earlier in life).

Ability comes from practice, there really are no shortcuts. Most of the difference seem to be in motivation.

Some people really don't get programming while others do.

When I studied at university many years ago, my course had a reputation for being tough. Before the course started properly, there was a three week intensive Java course with an exam at the end. They suggested that if you didn't pass the exam, then it probably wasn't the subject for you. A couple of people failed that exam and continued with the rest of the year long course anyway. Those people did struggle and I don't think any of them passed.

Post reply on HN