News for hackers. Stuff that matters.
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @06:44AM (#30330877)
Same here. I'm sitting here debugging some 15 year old c# at the moment in the middle of a mega shit show.

I got paid. That's all the good stuff I can say about it.

Re:20 Years of .NET by tonyjstark on Monday February 14, 2022 @06:58AM (#30330966)
I never came across code older than 2-3 years that’s not a complete clusterfuck. So looking at it from this side, the fact that it still runs is more of a sign of quality, what do you think?
Re:20 Years of .NET by fifticon on Monday February 14, 2022 @08:37AM (#30331823)
I have my own theory on this. Green-field projects are usually whipped up and rolled out by the experienced devs in the shop. Once the boat is in the water and floating, the senior devs are posted off to next new-dev initiative, and the following maintenance/deployment work is assigned to less and less senior devs, and/or student programmers. Within 2-3 years, those inexperienced devs have mangled the original design into unrecognisability, and the application accumulates instabilities from their bolted-on "fixes". A different perspective is that the original creators are never allowed back to fix their design mistakes. I don't know if it's universal, but I have sure seen it in a lot of places, and I have myself been in most of those roles hinted at.
Re:20 Years of .NET by SketchySeaBeast on Monday February 14, 2022 @09:15AM (#30332236)
Disclaimer - my job is literally to take on the long term maintenance of those green field projects.

I wouldn't necessarily blame it on a lack of seniority or inexperience, it's a matter of not knowing the initial style, decisions, and limitations, as well as the vagaries of time. I find myself creating duplicate functions not because I wouldn't reuse the ones that exist, but because the original one was hidden away in a different place than I'd ever think to look for them. My approach is different and drifts even further over the years, I can't help it, so that the project starts to look stranger and stranger comparing the old code to the new. The original designers would find their style drifting too if they had to take care of a system for that long. They are just lucky enough that their style drift has project cut-offs, so each slice seems more cohesive.

I also don't know if this is a current maxim or not, but there should be a software principle that matches Peter's - every successful system will grow until it reaches a point where it's no longer successful. More and more requirements get added on, and unlike initial requirements where you could justify keeping scope tight due to staying lean, a system needs to grow beyond it's current limitations or it dies.

Re:20 Years of .NET by kabes on Monday February 14, 2022 @01:51PM (#30336401)
It's also that requirements often change in ways the original design hadn't foreseen. And usually there's no time for a decent redesign, so things get hacked together and slowly degrade hack by hack
Re:20 Years of .NET by JohnBooty on Monday February 14, 2022 @11:19AM (#30333821)
This matches pretty closely with my experience.

An additional side effect is that management fails to understand what/why is going on and overvalues the skills of the "experienced devs" and undervalues the skills of the maintenance devs because they don't understand the order-of-magnitude speed advantage enjoyed by devs when writing greenfield code.

"Experienced Developer A wrote the whole damn system in three months! Now Maintenance Developer B wants three months just to add a few buttons?!?"

I've been both the experienced person and the junior maintenance person.

Re:20 Years of .NET by nuancebydefault on Monday February 14, 2022 @02:29PM (#30337015)
Exactly! As a maintenance dev, you tend not to get much praise, you need to continuously explain why things take so long. I'm currently adapting some code that is, in the eyes of management, adding an extra little wire, which should not be more than a day of work. In effect it will be more than 4 days plus some overtime...
Re:20 Years of .NET by JohnBooty on Tuesday February 15, 2022 @05:48AM (#30344911)
Yeah. I've been in the industry for 20+ years and I have not figured out a way to "shine" when tasked with maintenance work, other than finding ways to avoid such roles entirely.

The root issue is that management never seems to be able to grasp things on a technical level. I've tried to communicate this over the years, and have been praised for my communication skills in general, but I've never managed to bridge this particular gap.

Re:20 Years of .NET by disease on Monday February 14, 2022 @11:56AM (#30334299)
This plays some part. Another factor is the old 'it is harder to read code than it is to write it' adage.
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @07:00AM (#30330981)
Depends how much legacy .Net classic stuff you have that is in no way portable to .Net core.
Re:20 Years of .NET by NicoJuicy on Monday February 14, 2022 @07:36AM (#30331268)
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @08:37AM (#30331829)
Our software broke that.
Re:20 Years of .NET by NicoJuicy on Monday February 14, 2022 @10:21AM (#30333057)
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @11:11AM (#30333714)
We don’t communicate via GitHub any more. See my other comments.

Also the assistant doesn’t help with the numerous third party components which were never ported to core, the entire MVC stack internal changes or the changes that took place in NHibernate. So even if it did work it’d break everything in the process.

Re:20 Years of .NET by NicoJuicy on Monday February 14, 2022 @02:08PM (#30336684)
I see a lot of complaints from you.

But I should mention that nhibernate is not even in the dotnet foundation and not supported for .net core ( I visited their site and it mentions dotnet framework).

I see this though: https://enterprisecraftsmanship.com/posts/nhibernate-now-sup...

So the issue is mostly nhibernate?

Re:20 Years of .NET by valdiorn on Monday February 14, 2022 @11:15AM (#30333770)
"15 year old" <--- this is your problem

"c#" <--- this is not

Imagine what a 15 year old C++, Java, Javascript or Python project would look like. Not much different, I'm thinking...

Re:20 Years of .NET by hackerfromthefu on Tuesday February 15, 2022 @07:19AM (#30345493)
Good luck with a 15 month old javascript system.

You can possibly work with and update a C# program because of the incredible longevity/backward compatibility of the core libraries, and reasonable commitment to this in the culture of the ecosystem.

But in Javascript land this can easily or even typically hit a point where the errors from package churn are so much that economically the juice is not worth the squeeze, in a literal order of magnitude less than the typical C# system.

Re:20 Years of .NET by taylodl on Tuesday February 15, 2022 @11:10AM (#30348351)
My company has multiple applications written in jQuery and Bootstrap that are now 10+ years old and going strong. We've been using Node.js on the backend for a little over 3 years now and those apps aren't going anywhere for quite some time. I think the notion of the continually shifting Javascript landscape has been overplayed. To wit, C++ has been changing more frequently than Javascript has!
Re:20 Years of .NET by Weebs on Monday February 14, 2022 @01:01PM (#30335446)
What these all have in common though, is encouraging shared mutable references, they don't do a lot to make effects in a system explicit, don't encourage a clear organization of code, and many fundamental concepts (functions as values) were missing early on or still are (discriminated unions)

I agree that pretty much any 15 year old code base is going to get rough, but I think these languages have some clear footguns that aren't doing them favors either. I work on a codebase that isn't more than a few years old, and there's complexity issues from simple things like the language lacking good semantics for transforming data immutably, and that complexity spirals

I can attest that writing messy processes in languages that do address these concerns is absolutely possible, I've done so myself, but the mess is contained to a particular area and it's not as hard to follow which pieces of a system feed into another. Things as simple as making immutability the default and mutation explicit like Rust, and requiring modules be organized into a hierarchy like F# are huge wins. As much as I've gotten annoyed with F#'s project files hierarchy requirement because it requires some extra work/considerations for codependent types and codegen, it's amazing how much easier it is to jump into a new codebase where you can clearly see to understand behavior you start with the bottom of the file list, and to understand core logic/patterns you go to the top of the file list

Re:20 Years of .NET by icedchai on Monday February 14, 2022 @12:44PM (#30335169)
Yep. Almost all old code bases are like this. Complexity inevitably grows over time, and old code lingers. People leave, and knowledge often fails to transfer. This is why developers prefer to work on new things: it's more fun to make the mess than to clean it up. Plus nobody wants to pay only for "maintenance"... you have to work it into other projects, which is often easier said than done.
Re:20 Years of .NET by smackeyacky on Monday February 14, 2022 @07:06AM (#30331020)
I had to debug some of my own 15 year old C# the other day, quite a reminder of how far .NET has come. Back then I rolled my own ORM and it was fun but not a patch on EFCore.

One dark place some .NET devs got caught in the early days was some of the 3rd party ORMs. Nightmare of weird code, proprietary mapping tools and headaches.

I am still not sold on linq2sql either. Debugging that is never fun.

Re:20 Years of .NET by torginus on Monday February 14, 2022 @11:00AM (#30333573)
I'm kind of sentimental for EF, as I think it can be a handy tool, but in my experience, ORMs of any kind are not suited to serious work, they usually assume that they own the database creation, which is fine when you are building a webshop, but obviously not, when you are interacting with a large existing database.

ORM-lites, such as Dapper, which only bind query results to objects, are an obvious exception thoug.

Re:20 Years of .NET by dpark on Monday February 14, 2022 @12:07PM (#30334502)
It’s my experience that ORM “frameworks” are a net negative for anything that needs scale or performance. They’re optimized for demos and quick setup but fall apart as soon as the system needs to scale. Straight deserialization is generally a win but the “magic” never is and fighting with it when it doesn’t work is way more pain that writing some SQL.

Every time I’ve seen a project use an ORM past the proof of concept phase, it ends up with some garbage layer to bypass or “trick” the ORM into doing something acceptable. (e.g. Complex materialized views presented as tables to the ORM so the ORM can just do straight selects without joins).

Re:20 Years of .NET by Akronymus on Tuesday February 15, 2022 @05:26AM (#30344767)
Speaking of databases: In my experience, denormalizing usually doesn't help either with performance. Hell, often normalizing it more leads to it actually being faster. (Assuming appropriate indices)
Re:20 Years of .NET by dpark on Tuesday February 15, 2022 @01:14PM (#30350385)
Depends on the query patterns, but certainly denormalization is not an automatic win.
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @07:08AM (#30331030)
Yeah those ORMs were horrible. We used NHibernate what with being sold down the river by Udi Dahan on domain modelling etc. That was a huge mistake too. Dapper is the only ORM that hasn't screwed us in some way.
Re:20 Years of .NET by jermaustin1 on Monday February 14, 2022 @09:14AM (#30332227)
Early on I liked Linq2SQL, and I think I still do, but it might be just looking back with rose colored glasses.

When I thought I needed better control and performance I wrote my first ORM. Which wasn't really all that ORM-y. It would use reflection to map to an object, but queries definitely weren't linq-able or using IQueryable and walking the predicates to dynamically generate queries. It was more like dataBase.TableName.First("id=@id", new {id = 1}); Which would generate "select * from TableName where id=@id" nothing earth shattering. Joins were done through dataBase.Join(new [] {"table1", "table2" }, new [] {"on table1.id=table2.table1_id"}, "table1.id=@id", new {id=1});

It was ugly and I eventually just replaced it with straight ADO.net.

I tried various other ORMs over the years, I eventually just settled on EF since it was not bad, and generates almost sane SQL most of the time.

Re:20 Years of .NET by thrower123 on Monday February 14, 2022 @09:44AM (#30332568)
I still like Linq2Sql better than EF.

It always made more sense to me to have a sanely-designed database first and then generate the mapping code from it, rather than the code-first style that seems to be popular with EF. You can do the database-first mode with entity framework, but it is less the happy path that the tooling and documentation tries to nudge you into.

Re:20 Years of .NET by Weebs on Monday February 14, 2022 @12:43PM (#30335132)
I've always been frustrated that active record ORMs have completely overtaken tools like Linq2Sql.

I don't deny the value of the active record pattern where it works, but in almost every case I've used SQL over the past 5 years, I don't want a complex abstraction layer. I just want something to make it easy and safe to talk to the database for the 90% of straight forward queries we write.

With something like that, I feel as though I'd rather write my own active record system than use the configuration based systems we see with EF

Re:20 Years of .NET by throwaway6532 on Monday February 14, 2022 @03:44PM (#30338053)
>One dark place some .NET devs got caught in the early days was some of the 3rd party ORMs. Nightmare of weird code, proprietary mapping tools and headaches.

I'm looking at you LLBLGen

Re:20 Years of .NET by smackeyacky on Monday February 14, 2022 @04:06PM (#30338363)
Also EntitySpaces. Not sure what they were thinking. Anything that used EntitySpaces needed a complete re-write as it spawned a living hell of class definitions and mappings that locked you into a particular style of programming that was hideous.
Re:20 Years of .NET by bayesian_horse on Monday February 14, 2022 @07:07AM (#30331025)
The question is not if you get paid or not but rather if you wouldn't get paid more doing something arguably more productive..
Re:20 Years of .NET by hughrr on Monday February 14, 2022 @07:09AM (#30331036)
I've stopped caring but if I had to I could be paid a lot more to do something more productive. But sometimes it's nice to sit there and watch visual studio crash 30 times a day or lagging out when I hit a key because it makes me angry enough to go for a walk which I really enjoy :)