Recent

Author Topic: Pascal vs C#  (Read 17473 times)

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Pascal vs C#
« Reply #60 on: March 07, 2022, 05:27:39 pm »
[...] is no reason to declare native languages dead. [...]
I am sorry if I came accross this way, but I never intendet to argue any of that. I was just arguing about the original point that you cannot compare Pascal to C# because Pascal is native and C# is Bytecode, quite nicely summed up in this comment (but also the sentiment behind a few other comments)
Agree... so Pascal and C# are not comparable. Native code and managed code. They are comparable only in the lang usage process.

All I am trying to say is, that there are a lot of use cases where they are comparable. Use cases where the performance might mot be the deciding factor, but where the language must convince on it's other features (and it's ecosystem).
For example for most GUI applications I've written Performance wasn't the key issue, but I wanted them to run on Linux and Windows, so Lazarus was a great solution for me, much better than C# could have ever been, but not because of the performance, performance wise, I could easiely have chosen C#.

In fact, I think that modern language design can abstract away the underlying technology pretty well, if you look at swift, it is a compiled language, but is as high level as for example C#. You can also compile python code (and this is true compilation, not just a python interpreter with the code as resource), so you could call python a native language in this respect (even though compiled python is still hellish slow because it still retains all the dynamic elements)
So declaring "native languages dead" is IMHO pretty pointless, because the choice of backends makes only a tiny fraction of how the language is usable

Afaik Wirth is even credited in the original Java JVM. But there is a big gap between UCSD and Java being popular, which is why I didn't mention that.
Also there has been a lot of development with respect to JIT optimisation in the past 15-20 years, which makes modern bytecode languages feasable in a much wider variety than back in the 90s or even earlier
« Last Edit: March 07, 2022, 05:39:17 pm by Warfley »

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Pascal vs C#
« Reply #61 on: March 07, 2022, 07:09:55 pm »
A very very abbreviated history of the JS trend is like this: ...

There is more to it than that.

In the year 2000, we would be hit by the Y2K bug, in a massive way. Or, so was the thinking. In the few years before that, just saying you could program was enough to land you into a nice job with a lease car.

But the actual result of it was, that companies investigated what programs they had running, who was supposed to manage them and, not the least important, how much money it cost them. Which made most managers sit up and take note: "HOW much?"

And of course, almost all of those programs weren't managed at all. Users bought and installed them, on demand. IT management was quite rudimentary, for the most part. Yes, for some applications there was an SLA, but most of the time, you only hired some system administrators and people for the helpdesk, to keep the network and servers up and running. Everything else was done on a hourly basis, by consultants, and paid by the departments.

So, by the year 2000, companies had a list of the software they wanted to use, with a name of the manager behind it. Which posed a problem. Because, the helpdesk was used to do everything manually. While IT and software is mostly used to automate stuff, the IT departments themselves automate little to nothing. Really weird, but true nonetheless. Before the remote desktop connections, you had to manually go to the computer, or have it brought to you.

Now, here in the Netherlands, almost all companies used Windows, not Unix. And there were a just few large companies that did automate that workplace and computer management. Automatic installation of the OS and software on demand. Initiated by booting and logging in. The helpdesk hated it at first, but when they finally understood the powerful tools they got, they became the biggest supporters. But it was a high threshold to cross. Too high for most. It only succeeded by those few, large companies, who had strong supporters who managed to implement it. I was one.

Overall, the helpdesk employees didn't like those things. They didn't get it, too complex, and preferred tinkering with computers and servers. Which resulted in Citrix servers and remote desktop connections, so they could keep doing it manually.

Later it became even easier: run the application in a browser. Now you don't even have to install the application on the server! And so everyone can spend their time constructive. Ok, the overhead is quite large, but system administrators love playing with big servers. And they could pay for them by skimping on the computers for the users.

TL;DR: Installing software is a hassle and an invitation for viruses. Don't do it! While automatic OS and software deployment would have left us with far more efficient and much faster software.

Then again, because building a web-app is far more work than building a stand-alone one, it provides lots of jobs for programmers.
« Last Edit: March 07, 2022, 07:12:42 pm by SymbolicFrank »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Pascal vs C#
« Reply #62 on: March 07, 2022, 10:08:44 pm »
All I am trying to say is, that there are a lot of use cases where they are comparable. Use cases where the performance might mot be the deciding factor, but where the language must convince on it's other features (and it's ecosystem).
For example for most GUI applications I've written Performance wasn't the key issue, but I wanted them to run on Linux and Windows, so Lazarus was a great solution for me, much better than C# could have ever been, but not because of the performance, performance wise, I could easiely have chosen C#.

I didn't do much C# after VS2005, but then the (Winforms) apps were a bit laggy.  At that time I was preparing to go to ASP.NET for webapps though, but my career went a different, more embedded way.

Technically I was reasonably happy with ASP.NET, but the management expected way too much of it. They were already on the "AI code generation band waggon" back then

Quote
In fact, I think that modern language design can abstract away the underlying technology pretty well, if you look at swift, it is a compiled language, but is as high level as for example C#.

I don't swift that well, but are C# and Java really that humongously higher level than say C++ or Delphi? Sure they cut some lowlevel stuff, and have GC, but conceptually are they really?

Quote
You can also compile python code (and this is true compilation, not just a python interpreter with the code as resource), so you could call python a native language in this respect (even though compiled python is still hellish slow because it still retains all the dynamic elements)

I never understood what people see in Python. At least not for sizeable apps. At first I thought it would go away, like Perl, but it seems to constantly reinvent itself. What makes it worth dealing with bad performance scalability, major version problems, vast, but low quality packages and their security problems, deployment ? (ok, meanwhile those Python compilers are less obscure than say 8 years ago, but still. I btw think they are more about deployment than performance)



Quote
So declaring "native languages dead" is IMHO pretty pointless, because the choice of backends makes only a tiny fraction of how the language is usable

I don't like centralizing language in discussions like this. Specially with languages in the same class, it matters less, and people promoting the language like to drag in positive vibes from all over where the language is used, while often those are across toolchains (some of which are obscure or experimental), even if those features are often not combinable within one project.

( And yes, I played with Mono in the 2000s, saw Icaza's talk at Fosdem etc. Back then it was still black magic:-)   

And then Lazarus and Delphi are more than just a language. Things like low runtime requirements (both system and dependencies), easy deployment and a certain out-of-the-box feature set surely helped. (TAChart,Indy etc)

These are the things that make Delphi still holdout in the SMB space, as well as e.g. for HMIs.

Also there has been a lot of development with respect to JIT optimisation in the past 15-20 years, which makes modern bytecode languages feasable in a much wider variety than back in the 90s or even earlier

JIT already existed in 2000 (IBM hotspot). But yeah, whole optimization as a field in general (also with native languages) has seen progression. On the other hand, it shouldn't be overestimated, specially for non-batch programming.
« Last Edit: February 14, 2024, 05:09:18 pm by marcov »

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Pascal vs C#
« Reply #63 on: March 08, 2022, 12:26:48 am »
I didn't do much C# after VS2005, but then the (Winforms) apps were a bit laggy.  At that time I was preparing to go to ASP.NET for webapps though, but my career went a different, more embedded way.
I also haven't been using .Net since 2012ish so much, but I came into contact with some applications developed in .Net by people I know, and, at least WPF applications run generally pretty smooth. That said, from what I have heard, and what was already the sentiment when I used it back then, you should check that you invoke the garbage collector (e.g. by calling dispose) as often as you can manually in situations where you know you can wait a little.
Also from what I know, the garbage collection has become much faster in the past 15 years or so, Microsoft invested heavily in GC research for exactly that matter. The 10-20ms it is today is actually quite impressive, and wasn't always the case, especially in the early days of .Net like in the 00s

Quote
I don't swift that well, but are C# and Java really that humongously higher level than say C++ or Delphi? Sure they cut some lowlevel stuff, and have GC, but conceptually are they really?
Well these languages are completely build upon the concepts of OOP (for better or for worse), and abstract memory as such away to a certain degree. So in C++, you always need to know your memory, if it is stack or heap or whatever. In Delphi it abstracts a little bit with classes, but you still need to know to a certain degree what happens underneath, and you have to juggle pointers in some situations.
In C# you only have your Objects wich are either copy by reference (classes) or copy by value (structs) and in Java you do just have copy by reference and nothing else. Stack, heap, pointer, etc. those words are meaningless in these languages (funnily enough, through the way how these generational garbage collectors work, the heap is basically also a stack)
Also, while Java is still very simplistic (which is one thing I actually quite like about Java), there has been a lot of development in C# recently, such that I sometimes, when seing modern C# code, I do not recognize some features from my time of Using C# 10 years or so ago. So there are a lot of new things. And it is really weird, when you consider yourself knowing a language at least rudimentary, looking at a piece of code and having no idea what it actually does.

Quote
I never understood what people see in Python. At least not for sizeable apps. At first I thought it would go away, like Perl, but it seems to constantly reinvent itself. What makes it worth dealing with bad performance scalability, major version problems, vast, but low quality packages and their security problems, deployment. (ok, meanwhile those Python compilers are less obscure than say 8 years ago, but still. I btw think they are more about deployment than performance)
I have a hate-love relationship with python. I really like the incorporation of functional pradigms, as I love functional programming. Haskell is my favourite language I will never use (pure functional languages are IMHO too cumbersome to be usefull, as most parts of programming is doing I/O or calling APIs, in which cases your functional language needs to basically emulate imperative structures, which is a real pain in the neck), so seeing a lot of these features in python is really nice.
For example, one thing I really love about python is the ability to use higher order functions like in Haskell. At least with some hacks, but it works, see the following structure:
Code: Pascal  [Select][+][-]
  1. from typing import Any, Callable
  2. # Fixes the first argument of a function to a specified value
  3. def fix_func(func: Callable, val: Any) -> Callable:
  4.     return lambda *arg_list, **arg_dict: func(val, *arg_list, **arg_dict)
  5.  
  6. # example function
  7. def plus(a: int, b: int) -> int:
  8.     return a + b
  9.  
  10. # plus5: fixes the first argument of plus to 5, resulting in a function that always adds 5 to any number
  11. plus5: Callable[[int], int] = fix_func(plus, 5)
  12. # nine: fixes the argument of plus 5 to 4, i.e. the function plus with first argument fixed to 5 and second fixed to 4, resulting in a function always returning 9
  13. nine: Callable[[], int] = fix_func(plus5, 4)
  14. # Test
  15. print(plus5(10))
  16. print(nine())
It might seem like some gimmick at first, but once you have used it a few times, you will never miss it. Of course in a real functional language like Haskell it is much easier:
Code: Pascal  [Select][+][-]
  1. -- operators in haskell can be used as functions by putting them in brackets
  2. plus5 = (+) 5
  3. -- haskell does not differentiate between values and 0-ary functions
  4. nine = plus5 4
But thats a different story

Another thing I really like about python are named parameters:
Code: Pascal  [Select][+][-]
  1. def plus(a: int, b: int) -> int
  2.   return a + b
  3.  
  4. plus(a=5, b=4)
  5. # with default values
  6. def plus(a: int = 4, b: int = 5) -> int:
  7.   return a + b
  8. plus(b = 11)
This firstly increases readability massively on functions with a lot of parameters to simply write down the name when calling the function, while also allowing muche more felxibility with default parameters, which in languages like pascal would require multiple overloads. Also it can help to find errors, when you use always named parameters, the linter will directly throw a message if you are missing some required parameters

That said, I had the (mis)fortune to work on and with larger projects in python, e.g. I wrote an addon for Caldera and there are a few perks of writing servers with python, e.g. similarly to php, testing some new functionality basically just amounts to changing some lines and executing the script rather than having to recompile and/or deploy.
But my main problem is that python makes it really easy to write bad code.
As you might have seen in my examples above, I always write type annotations in python. If you do that, the language gets much much better to use by improving readability, but also allowing the tooling (like vscode) to give you correct suggestions and hints.
That said, most people I have worked with (in fact all whom I haven't "trained" to also use type annotations) do not use them, making interfacing with such code, especially in larger projects a real pain.
Especially if you have libraries that do not define object structures statically (i.e. in the constructor), but generate your objects dynamically. For example in the libclang, they build polymorphism not by class inheritance, but by stuffing different attributes into the same class, meaning when traversing a C++ AST, you always have a Node object at hand, but this node object might have a member field called "result_type" if it's a function, or not if it's a class definition or something similar.
This makes it really confusing to find out what fields you actually have and can access (basically when I used libclang, I used the debugger inspector to find out what I could actually access, because there was no documentation, and the code was so distributed, that it would have taken ages to find it from source).

So while I do like python in principle, working with it, especially when interfacing foreign code (i.e. pretty much every time) can be a real pain.
« Last Edit: March 08, 2022, 12:30:13 am by Warfley »

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Pascal vs C#
« Reply #64 on: March 08, 2022, 02:34:44 am »
On performance, with the usual disclaimer that benchmarks aren't necessarily representative of real world workloads, according to  TechEmpower round 20, C#/.NET came in at 8th place overall in composite score. Django placed #118 and Rails #119. Pascal is not represented. 

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Pascal vs C#
« Reply #65 on: March 08, 2022, 02:40:30 am »
Just in case someone is curious about what editor I'm talking about, it's Multi-Edit.  Works great on WinXP, it's got a few really annoying deficiencies in Win7 and, I haven't even tried it on more recent versions of Windows because more recent versions of Windows (e.g, the Win10 family) are, to me, very, very poor development platforms.

Yeah, I used Multi-Edit back in the day.

I actually stayed with a DOS editor for a really, really long time (QEdit by Semware)

I didn't like the Windows version of their product and tried both Multi-Edit and UltraEdit, and finally settled with TextPad.

Editors are a very personal thing, I have found.  :D  And it can have a tremendous impact on an individual's productivity.
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

440bx

  • Hero Member
  • *****
  • Posts: 4029
Re: Pascal vs C#
« Reply #66 on: March 08, 2022, 03:23:57 am »
Editors are a very personal thing, I have found.  :D  And it can have a tremendous impact on an individual's productivity.
Yes, they certainly are.  Without any exaggeration, I find that my productivity drops by a factor of 10 or more if I have to use a different editor.  It's downright painful.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

mpv

  • Newbie
  • Posts: 6
Re: Pascal vs C#
« Reply #67 on: May 01, 2023, 01:50:47 pm »
On performance, with the usual disclaimer that benchmarks aren't necessarily representative of real world workloads, according to  TechEmpower round 20, C#/.NET came in at 8th place overall in composite score. Django placed #118 and Rails #119. Pascal is not represented.
In TechEmpower Round #22 Pascal (mORMot2 framework) should be above .NET. See Unofficial results from 2023-04-24 where mormot is #13 and .NET is #14
« Last Edit: May 01, 2023, 01:54:20 pm by mpv »

 

TinyPortal © 2005-2018