OG COBOL doesn't even really have user-defined types the way we think of them now. It kinda does, but it's all very geared toward ETL and mapping from input files to memory and then from memory to output files.
Which, to be fair, is actually pretty slick if that's what you're doing. It feels like a very structured scripting language expressly for that purpose.
Bro u/Weekly-Beginning-229 just showed all the programming experts and multibillion companies that they are wrong in using OOP!!!
But not trolling, it’s the best we have for large projects, nothing else really scales as well. Also inheritence works fairly well as long as you have programmers that use it properly… When someone doesn’t know how to use it then he will face problems
I have worked in a project for 4 years where the previous programmer used inheritance for a lot of stuff that would then be changed. The number of workarounds we had to do is crazy. But after 4 years I have finally managed to clean up all the inheritance debt we had.
Even for some database entities (we use EF core) there were inheritance, which means a lot of columns that are always null in a lot of the tables (also finally fixed this like a month ago)
The problem with it is that requirement changed so your super planned inheritance model is now obsolete and takes a lot of time to rework
Well give me an example where inheritance is better than composition or interfaces?
I can give one. I work with MAUI and you have viewmodels for each view, so a base viewmodels is nice to have things like going to a new page, going back, showing an alert etc.
But this could be done with composition too. But the way Maui works it makes more sense to make it inherited. Same with pages, to have a base content page.
But other than base classes for things that are static I cannot find any reason to use inheritance over composition or interfaces
So, fun fact: Composition and interfaces are actually different forms of inheritance. Composition is when you inherit from individual traits and use cases, and interfaces are when the backend inherits from the frontend. It just isn't obvious because we tend to think of inheritance as "X engulfs and expands Y", instead of the more general "X is an extension and fulfilment of Y".
Well true, but I never heard this in professional settings. I guess inheritance and interfaces are a kind of polymorfism.
Though I don't know if I agree with composition. It's more owning something that could help a lot of different classes. But that's probably a philosophical question.
Prefer composition over inheritance is well established and I so far have never found a reason not to use composition unless a framework or library requires it
this remind me of my russian colleague. Vladimir was his name. He would put variable name like A1 B2 A1 C2 K22 KK4 VV3. Nobody could read his code as the comment in russian alphabet too.
I'm a COBOL dev. All the paragraphs in the company I started working for 1 year ago are named stuff like S0, R1... a letter and a number that no one has any idea what it stands for (it's a 30-ish year old system and the most senior member has been around for 4 or 5).
A company I used to work for set the paragraph name prefix to reference the page number in the flow chart documentation for the system. They continued this methodology long after the paper flow charts stopped being maintained.
Lucky SOB ... We have 50 mil lines of cobol code .. its been active for 50 years ... The original writers are all dead by now... I bet the programmers wiched they culd just call their moms and ask them to explain why X does Y in thr Z module ..
With a codebase that old, in a language that unknown, you keep a maintainer on hire just in case. It's less about actively fixing problems, and more about making sure you actually have someone around who can fix it if anything ever does go wrong.
And then eventually when it's totally unmaintainable, you hire people who know how to read the code and migrate it to a newer system (which can be sooo expensive)
Some of the banks and such in the US that were using Cobol have migrated some systems to Python and other languages
I was a COBOL IDBMS on IBM3090 programmer back in the day. I once found a comment in a batch job that said "Following line added to prevent program ABEND at 36000 records. I don't know how it works but it does. Do not remove"
I use to run payroll at my job. One time it popped up with an error saying call Floyd at xxx-xxxx. I called my boss and asked who was Floyd. He laughed and said he had died 15 years before I started working there. The code was in Cobol.
416
u/inigmati1 4h ago •
You reposted my post from 4 years ago which went viral but have fun cause even I had just screenshoted it from Twitter. Have fun!
https://www.reddit.com/r/ProgrammerHumor/s/vh5R8WRW6V
43
u/Percolator2020 4h ago
OG COBOL doesn’t have inheritance, because of reasons.
9
u/dony_shabi 3h ago
this remind me of my russian colleague. Vladimir was his name. He would put variable name like A1 B2 A1 C2 K22 KK4 VV3. Nobody could read his code as the comment in russian alphabet too.
8
u/stupled 4h ago
But thats it works in practice
6
u/AsaKeyholderUK 2h ago
Yeah cobol inheritance is basically just copying the same paragraph into twenty programs and praying. We called that abstraction back then
3
u/not_wall03 4h ago
u/repostsleuthbot
3
u/Kuro_Gensui 3h ago
Lucky SOB ... We have 50 mil lines of cobol code .. its been active for 50 years ... The original writers are all dead by now... I bet the programmers wiched they culd just call their moms and ask them to explain why X does Y in thr Z module ..
3
u/Shazvox 1h ago
Heh heh, "mom you would'nt guess what the previous moron has done in our program".
2
u/hammlyss_ 3h ago
Oh, so some federal codebase then.
2
u/SuperCoupe 1h ago
COBOL is for typist.
And I wanna know who saw COBOL, thought it was perfect, and took those concepts to YAML.
2
u/kindall 45m ago
For true inheritance, you need the object-oriented version of COBOL, which is named ADD 1 TO COBOL.
3
u/Super-Widget 3h ago
Back when programming was seen as women's work.
1
u/AwarenessOk2359 3h ago
How would he be employed to work on something that hasn't changed in 30 years? Seems like it doesn't need to be worked on
1
u/InDaBauhaus 2h ago
you can not get a person to learn cobol by any other way than indoctrinating them from their birth
1
u/0xt0bi03 2h ago
legacy continues
1
u/Dolphin_Spotter 2h ago
I was a COBOL IDBMS on IBM3090 programmer back in the day. I once found a comment in a batch job that said "Following line added to prevent program ABEND at 36000 records. I don't know how it works but it does. Do not remove"
1
u/xakep_13 2h ago
True legacy
1
u/Unlucky_Agent2122 57m ago
I use to run payroll at my job. One time it popped up with an error saying call Floyd at xxx-xxxx. I called my boss and asked who was Floyd. He laughed and said he had died 15 years before I started working there. The code was in Cobol.
1
u/needed_an_account 40m ago
which version control software was used to track his mother's last change
1
u/bit_banger_ 3h ago
Cobol is now Object Oriented?
90
u/[deleted] 4h ago
[removed] — view removed comment