Recent

Author Topic: New User, Some Questions  (Read 3032 times)

Mitchell92

  • Newbie
  • Posts: 5
New User, Some Questions
« on: May 30, 2016, 11:27:15 pm »
Hello,
I had an interest in learning Delphi,  and some very friendly individuals on Freenode pointed me to the direction to Free Pascal and  Lazarus.

I had a few general questions:

Delphi and Free Pascal, programming wise - Are there differences? If so, what?

If I write an application and give it to someone, will they need to install anything to run it? Any Free Pascal runtime, libraries, any of that, or do they just take my executable (in most cases) and execute it?

What are the major differences between the two?

I have limited knowledge, I've played around with Delphi and Free Pascal, and so far I haven't noticed differences, yet I was just doing very simple tasks, outputting text as well as results of variables.

As far as cross-platform applications goes, I am assuming I would need to actually compile on that specific platform? For example, if I were to design an application and want to permit Mac users to use it, I would have to then compile on a Mac, or would the Free Pascal compiler be able to compile for another platform on the native platform (if that makes sense?)?

An overall question would also be... I'm interested in learning Pascal, I looked at Delphi because of the RAD "things", and I'm told Lazarus and Free Pascal are just as good... Are these all good and accurate statements? Is Free Pascal the right way to go?

I'm just trying to make sure that I'm going in the right direction, and this is the right way to go... I like what I see so far, I just really want to make sure everything will work correctly and that Free Pascal is "just as good" as Delphi, I guess is a way to put it. I don't mean that in an offensive way... I like free, can't beat that... I guess I am just trying to make sure that Free Pascal will work just as good as the non-free products. I am liking what I see so far, I would just be frustrated if I took the time to learn some things then realize that Free Pascal isn't all that great that I keep hearing it is.

Thanks again.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: New User, Some Questions
« Reply #1 on: May 30, 2016, 11:56:01 pm »
There are any number of differences, not sure from what you ask what's important to you and what's not.

Perhaps another way of approaching this decision for you would be to ask what it is you hope to accomplish. If you just want to learn a programming language, for example, Object Pascal, then Free Pascal and Lazarus would be as good as any way to do that. You may find it even easier than Delphi because you'll be in good company here with many other hobbyist / beginner programmers.

If your goal is to create legacy-type desktop apps, then I would imagine Lazarus and Delphi would both be find for that purpose. Lazarus LCL UI controls closely mimic Delphi VCL controls.

If your goal is to move into the world of mobile apps and Web apps (and combination mobile / Web apps), I'm not sure Pascal is where I would start for that, even though both Delphi and Lazarus can target some mobile platforms (iOS and Android with Delphi, Android with Lazarus).

The Lazarus LCL is notable in that it sits on top of the "native" GUI, eg, WinAPI for Windows, GTK2 for Linux, Carbon for Mac (Cocoa not yet fully supported, it appears). You can also target Qt, although this might make more sense for large apps since you would also need to ensure that the Qt libraries are installed along with your app. (Even Microsoft uses Qt - eg, MS's fine Remote Desktop app for Mac includes the Qt .dylib libraries in the .app bundle.)

For distribution, you normally create an installer (.exe) for your app. For example, you can use the free InnoSetup to create an installer for Windows. On Mac, you use the hdiutil utility to create a "disk image" (.dmg) for your app. You will also need to write one or more scripts to create a proper app bundle (.app) on Mac since Lazarus creates only the most generic bundle.

-Phil

Mitchell92

  • Newbie
  • Posts: 5
Re: New User, Some Questions
« Reply #2 on: May 31, 2016, 12:13:16 am »
Thank you... That answered it for me!

Yes, I am looking to hopefully learn Object Pascal this summer, so Free Pascal seems like it'll go amazing!

Desktop applications, yes. I am trying to get going there.

Mobile apps... If Free Pascal can compile for Android, I may eventually be tempted to go there.

When would I target Qt? If Free Pascal can compile native windows applications, using a GUI with thee winAPI, what is the need for Qt?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: New User, Some Questions
« Reply #3 on: May 31, 2016, 12:20:14 am »
Good question about Qt. Since Qt is available on all platforms, I suppose there might be a case where the resulting apps are more consistent across platforms when Qt is used than when the native UIs are used. That might have been more important at one time when Carbon, say, was immature, than it is now.

Carbon LCL apps are limited to 32-bits, so Qt might be a way to create a 64-bit app with Lazarus if that's important to you. Virtually all Mac apps are 64-bit, although 32-bit apps run fine there too.

One of the limitations of both VCL and LCL is the difficulty of using native widgets that are not supported by the standard controls. For example, if you wanted to use the Cocoa WebView control with Lazarus, you are out of luck. With both VCL and LCL you are largely limited to what the LCL supports.

-Phil

Mitchell92

  • Newbie
  • Posts: 5
Re: New User, Some Questions
« Reply #4 on: May 31, 2016, 12:50:19 am »
Thanks again for getting back to me.

I'm trying to learn Freepascal this summer as well as design an application similar to another one I designed a while back in REAL Basic. Seems like from what I'm reading through documentation / wiki things I've managed to find, Freepascal is a very powerful language.

I like what I see so far.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: New User, Some Questions
« Reply #5 on: May 31, 2016, 01:02:19 am »
One approach you could take in writing your Pascal app might be not to pay too much attention to your old app and its BASIC code. Otherwise you might just end up with a clone of that app, without really much of an advance in programming or otherwise.

Instead, maybe think about where you want to go with the app. For example, would it make sense to have a Web-based version at some point, as a companion or replacement for a desktop app? If so, then putting your non-UI code now into a dynamic library might make sense. Then you can use the same code in the form of a library virtually anywhere - desktop UI app, console app, mobile app, server app, etc.

Using a library means you're much less limited on what tools you use for the "frontend". For example, you might still choose LCL for, say, a Windows desktop app, but something else for a mobile app or Mac app. This is also a good way of enforcing a good practice that many VCL/LCL programmers don't follow: strictly separating the UI code from the non-UI code.

Here's a series of articles that cover the basics:

https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/PascalDynLibs.html

-Phil

Mitchell92

  • Newbie
  • Posts: 5
Re: New User, Some Questions
« Reply #6 on: May 31, 2016, 01:06:22 am »
Makes sense.
Thank you!

 

TinyPortal © 2005-2018