Difference between revisions of "Lazarus Examples Window"

From Free Pascal wiki
Jump to navigationJump to search
(+Category:Development)
Line 82: Line 82:
  
 
[[Category:Example_Programs]]
 
[[Category:Example_Programs]]
 +
[[Category:Development]]

Revision as of 18:21, 4 January 2022

This wiki page is an attempt to capture people's thoughts wrt replacing the existing Examples Window in the Lazarus IDE.


Why is there a problem ?

The existing Examples system has issues, perhaps in that it has not keep up Lazarus's own rapid development. There are a number of issues identified (in no particular order) -

  • Linux Lazarus installs based on (distro) Packages have the Examples in read only space.
  • Most Examples do not have any indication of the topic covered other than file/project name.
  • Examples don't have a category system identifying who target audience is, beginner to advanced user.
  • Many examples are outdated, many don't, for example use the Lazarus Form Designer confusing new users who expect to see Object Inspector content.
  • The system is limited to only those examples shipped in the main Lazarus distribution, cannot cover eg Examples applicable to OPM.


What should the user experience be like ?

  • A user should be able to choose to see content appropriate to their experience.
  • Be able to see a summary of what an Example is about before opening it.
  • Be able to open an Example, have a play with it, make a few changes and recompile to see what happens. Maybe roll back to the original Example if they make a full mess of it.
  • Examples should be generally short, contain appropriate, relevant code focused on one topic each. But there will me many exceptions to that.
  • If a user installs a third party package, eg via OPM, then any examples it contains should be treated in the same manner.


How do we achieve this ?

There appears to be three key steps, reviewing all existing Examples, adding meta data and redesigning the Examples Window is clearly necessary. A reasonably easy to work with metadata standard will ensure ongoing performance. Ensuring that standard is complied with in new Examples may be more than we should ask Lazarus Developers to be responsible for.

Third party packages is a grey area, many do not have examples at all (so be it), some will have Examples that can work with a proposed new system with just the addition of a metadata file. There will be situations where a "forth party" will produce an Example without the cooperation of the package author.

We also need to keep in mind that by distributing, indexing or referring to Examples, we take on some Duty of Care to ensure that no Example contains malicious code and, perhaps, is Fit for Purpose.

That is about all we all agree on at present !


Methodology

There appears to be two broad models available, each with their own advantages and disadvantages. Choosing one or the other model and determining what our metadata file looks like is the next phase.

Its likely that the metadata design is substantially the same either model.

Both Example Model will require -

  • An extensive review of all existing Examples is required (for both models).
  • Additional of a metadata file.
  • A call for more Examples.
  • A means to scan for 'other' Examples, such as ones in OPM packages.

Examples Remain in Distribution.

This is the KISS solution, it involves the least structural change but may not necessarily involve less work. As well as reviewing and adding meta data, we may wish to re-organize the location of packages. The extensive changes that must happen to the existing Examples will need Lazarus Developer involvement.

More to come


Examples move on-line

Possibly a simpler change because much of it is implemented externally, at some stage the Examples Window will need to be changed in the Lazarus Distro but lots of building, adjusting of existing Examples, testing can happen without annoying Lazarus Developers.

Prototype code to download files, index projects and build a master metadata file already exists.

A very rough and ready example example repository has been established at (a very incorrectly named) https://gitlab.com/dbannon/fpexamples

Note that you can browse the repository, just looking for snipits of code, you can download a particular Example directory as a zip file and use it locally. This is perhaps, for many users, easier than closing their existing project, opening up the example, seeing what they are llooking for and going back to their real project and continuing working. But you need online access....

More to come.

The Meta Data File

Determining the format of this file is a compromise between present and future functionality and ease of use. initial testing has been done using just plain text like this :

Project : SomeProject
Category : Beginner
Keywords : Buttons Forms Hello

This project is the classic Hello Word demo, an initial form is created by the IDE and Button and Memo added. A few changes made using the Object Inspector.

However, indications are a more elaborate meta data approach may be required.