Recent

Author Topic: Well-aged Online Information (it's not wine!)  (Read 3175 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 564
Well-aged Online Information (it's not wine!)
« on: November 11, 2024, 08:56:49 pm »
Quite a bit of the fpc/lazarus-realted documents you can encounter online are well over ten years old, and fpc/lazarus has clearly moved on in that period of time.  So a general question:  at about what age should information online be treated as probably obsolete and not worth studying?  For example, some of articles by Michael Van Canneyt here predate 2008:  https://www.freepascal.org/~michael/articles/.

I know "it depends," but in general how old is too old to be worth the time investment?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11941
  • FPC developer.
Re: Well-aged Online Information (it's not wine!)
« Reply #1 on: November 11, 2024, 11:39:30 pm »
It depends :-)

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Well-aged Online Information (it's not wine!)
« Reply #2 on: November 11, 2024, 11:57:10 pm »
Same answer as marcov  :D

However, even if the information is outdated it enriches my understanding of the topic. For me personally it does not really matter if the information is actually outdated, as it is more about the thought(s) behind it that counts.

Even code from the 80's that do not have any meaning in this day and age is able to provide valuable insight on how to approach a certain topic.

In general I find Michael's articles precise and to the point.

2 cents
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: Well-aged Online Information (it's not wine!)
« Reply #3 on: November 12, 2024, 12:44:47 am »
Thank you for that link, added to favorites!.
The only true wisdom is knowing you know nothing

Warfley

  • Hero Member
  • *****
  • Posts: 1758
Re: Well-aged Online Information (it's not wine!)
« Reply #4 on: November 12, 2024, 01:08:36 am »
Well there is a lot more features in the FPC today than there was some time ago, BUT... the old way of doing things is still around and many people actually prefer it.

For example, many people used Pascal 10 or 20 years ago or even longer, and if they want to get back into it, you still can program like its 1998. Simultaneously there are a lot of old Pascal codebases, written in TP or older Delphi versions, which can be ported to FPC easily. And either they have to run in old modes to be backwards compatible, so new Features are not possible, but also it is generally not a good idea to mix coding styles within a codebase.

So all of that old information is often far from outdated, it still has a lot of value. That said, whats missing is some resources about new programming styles and paradigms. Generics, advanced records with operator overloading, management operators, etc. allow for a lot of very interesting stuff.
I myself spend vast amounts of my free time just trial and erroring around what new things are possible by now and there are now completely new ways to write your code

But I often feel like that it's hard to communicate these concepts because they are just not that well understood, because a lot of people still program, out of necessaty or habit, still like its the early 2000s and Delphi 7 just came out.

But I think it's not just resources, it's also often times that the RTL, FCL and LCL are still quite tailored to the "old" style of doing things. There is some change in that, I have contributed some of the things I built over the years myself, but when you look into many of the FCL or RTL packages the function headers often say dates starting with 200X.
I just looked at fpjson, because for some reason that was the first unit that came to my mind when thinking about fcl, and it was written in 2007. Sure the unit works and is certainly usable but if I'd redesign the unit with modern Pascal from the ground up, I would do a lot of things certainly different. E.g. you could use reference counted COM interfaces with operator overloading to have transparent conversion between base types and json data. Use TNullable with it's upack, getordefault and co method instead of the dozens of overloads with default and find methods, etc.

Code could be as simple as:
Code: Pascal  [Select][+][-]
  1. json := [
  2.   Pair('Key1', 'Value1'),
  3.   Pair('Key2', 3.14),
  4.   Pair('Key3', [
  5.     42,
  6.     'Hello World',
  7.     [
  8.       Pair('Subkey1', True)
  9.     ]
  10.   ])
  11. ]
Instead of
Code: Pascal  [Select][+][-]
  1. json := TJsonObject.Create;
  2. json.Add('Key1', 'Value1');
  3. json.Add('Key2', 3.14);
  4. jsonArray := TJsonArray.Create;
  5. jsonArray.Add(42);
  6. jsonArray.Add('Hello World');
  7. subObject := TJsonObject.Create;
  8. subObject.Add('Subkey1', True);
  9. jsonArray.Add(subObject);
  10. json.add('Key3', jsonArray);
  11.  

Thaddy

  • Hero Member
  • *****
  • Posts: 16178
  • Censorship about opinions does not belong here.
Re: Well-aged Online Information (it's not wine!)
« Reply #5 on: November 12, 2024, 07:48:14 am »
I am one of the dependers.
Some old code, however, is not worth translating, e.g. if 16bit basm is used for sound and the likes.
Unlike what @Warfley writes it is possible to a certain extend to add new features to old code using modeswitches but I usually try to remove deprecated code and replace it if I feel it is necessary or warranted to do partial rewrites.

It is not recommended to mutilate a certain mode, say, TP mode, but it is actually lots of fun to write your own bastard mode by playing with modeswitches and also HAS_FEATURE_XXX
Being mostly on trunk, I tend to use loads of modeswitches anyway.
If I smell bad code it usually is bad code and that includes my own code.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11941
  • FPC developer.
Re: Well-aged Online Information (it's not wine!)
« Reply #6 on: November 12, 2024, 09:44:00 am »
Warfley: I assume long term it will all go to system.json as that is delphi compatible

Bogen85

  • Hero Member
  • *****
  • Posts: 695
Re: Well-aged Online Information (it's not wine!)
« Reply #7 on: November 12, 2024, 11:23:45 am »
Well there is a lot more features in the FPC today than there was some time ago, BUT... the old way of doing things is still around and many people actually prefer it.

For example, many people used Pascal 10 or 20 years ago or even longer, and if they want to get back into it, you still can program like its 1998. Simultaneously there are a lot of old Pascal codebases, written in TP or older Delphi versions, which can be ported to FPC easily. And either they have to run in old modes to be backwards compatible, so new Features are not possible, but also it is generally not a good idea to mix coding styles within a codebase.

Not everyone has the luxury for the bulk of what they do computer wise of being in programming environments where being a decade or two behind is more than adequate. Yes, FPC has new features, but in most forward moving sectors in the computing industry those new features are not enough (while it is possible tooling and libraries could make up for some of that, the necessary momentum is not there) , and holding on to doing things the old way is counter productive.

But I agree. If the old works for what you do, stick with it. But if you need the new, migrate to the new and focus on that, and it is best not to mix.

Warfley

  • Hero Member
  • *****
  • Posts: 1758
Re: Well-aged Online Information (it's not wine!)
« Reply #8 on: November 12, 2024, 12:50:15 pm »
Not everyone has the luxury for the bulk of what they do computer wise of being in programming environments where being a decade or two behind is more than adequate. Yes, FPC has new features, but in most forward moving sectors in the computing industry those new features are not enough (while it is possible tooling and libraries could make up for some of that, the necessary momentum is not there) , and holding on to doing things the old way is counter productive.

There is no right or wrong way to develop. No matter at what level you look, you see both conservative and modern language approaches.
In the low level area both C and C++ are extremely popular, with C only getting a hand full new features every decade or so, while c++ is basically a completely new language every major revision of the standard.
Also in the higher level world you have languages like java or go, which evolve extremely slowly, and you have languages like C# or Swift that adopt new features rapidly.

There is no clear preferable solution. Personally I love playing with new concepts, but sometimes working in an environment where there is just one clear way to do something can be very beneficial. I often recognize myself working in C++ that I spend more time thinking about what's the most elegant way to do something, while in C I just do it the only way possible. And even though the C way is often more painful, it's somehow relieving being able to just concentrate at the problem itself and not on the language features that may facilitate the solution.

And this is why C is still so popular, and C++ or rust or any other feature packed modern language will never replace it.

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: Well-aged Online Information (it's not wine!)
« Reply #9 on: November 12, 2024, 12:52:55 pm »
For example, some of articles by Michael Van Canneyt here predate 2008:  https://www.freepascal.org/~michael/articles/.
I think these articles are extremely valuable. Their age is no argument that they might be out-dated.

Thaddy

  • Hero Member
  • *****
  • Posts: 16178
  • Censorship about opinions does not belong here.
Re: Well-aged Online Information (it's not wine!)
« Reply #10 on: November 12, 2024, 01:28:42 pm »
No, it is not, the articles are very good indeed and all principles hold and most if not all fpc specific code still works.
(there are exceptions to some of Delphi specific code relying on libraries no longer available)
« Last Edit: November 12, 2024, 01:34:14 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

VisualLab

  • Hero Member
  • *****
  • Posts: 573
Re: Well-aged Online Information (it's not wine!)
« Reply #11 on: November 12, 2024, 05:43:51 pm »
And this is why C is still so popular, and C++ or rust or any other feature packed modern language will never replace it.

I disagree! The C language will be replaced, probably on February 31, 2124. A week later, Linus Torvalds' great-grandson will release the Linux kernel written in Python, and nVidia will provide the source code for its graphics card drivers for Linux, written in JavaScript. Microsoft will launch a new operating system: Doors, written in Object Pascal. This system will run on 1024-bit RISC-V processors and will primarily serve to display advertising using AI. Hardened programmers of the new trend will write in Rust, using the hundred-year-old VSCode. At that time, two new programming concepts will appear in Rust: stealing a variable and buying a variable. And the few 150-year-old C++ programmers will have a new solution for automating project building: CMakeMake++. This tool will be based on a new programming language that will use pure functions, statelessness and monads and will generate code for CMakeMake, which will in turn generate code for CMake++, which will in turn generate code for CMake, and then it will be easy, because that's how it's done today :D

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 564
Re: Well-aged Online Information (it's not wine!)
« Reply #12 on: November 12, 2024, 06:05:45 pm »
Here is perhaps a better example of the "too old" material on the internet:  https://www.bastisoft.de/programmierung/pascal/pasinet.html .  In this case, the author added the helpful "caution" at the top of the page, but that's unusual,   It wasn't my intent to aim any criticism at Van Canneyt's many contributions.  (I still have my old copy of Mastering Turbo Pascal 5.5 and my TurboC Reference Guide).







« Last Edit: November 12, 2024, 06:44:44 pm by Curt Carpenter »

Thaddy

  • Hero Member
  • *****
  • Posts: 16178
  • Censorship about opinions does not belong here.
Re: Well-aged Online Information (it's not wine!)
« Reply #13 on: November 12, 2024, 06:25:08 pm »
Well, At least C makes you THINK before you use it - otherwise it won't work at all -, but it is a horrible concept and just for productivity.
Whereas Pascal is derived from thinkers, loved by thinkers, and also works for mere mortials.
You can't always get what you want, although Pascal and Cobol payed my pension, not C! (well, a little, as did Java)
But my pension is OK and I am enyoing it. (apart from the Dutch government changing the rules of the game mid- life and it is not 65, but 67'sh, stealing two years of income. BTW I agree with that theft!, the French could read this, with their 60 years.... silliy  8-) )

« Last Edit: November 12, 2024, 06:34:51 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

VisualLab

  • Hero Member
  • *****
  • Posts: 573
Re: Well-aged Online Information (it's not wine!)
« Reply #14 on: November 12, 2024, 07:43:09 pm »
Well, At least C makes you THINK before you use it - otherwise it won't work at all -, but it is a horrible concept and just for productivity.
Whereas Pascal is derived from thinkers, loved by thinkers, and also works for mere mortials.

I hope Dennis R. and his helpers burn in hell :D At least for the preprocessor, macros, unreadable function pointer syntax, and the build system.

But my pension is OK and I am enyoing it. (apart from the Dutch government changing the rules of the game mid- life and it is not 65, but 67'sh, stealing two years of income. BTW I agree with that theft!, the French could read this, with their 60 years.... silliy  8-) )

In some EU countries, governments have also extended retirement times. Bismarck's pension model is inefficient in an increasingly socialist and ageing Europe. One day it will end up like Venezuela (or worse). Most politicians in EU countries are trying to mask the problem and delay the bankruptcy of state budgets (which are terribly indebted).

 

TinyPortal © 2005-2018