CSharp/.Net Compared With Delphi/Lazarus

If you never heard about Delphi/Lazarus you should know that C# is created by the very same person that created Delphi/TurboPascal language.

Delphi is a Pascal based language, but if you will replace "begin ... end;" with "{ ... }" you will see strikingly similar.

Which are similarities that you may notice:

- Windows.Forms is similar with Delphi VCL/Lazarus LCL.

- Visual Components can be added dynamically as you can add inherited classes of UserControl

When to use Delphi or Lazarus:

- when your user have not installed .Net or Mono on their machine and you don't want to ask them to do it

- when you have code already written in Delphi/FreePascal and you don't want to rewrite in C#. Also using DLLs (written in C) can be imported without thinking about PInvoke and Marshaling

- big applicatiions in .Net can start slower because it use a Just In Time compiler. Another reason of slowness may be string manipulation

- your application is memory constrained. Typically .Net applications use more memory than their Delphi/Lazarus counterparts. If you know that your users will use outdated machines you may consider writing in Delphi or Lazarus

- you want one code for all platforms and this code you want to use native controls. This can be done with Lazarus and if you go around bugs of every toolkit you will have a native de-facto application

The best in my mind kind of program that enters in this category is Total Commander (written in Delphi): utility program, you want to start fast, run fast, to make that even you let it running to not feel as memory consumption

When to use C#:

- you have to work with more kinds of data/applications and you want that all subsistems to be done with tutorials over the internet and with free to use licenses

- you have components that are written in C#. Because of C# popularity you will find a lot of components, mostly on client side (Windows Forms, WPF, etc.) that do a lot of your job. Are also easy to instantiate and to integrate

- you want a free advanced IDE. Lazarus is a small child compared with both Visual Studio, SharpDevelop or MonoDevelop. They all offer to you refactor and bigger projects navigation. All give a visual designer. On Windows side VIsual Studio Express offer great visual form editor, connections wizard and so on, without paying a penny

- you want to write in multiple languages, not just Delph. You can use functional programing using F#, or VB.Net, or use dynamic languages as IronPython or IronRuby. This make easier to use all knowledge and to solve the problem in the best language you need. In Delphi you have just one option

- when your application is fairly big but startup time is not an issue (look on JIT startup): garbage collector is your friend, you will not leak that easily memory. If you have multithreaded libraries, is sometimes hard to know who have the ownership of an object, letting it for garbage collector to decide, will make your code less error prone and more robust. You have a great multi-project management tools in all .Net IDEs, if you will want to use Lazarus, there is no such thing as "solution" management.

- when you want web development: Asp.Net is cloned by Mono implementation as an Apache module or as XSP2 server. Silverlight/Moonlight can offer to you one codebase for rich client experience with no Delphi/Lazarus equivalent

- 64 bit: when you will have an application that needs to run in a Windows 64 bit, Delphi have no 64 bit implementation yet (still is announced a preview compiler will be launched in 2011). Lazarus have a 64 bit compiler though