Jump to content
357mag

Should I just dive in to GUI programs?

Recommended Posts

I'm considering working in Delphi for awhile, and I was looking through my books (I have four of them), and every book starts off right away with Windows programming. None of the books teaches you console programming. Personally, I like console programming. I was wondering if there is a reason all of my books starts you off that way. Perhaps because Delphi is a clean, fairly easy to grasp language?

Share this post


Link to post
2 hours ago, 357mag said:

I was wondering if there is a reason all of my books starts you off that way.

Maybe because the majority of end users are not console users, and the books want you to reach a larger userbase more quickly?  Just speculating...

Share this post


Link to post

Yes, you should! Console programming (Like Unix utilities) are mostly included in GUI programs... without GUI.

Share this post


Link to post
13 hours ago, 357mag said:

I'm considering working in Delphi for awhile, and I was looking through my books (I have four of them), and every book starts off right away with Windows programming. None of the books teaches you console programming. Personally, I like console programming. I was wondering if there is a reason all of my books starts you off that way. Perhaps because Delphi is a clean, fairly easy to grasp language?

GUIs are just the majority of the applications build with Delphi. But you can easily build console programs with it, too. The File -> New  dialog also offers a template for that.

Share this post


Link to post

Console programming is easy with Delphi.

The books will learn you the Delphi (Pascal) syntax and that is one of the most easy to learn of all the programming languages.

 

14 hours ago, 357mag said:

None of the books teaches you console programming.

That was dummzeuch's conclusion already 10 years ago: twm's blog

Important Console with parameters (With a Gui example..)

 

 

Share this post


Link to post

If you prefer working from the command line, why not just use something that's oriented that way? I mean, you don't need a language as complex as Pascal to write simple scripts. Try playing with bash or sh or ksh or some other shell scripting language. 

 

The thing you're missing in just focusing on the command-line is not the GUI, but the entire Event-Driven ecology. That's what really sets Delphi apart from even simple Pascal. 

 

if you don't want to mess with a UI, then consider playing around with back-end services using one of the many REST frameworks that are available for that. Nobody gives two craps about Pascal today. Delphi is still alive and kicking because of the VCL, which is mainly an EVENT-DRIVEN FRAMEWORK. That's how it SUPPORTS such a rich and complex GUI environment.

 

The basic Pascal language and RTL is available to command-line apps, but nothing from the VCL or FMX frameworks are, even though that's where 99% of the VALUE lies.

Share this post


Link to post

I view console applications not just as user (prompt) programs, but also as tools for performing tasks that just don’t require a GUI.

We have numerous console applications that are often started by a task scheduler or installed as services.

These programs are hard to write with scripts alone, which is why we use Delphi and its tools and libraries. (such as FireDac, sFTP and the mORMot HTTPs web server).

These applications handle all the automated processes and tasks essential for our company. All the code can of course used in other projects for GUI or console applications.

 

 

 

Share this post


Link to post

Delphi is perfectly happy to create a console app (I have lots that I've written). In fact, if you have a Delphi GUI app, you can just change the dpr to say {$AppType console} and now your "GUI" app can use writeln; handy for debugging (if you have bugs).

Share this post


Link to post
3 hours ago, David Marcus said:

In fact, if you have a Delphi GUI app, you can just change the dpr to say {$AppType console} and now your "GUI" app can use writeln; handy for debugging (if you have bugs).

You don't need to change the AppType to use WriteLn().  A GUI app can simply call AllocConsole() or AttachConsole() and then WriteLn() will automatically work.  That being said, another way to debug would be to use OutputDebugString() instead, and then you can see the messages in the IDE's debugger, or in SysInternals DebugView when running outside of the debugger.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×