Recent

Author Topic: Request: An "elementary program" option for Project | New Project  (Read 9648 times)

Jeff Duntemann

  • New member
  • *
  • Posts: 8
Some of you may have heard of me; I've written a number of books on Pascal and Delphi, some going back to 1985 and Turbo Pascal 2.0.

Right now I'm in the process of adapting my 1993 book Borland Pascal 7 From Square One to FreePascal, and will be making it a free ebook, in PDF format. The page size will be A4, just like the FreePascal documentation itself. For the examples and screenshots, I'm going to be using Lazarus as the IDE, but will not be covering the GUI builder or other advanced features. The book will focus on the fundamentals of the Pascal language as implemented by FPC. It won't even go as far as objects, as there's plenty to learn first. (I am considering an adaptation of my book The Delphi Programming Explorer for Lazarus later on, as an introduction to OOP and GUI builder-style LCL development.)

Because the book is intended for absolute beginners, I want to make the examples as easy to understand as possible. And to that end, what I'd like to have is a new option for the "Create a new project" dialog in Lazarus: an "elementary program" that assumes the default FPC mode and does not incorporate any conditional compilation commands, as the current options "Program" and "Custom program" do.

If you're a newcomer to programming and Pascal, this seems a little forbidding:

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

begin
end. 

That's what you see today when you create a new "Program" project under Lazarus. How about something like this:

program Project1;

uses
   Crt;

begin
end.

I looked around but I don't see any way to create a new option for the "Create a new project" dialog. The Crt unit is plenty for starters, and as additional units become necessary for the examples, I'll explain what units are and how to include them.

I'd call this option "Elementary program." For the description, I'd suggest: "The simplest possible framework for a FreePascal program, useful when first learning the Pascal language."

So. What are the chances?

Thanks much in advance for your help!

--Jeff Duntemann
  Colorado Springs, Colorado, USA

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Request: An "elementary program" option for Project | New Project
« Reply #1 on: February 16, 2010, 07:15:18 pm »
Jeff,

You can create a package that adds choices like that to the File | New list.

For examples see the extp_proj.lpk package (and its extp_proj_intf.pas) that's part of the ExtPascal project (Web-based Pascal development):

http://code.google.com/p/extpascal/

http://extpascal.googlecode.com/svn/trunk/ExtP%20Toolkit/extp_proj/

This adds File | ExtPascal Application and File | ExtPascal Form.

Thanks.

-Phil

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Request: An "elementary program" option for Project | New Project
« Reply #2 on: February 16, 2010, 08:29:51 pm »
Jeff,

You can create a package that adds choices like that to the File | New list.


It's not a point. To be useful for Jeff's book, it must be included in standard IDE. It needs to be availible to total beginer, when he first sees Lazarus.

Actually, if we take a look at Tao Yue Pascal Tutorial, and see step 5 in this lesson
Quote
5. Lazarus will create a source file with a bunch of stuff filled in. This is more complicated than you need so far, so select all the content and delete.
, we can clearly see that "elementary program" is really needed for the beginers book purpose.

It is useless to Jeff to add it through some package which is optionally compiled. Should he start his first chapter like this:
Quote
Dear total beginer, after you have downloaded Lazarus, please download this package I prepared for this book, compile it, install it, rebuild IDE, so that you can open a simple program.

Jeff Duntemann

  • New member
  • *
  • Posts: 8
Re: Request: An "elementary program" option for Project | New Project
« Reply #3 on: February 17, 2010, 04:34:25 am »
Phil, thanks for pointing up the Google Code item--I hadn't seen that before. But Zoran has it right: I'm requesting that a new template (if that's the technical term) be created and added to the general Lazarus distribution.

What I'm trying to do here is provide a "front door" for beginners. Turbo Pascal drew in huge numbers of new users not only because it was cheap, but because it was accessible to people who knew nothing at all about compilers and programming. Programming is a lot more complicated than it was in 1984, obviously, but all the more reason to provide a path for people who are just coming to the language and the Lazarus IDE.

I can tell readers to delete the conditional switches that they don't need, but if it's easy to create a new project option for a bare-bones Pascal program structure, it would make the tutorial a lot simpler and confuse fewer people just coming to the language.

Thanks again!

--73--

--Jeff Duntemann
  Colorado Springs, Colorado, USA

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Request: An "elementary program" option for Project | New Project
« Reply #4 on: February 17, 2010, 05:27:59 am »
Phil, thanks for pointing up the Google Code item--I hadn't seen that before. But Zoran has it right: I'm requesting that a new template (if that's the technical term) be created and added to the general Lazarus distribution.

Jeff,

I think the normal way they want you to do this kind of a request would be to log it in the Bugtracker at left. It's not really a bug but I think there is a "feature request" or something like that. Requests posted here are generally just lost and not acted on.

However, if you contribute a package or patch yourself it might stand a better chance of getting added. I seem to recall that some of the choices in File | New are kind of hardwired in the IDE so if you want it to be part of a standard build it probably needs to go there and not in a package.

Maybe you could even offer to rework the File | New dialog. The English of the item names and their descriptions I've always thought left a bit to be desired. Here at one of the first points of contact between user and IDE the language really ought to be at its best, as you would certainly know.

The advantage of adding it via a package is that you can control more aspects of the new project, I believe. For example, Lazarus follows the poor example of Delphi in creating new projects with range and overflow checking turned off. Really not a good idea for beginners. I've also never been a big fan of this default:

{$mode objfpc}{$H+}

The differences between objfpc mode and Delphi mode are not great, but for people coming from Delphi it would probably make more sense to use something like this:

{$mode delphi}

Then long strings are enabled by default too and {$H+} is not needed.

Thanks.

-Phil

raistware

  • New Member
  • *
  • Posts: 15
Re: Request: An "elementary program" option for Project | New Project
« Reply #5 on: February 17, 2010, 09:02:18 am »
Would not be enought to add a new project template with desired content?

Jeff Duntemann

  • New member
  • *
  • Posts: 8
Re: Request: An "elementary program" option for Project | New Project
« Reply #6 on: April 13, 2014, 08:56:36 pm »
Many thanks to the team for implementing my suggestion of an absolutely minimal program template for creating very simple console apps!

This will make newcomer tutorials simpler and easier to grasp. Again, thanks!

--73--

--Jeff Duntemann
  Colorado Springs, Colorado, USA


JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Request: An "elementary program" option for Project | New Project
« Reply #7 on: April 13, 2014, 11:01:01 pm »
This will make newcomer tutorials simpler and easier to grasp. Again, thanks!

Jeff, how is your tutorial baking?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Jeff Duntemann

  • New member
  • *
  • Posts: 8
Re: Request: An "elementary program" option for Project | New Project
« Reply #8 on: April 16, 2014, 04:34:51 pm »
This will make newcomer tutorials simpler and easier to grasp. Again, thanks!

Jeff, how is your tutorial baking?

I just got done with an 8-month book project on the Raspberry Pi, so I'll get back to tinkering the Pascal intro book shortly. Lazarus has changed enough since I started back in 2008 that I need to retake some screenshots and rewrite some of the text on installing the product. This first book is an adaptation of my 1993 book on BP7, minus the DOS-specific stuff. The focus will be on getting Lazarus installed and becoming familiar with the fundamental ideas of programming and Pascal basics. It will be a free PDF in A4 format. I'm taking notes on a second book to cover OOP and GUI programming, but that's still a ways off. I will certainly let the community know when the first book is done and posted.

--73--

--Jeff Duntemann
  Colorado Springs, Colorado, USA

 

TinyPortal © 2005-2018