Recent

Author Topic: TP legacy shiitcode  (Read 10525 times)

lainz

  • Hero Member
  • *****
  • Posts: 4740
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: TP legacy shiitcode
« Reply #15 on: May 01, 2024, 06:13:53 pm »
The main problem is that there's no editor for Lazarus forms with highlighted text like for example in XML based UI.

In Android Studio you can design the form with WYSWYG or as well edit the XML with autocompletion. As well you can design anything in XML and include it in any form. As well include forms inside forms.

I prefer the designer because it's easier to work with.

But there are languages that are better typed by hand like Html. But in the case of Lazarus the GUI editor is similar to android studio one. So no problem I can see.
« Last Edit: May 01, 2024, 06:16:02 pm by lainz »

Weiss

  • Full Member
  • ***
  • Posts: 229
Re: TP legacy shiitcode
« Reply #16 on: May 02, 2024, 01:34:49 am »
Sorry for the rant, I shouldn't have posted. It tripped me yesterday, seeing 1's (ones) and l's ( L) in particular font where they look identical, and both used in same line of code. Not the words, but stand alone characters. I used magnifying glass, took pictures and zoomed in etc. This is the case where you literally cannot read the code, unrecognizable characters from one another.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: TP legacy shiitcode
« Reply #17 on: May 02, 2024, 11:28:25 am »
Right. So basically this is nothing at all to do with Pascal, but is down to (a) the typefaces available in your chosen OS (whether it be a desktop environment or some sort of terminal) and possibly (b) the typesetting used wherever you got the original code (you haven't told us whether it was an academic paper, a printout, or something machine-readable).

Nothing To Do With Pascal. In the same way that people who criticise C because the braces can be confused with parentheses should be yelling at their hardware suppliers, not criticising the language.

OK, having got that out of the way I will relent somewhat, and concede that when ALGOL was designed they specifically selected a character repertoire that made it suitable for published papers: they didn't necessarily intend that that would also be used for coding. But in any event, they chose nice unambiguous BEGIN and END rather than any special characters available to the ACM and AMS typesetters.

But at the same time, virtually all ALGOL derivatives have fouled things up by allowing "I", 'l" and "1" in identifiers. But they couldn't very well exclude capital i because of its special significance to FORTRAN. And then there's "O" and "0", ' vs ` and so on.

And all of the original ALGOL derivatives allowed block-local variables to "shadow" those further away, and didn't even attempt to raise a warning if they realised that the name of a variable was a substring of another. Now mix /that/ in with Pascal's case-insensitivity, which was the result of Wirth coming from a 6-bit character CS background rather than a 7-bit character comms one.

It's a mess, and gets worse when one considers Unicode and the (in effect) multiple codepages it tries to support.

But the original OP problem is nothing to do with Pascal, or with any other language: it's a hardware and OS issue.

Here endeth the rant. Pax vobiscum.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 698
Re: TP legacy shiitcode
« Reply #18 on: May 02, 2024, 06:07:46 pm »
I wonder what software developers will be saying about today's languages, IDEs, code and practices fifty years from now?  (Assuming "software developer" hasn't gone the way of "blacksmith" by then.) 

Or have we simply painted ourselves into a corner at this point, with no hope of improving on the first drafts of the past 75 years?


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12593
  • FPC developer.
Re: TP legacy shiitcode
« Reply #19 on: May 02, 2024, 06:34:11 pm »
Or have we simply painted ourselves into a corner at this point, with no hope of improving on the first drafts of the past 75 years?

I think it is more that hyped forecast predicted exponential growth, but IT is now entering a replacement market with linear growth.

That is overall of course. There are still hypes in smaller niches like blockchain and AI. But the question is if this really will significantly increase long term average worker productivity.  Just see all the bla about WIndows 12 AI, and the very low coverage of what that exactly means (but it does seem to know how much TOPS you need for it, because next years sales depend on it)

VisualLab

  • Hero Member
  • *****
  • Posts: 706
Re: TP legacy shiitcode
« Reply #20 on: May 02, 2024, 07:33:34 pm »
Not the first time I am trying to use some ancient TP code, and naturally wonder if back in a day they could read what they wrote. Everything, beginning from naming variables, to user input validation (often none) hold no water. Scarce comments, or no comments. Needless copying of arrays. I am very new myself, but that code is written by PhD and such.

And, code published in articles sometime definitely never been compiled, because it contain errors, syntax and logic errors as well. Sometimes I can unwind the logic and see what was meant, and re-write. But then I wonder, if article was published and being referenced in other work, how come no one reviewed for 30 years?

If it was a TC (Turbo C) code, this comment would appear on another forum. You simply took the TP code. In my opinion, the reason for problems with poor code is that the author of such code did not have sufficient knowledge of the language (here: Pascal) and experience in using it. But also (or above all) he lacked diligence and common sense and was lazy. The more sloppy, lazy, impatient and thoughtless people are, the worse the code they create.



1. those who reviewed it found the code to be "fine", they would have coded it the same way (or maybe worse.)

Quite probable.

3. they have a PhD in computer science with a minor in covfefe from trump university and the whole thing went so far above their head international space station folks sighted a ufo.

I think that if they had a PhD in gender studies or eco-Marxism from Obama University, von Leyen University or Lenin University, it would not be better.

One important thing to keep in mind: just because something is published doesn't mean it's any good.

I completely agree.



In summary: what now looks like bad code from yesteryear is partly due to language limitations. But also evolving programming paradigms, which in turn lead to bad programming because of over-use of components in Object Pascal.(sigh)
Code: Pascal  [Select][+][-]
  1. //recenty seen, simplified:
  2. TBeepComponent=class(Tcomponent);
  3. private
  4. public
  5.   procedure beep;virtual;
  6. end;
  7. procedure TBeepComponent.Beep;
  8. begin
  9.    system.Beep;
  10. end;

I am amazed at how the Java-C# paradigm can be attacked like this! This is IT blasphemy  :D :D



I consider controls that can be placed at design time a feature to assist people new to using Lazarus. It’s much easier to create at runtime.

Of course. Designing a GUI "blindly" is not a good idea. When coding the GUI by hand, more time is wasted on fine-tuning the details.



I don't agree but I guess you speak in general. Components are a way of distributing building blocks. You don't need to know how a TDataset works and how DBF indexes are set up when you drop a TDBF component on your form.
I am very happy that I don't had to figure out TCP/IP or email protocols but just can drop an Indy component on a form.

Absolutely. Classes derived from TComponent are really very useful for objects with complex functionality. This has the disadvantage that someone has to create these objects (design, implement and test). But he does it once. An alternative approach can be used: many small objects. However, then there is the problem of relating many small objects (and this still needs to be tested). This is a good method for smaller programs. It is known that there is no perfect method.


440bx

  • Hero Member
  • *****
  • Posts: 6017
Re: TP legacy shiitcode
« Reply #21 on: May 02, 2024, 09:39:46 pm »
I think that if they had a PhD in gender studies or eco-Marxism from Obama University, von Leyen University or Lenin University, it would not be better.
Hard to say, none of the people you mentioned created a "university" to con the gullible out of their money.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: TP legacy shiitcode
« Reply #22 on: May 02, 2024, 09:45:40 pm »
In my opinion, the reason for problems with poor code is that the author of such code did not have sufficient knowledge of the language (here: Pascal) and experience in using it.

At the same time, zhe might be a renowned expert in the field of application. That is something I've had to contend with numerous times in acadaemia, and also when finding (e.g.) a retired bank manager writing a chequebook program in stilted Visual Basic.

Perhaps the Lazarus IDE needs some analogue of the derided MS "Clippy": "You've just spent 200 lines explaining ** to me that you want to do something that I think can be better handled like /this/".

MarkMLl

** Rereading that, I'm reminded of the passage in "The Moon is a Harsh Mistress" where the protagonist /explained/ the changes he wanted to a computer using Loglan. However considering today's emphasis on pattern matching dressed up as "AI", I feel we're heading in that direction even if the results are unlikely to be reliable.
« Last Edit: May 02, 2024, 09:52:42 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Weiss

  • Full Member
  • ***
  • Posts: 229
Re: TP legacy shiitcode
« Reply #23 on: May 02, 2024, 10:23:35 pm »
I think, back in the day programmers lacked the keyboard skills. I bet for most of you it takes no time at all to complete typing the whole word, variable or function name which would say what it is or what it does.

Also, judging from the fact that published code never been compiled (it wouldn't), I would say, access to mainframe terminal was probably a factor. It was for everybody at the time.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: TP legacy shiitcode
« Reply #24 on: May 02, 2024, 11:04:39 pm »
I hired a typewriter and did my own dissertation in ~'79, programming was still based around cardpunches.

By the time I did my masters I had experience with a dedicated word processor, and had set up a general-purpose computer to handle proportional spacing etc.

/However/, this has limited bearing on the quality of (Pascal etc.) code produced by somebody who has limited programming skill.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 698
Re: TP legacy shiitcode
« Reply #25 on: May 03, 2024, 01:01:54 am »
Looking for some diffusion data on something like "lines of code" (to test the suggestion that IT has perhaps entered a period of saturated growth (no luck)) I stumbled on this article from The New Yorker that seems relevant to thinking about future of programming ("shitcode" or otherwise). 

https://www.newyorker.com/magazine/2023/11/20/a-coder-considers-the-waning-days-of-the-craft

The notion of "centaurs" was new to me, and intriguing.   I wonder if/how the evolution of such a thing might effect the future of computer languages and tools for using them? 



 

VisualLab

  • Hero Member
  • *****
  • Posts: 706
Re: TP legacy shiitcode
« Reply #26 on: May 03, 2024, 12:41:35 pm »
I think that if they had a PhD in gender studies or eco-Marxism from Obama University, von Leyen University or Lenin University, it would not be better.
Hard to say, none of the people you mentioned created a "university" to con the gullible out of their money.

The people I mentioned are/were also "detached from reality" just like Trump. And just like him, they are/were pests too, of course to varying degrees.

There was a brief period at the beginning of Trump's term when it seemed like he wanted to fix something in the US economy. Because there is no doubt that the governments of his predecessors led to the economic weakening of the USA and the strengthening of China. But then it turned out as usual...

As for the name "Trump University" - it is not a rare practice to include the word "University" or "Institute" in the name of a company (business venture). I'm not a fan of bans, but this (pathological) practice of including certain words in company names should be prohibited by law (i.e. such a name cannot be registered).

Lenin, of course, did not establish companies - he liquidated them. However, many real universities (not companies) were named after him, especially in Soviet Russia.

The problem is that the leaders of countries (large organizations) are usually dishonest people (e.g. Trump, Obama, von Leyen) and sometimes even scoundrels (Lenin). The source of their political success seems to be a combination of these nasty traits.

Thaddy

  • Hero Member
  • *****
  • Posts: 18676
  • Jungle wars. And failing health it seems.
Re: TP legacy shiitcode
« Reply #27 on: May 03, 2024, 05:07:54 pm »
The problem is that the leaders of countries (large organizations) are usually dishonest people (e.g. Trump, Obama, von Leyen) and sometimes even scoundrels (Lenin). The source of their political success seems to be a combination of these nasty traits.
As a Political Scientist (M.sc, two other minor degrees, B.sc's, in different fields) I beg to differ with your opinion of Lenin. The problem for politicians is that they need to make choices between what is in their opinion achievable and what is desirable.
That doesn't mean he still comes fifth in my order, because disowning a lot of average people and the murder of Trotsky happened under his watch.
So my proposed order is from high to low and just for the America's and Europe: Hitler, Stalin, Putin, Trump, Lenin, Bush jr, Obama, von der Leyen. I left out many other possibilities from this set, including a Dutch politician who did not understand the Indonesian people and is actually a never prosecuted war criminal. Schermerhorn. He would have scored above Lenin maybe slightly lower.
Thing is that Lenin handled out of a firm belief in the ideology of Karl Marx and not in his own interest. By contrast to Benjamin Netanyahu or Trump, who handle just in their own interest to avoid jail. Based on that evidence I am quite comfortable ranking Lenin way lower than you do.
« Last Edit: May 03, 2024, 08:28:54 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 6017
Re: TP legacy shiitcode
« Reply #28 on: May 03, 2024, 07:08:43 pm »
Some things in life are genuinely amazing, like a comparison where an individual as vile and despicable as Hitler can be shown to have positive characteristics.

There exists an orange ball of incompetence, insecurity, intellectual mediocrity dipped in cholesterol that is hands down as vile and despicable as Hitler but, can do him one better because Hitler, unlike the orange messiah, wasn't a bone-spurred coward.

Hitler never founded a "university" to con his fellow citizens out of their money.  If it wasn't defunct, the orange university could, for an additional $560.00 throw in a Bible and a gold pair of sneakers with an advanced degree in infinite stupidity... what a deal !!.

But, got to really be impressed by the attempt to draw a parallel between that repugnant orange biped and other individuals who, while not perfect, have never exhibited the appalling lack of moral and ethics of the individual they are being, conveniently and self-servingly, compared to.

Conclusion: there are problems a lot worse than sh*tty code that doesn't compile.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8525
Re: TP legacy shiitcode
« Reply #29 on: May 03, 2024, 07:55:32 pm »
Please, 440bx: that really isn't necessary.

You're going the right way to get Pascal blacklisted in the USA.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018