Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-10

Working on big units

41 messages · 12 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aradeonas

Hi,

I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or editing and sometimes I get lost that where am I. Just want to ask you how you work with big units? how you move,browse and edit?

Regards, Ara

http://www.fastmail.com - Same, same, but different... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/a96cbb56/attachment-0001.html>

Reply by email

Philippe Lévi
to Aradeonas

If I don't want to split it in different units I split it in "logical" parts in files and use {$I ...}

but with several classes .. it looks like splitting classes in different units should be a way to make it easier!

________________________________
De: Aradeonas
Enviado: quarta-feira, 21 de outubro de 2015 16:45 Para:
Assunto: [Lazarus] Working on big units

Hi,

I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or editing and sometimes I get lost that where am I. Just want to ask you how you work with big units? how you move,browse and edit?

Regards,
Ara

http://www.fastmail.com - Same, same, but different... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/1d931a37/attachment.html>

Reply by email

DougC
to Aradeonas: I Just work on one of my units with about 10,000 line of code that have 7 class and it…

The best way to deal with big units is to avoid them completely.

Can you explain why you are using such a big unit if it is causing you these problems?

---- On Wed, 21 Oct 2015 15:45:07 -0400 Aradeonas &lt;&gt; wrote ----

I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or editing and sometimes I get lost that where am I. Just want to ask you how you work with big units? how you move,browse and edit?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/2d02dea9/attachment.html>

Reply by email

Aradeonas
to Philippe Lévi: If I don't want to split it in different units I split it in "logical" parts in files and…

But I remember I read somewhere Its good too have minimum count of units and also its easier to use and also I saw many units that have thousands of code and its interesting that how they work on these codes?

These classes are in a subject like controls and I didnt want to have Edit,Label,List,Panel ... units .

Regards, Ara

http://www.fastmail.com - Same, same, but different... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/ad9481aa/attachment.html>

Reply by email

DougC
to Aradeonas

I think you have taken the advice you read somewhere too seriously. You have taken it to an extreme that invalidates it.

Having a small number of units is not in any way disadvantageous in terms of efficiency from the system's viewpoint. Remember that the unit structure was invented to solve the very problems you are experiencing!

You do not have to split your unit based on the classes it now contains. You can use other rationale for the split. I have a set of units named

DateSupport

LogSupport

FileSupport

CodeListSupport

SortSupport

Makes it easy to see where the items I want to find are.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/cae2c9c6/attachment.html>

Reply by email

Martin Frb
to Aradeonas: But I remember I read somewhere Its good too have minimum count of units and also its…
Aradeonas wrote 6 lines
But I remember I read somewhere Its good too have minimum count of units and also its easier to use and also I saw many units that have thousands of code and its interesting that how they work on these codes? These classes are in a subject like controls and I didnt want to have Edit,Label,List,Panel ... units .

Code tools (read the entire page, it is useful not just for navigation) http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools Method_Jumping and Find_Declaration

Code explorer (try it, the description is not that good)) http://wiki.lazarus.freepascal.org/IDE_Window:_Code_Explorer

bookmarks

folding (if that is your thing)

find next/previous occurrence of word at caret

Reply by email

Marc Santhoff
to Martin Frb
Martin Frb wrote 6 lines
Code tools (read the entire page, it is useful not just for navigation) http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools Method_Jumping and Find_Declaration Code explorer (try it, the description is not that good)) http://wiki.lazarus.freepascal.org/IDE_Window:_Code_Explorer

+1

The most helpful key combinations are

CTRL-SHIFT-<arrow down>

to jump from the interface section to the method the cursor is in

CTRL-SHIFT-<arrow up>

for the inverse, jumping from inside a method implementation to the interface section of that class

And not to forget, put the cursor inside a variable name or class name or function name, use the right mouse key for popping up the context menu and select

"find declaration of ..."

as first entry.

Using those three plus the code explorer I'm happy navigating huge untis with little irritations.

Have fun,
Marc

Marc Santhoff

Reply by email

Martin Frb
to Aradeonas
Aradeonas wrote
Thanks, Im using all of these tools except folding (I just use JCF and it is very good at losing the point that where you was!) and still hard to maintain, so it seems its just my problem.

If you used "find declaration", that adds a jump point, and you can go back ctrl-h (I recommend you put that on a key you like) You can also add your own jump points. (search the menu, or keymapping)

Also look at the overview gutter (next to scrollbar), it shows where interface and implementation are. That can be helpful. You can also set inactive breakpoints (ctrl click on gutter), they show in the overview gutter too. If you have a limited number of them they can help finding things.

I dont know about jcf, and how well it keeps any line info (bookmarks, breakpoints,...)

Reply by email

Aradeonas
to Martin Frb
Show quoted text 12 lines
If you used "find declaration", that adds a jump point, and you can go back ctrl-h (I recommend you put that on a key you like) You can also add your own jump points. (search the menu, or keymapping) Also look at the overview gutter (next to scrollbar), it shows where interface and implementation are. That can be helpful. You can also set inactive breakpoints (ctrl click on gutter), they show in the overview gutter too. If you have a limited number of them they can help finding things. I dont know about jcf, and how well it keeps any line info (bookmarks, breakpoints,...)

Nice points about gutter (I know them but not about inactive breakpoints). JCF dont mess breakpoints it just sometimes go somewhere else you was working after it formats the code.

Regards, Ara

http://www.fastmail.com - The professional email service -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/01fb60fb/attachment.html>

Reply by email

Marcos Douglas
to Aradeonas: I Just work on one of my units with about 10,000 line of code that have 7 class and it…
Aradeonas wrote
I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or editing and sometimes I get lost that where am I. Just want to ask you how you work with big units? how you move,browse and edit?

Sorry, but 7 classes with 10K lines?! There is a problem in your design. Doesn't matter if is Pascal or another language. You need to refactor this immediately.

How many methods have each class? IMHO is better to have the minimum as possible. Is better to have 10 classes with one method each, than 1 classe with 10 methods.

Marcos Douglas

Reply by email

Marcos Douglas
to Aradeonas
Aradeonas wrote
Its similar to to Controls.pas in Delphi7 but class are big but its not the point

Because was coded in a big company doesn't mean was right coded. But, as you said, its not the point.

(I just didnt wanted to put each control in one unit) my point is finding out browsing and editing big units.

As Martin and others said, the IDE will help you. Good luck.

Best regards,
Marcos Douglas

Reply by email

Aradeonas
to Martin Frb
Short cut is by default Alt-<arrow up>

Or Ctrl+click

There are shortcuts to fold ALL nodes at a specific level.

alt-shift-1 (or 2, 3 4 ... for level) alt-shift-0 unfold

depending on what you have configured as fold-able try alt-shift-3 (maybe 4) and you just see function headers. Very good! But sadly for me if I use JCF when I have a folded code it will messed up. It seems there are tools that I cant use because of JCF. But code formatting is a lot more important for me, I can write a line without!

Regards, Ara

http://www.fastmail.com - Choose from over 50 domains or use your own -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151021/c5ff5236/attachment.html>

Reply by email

Juha Manninen
to Aradeonas
Aradeonas wrote
Very good! But sadly for me if I use JCF when I have a folded code it will messed up. It seems there are tools that I cant use because of JCF. But code formatting is a lot more important for me, I can write a line without!

You use JCF for your own code while editing? It makes no sense. Adjust the Codetools code generation settings to match your coding style instead.

Using JCF will limit you even more if you start to use the new language features like advanced generics, class helpers etc. JCF's parser does not understand some of the syntax and nobody maintains it actively.
Codetool parser on the other hand is maintained. That's why I have created this report :
http://bugs.freepascal.org/view.php?id=19754

Regards,
Juha

Reply by email

Graeme Geldenhuys
to Aradeonas: I Just work on one of my units with about 10,000 line of code that have 7 class and it…
Aradeonas wrote
I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or

"big" is a relative term I guess. I don't consider 10,000 lines big these days. :)

Take a look at "Procedure List" found in the Search menu, or simply use Alt+G (I've changed mine to Ctrl+G). This allows you to type any text, and the list shown will be reduced to show any partial matches. Down arrow to highlight what you want, and ENTER to go to that code. No mouse usage is needed. You can also use the combobox to limit matches to a specific class.

I ported this to Lazarus many years ago, because this is by far the fastest way to find specific code in large units - at least that is my personal experience.

Using Editor Bookmarks are also a vital tool I use to jump to different location in a unit, or even to other units.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Juha Manninen
to Aradeonas: Yes I do because it will be unformatted while writing. About codetools really I dont know…
Aradeonas wrote
Yes I do because it will be unformatted while writing. About codetools really I dont know what it does and I never used it and I read Wiki page and didnt understand how it help code formatting.

Ok, Codetools is used for many things but I meant the settings affecting automatic code generation. See pic.
Easily half of your code gets generated automatically when you learn to use the IDE properly.
Now you are using it wrong.

JCF is only good for importing code from somebody using strange indentation style or something.

Juha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Codetools_spaces.png
Type: image/png
Size: 79461 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/9fac19b4/attachment-0001.png>

Reply by email

Aradeonas
to Graeme Geldenhuys: "big" is a relative term I guess. I don't consider 10,000 lines big these days. :) Take a…
"big" is a relative term I guess. I don't consider 10,000 lines big these days. :)

Yea for you its just a normal unit but for someone like me writing this code from start and managing it is kind of hard (not much,but I want easier!) Very good point!I didnt saw that,Thank you. I tried it (And changed the shortcut to Ctrl+G) and it is easy to use,maybe you can add some shortcut or a tree view for moving faster between classes.

Regards, Ara

http://www.fastmail.com - mmm... Fastmail... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/aba51fea/attachment.html>

Reply by email

Graeme Geldenhuys
to Aradeonas
Aradeonas wrote
changed the shortcut to Ctrl+G) and it is easy to use,maybe you can add some shortcut or a tree view for moving faster between classes.

When I wrote it, immediate typing reduced the search results (partial matching anywhere was automatically enabled - matching at start is optional from toolbar), up or down arrow (while edit had focus) automatically moved the selection focus in the result list. Pressing TAB (while edit had focus) switched to the ComboBox, where up and down arrows can be used.

Others have modified the code (sometimes good, sometimes bad) since it got integrated with Lazarus IDE. Some of the original functionality got lost (no icons in result list any more, doesn't remember column widths etc), but the above mentioned keyboard actions should still work (I hope).

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Aradeonas
to Graeme Geldenhuys

No shortcut and search behave badly. Doesn't search very good and for me cant find anything good.
For now I dont know how to edit Lazarus add ones and codes (and making patches and ... ) but it is easy to make these works. I just good at making from scratch not updating others code (Just using :p ) . Maybe I do that when I began to make patch for Lazarus.

Regards,
Ara

http://www.fastmail.com - Same, same, but different...

Reply by email

Alexsander Rosa
to Aradeonas: I Just work on one of my units with about 10,000 line of code that have 7 class and it…
From my 600+ KLOC project:

Total Files:961Average File Size:629,3 lines

Source: StatSVN report

2015-10-21 17:45 GMT-02:00 Aradeonas :

Show quoted text 21 lines
Hi, I Just work on one of my units with about 10,000 line of code that have 7 class and it makes me crazy moving in it and adding procedure or editing and sometimes I get lost that where am I. Just want to ask you how you work with big units? how you move,browse and edit? Regards, Ara -- http://www.fastmail.com - Same, same, but different... -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/c79ce4a2/attachment-0001.html>

Reply by email

Graeme Geldenhuys
to Aradeonas: No shortcut and search behave badly. Doesn't search very good and for me cant find…
Aradeonas wrote
No shortcut and search behave badly. Doesn't search very good and for me cant find anything good.

Can you please supply a screenshot of your Procedure List dialog with the text you entered and what the results where.... And very importantly, an example of what wasn't found that you expected it too (eg: procedure, function or method name). I'll then take a look at what went wrong.

I use Procedure List daily, and it finds whatever I'm looking for.

NOTE:
Procedure List only searches the current unit (what will include Include files used in that unit), and only searches for procedure names, function names or method names. Nested (local) procedures work too.

If you want to find something in all units, then you need to use "Search -> Find in Files..."

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Aradeonas
to Graeme Geldenhuys
Show quoted text 5 lines
From my 600+ KLOC project: Total Files: 961 Average File Size: 629,3 lines Source: StatSVN report

How,Why?! ;)

Graeme I will send you screenshots.

Regards, Ara

http://www.fastmail.com - Or how I learned to stop worrying and love email again -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151022/677e2cbf/attachment.html>

Reply by email

Juha Manninen
to Aradeonas
Aradeonas wrote
Its good to have videos of professorial FPC and Lazarus developers and see how they work,it can be like learning channel.

There are animations of the IDE here :
http://wiki.freepascal.org/New_IDE_features_since
and other commands :
http://wiki.freepascal.org/Lazarus_IDE_Tools

A normal work flow includes lots of tinkering, scratching head, trials and errors, "oops wrong!" moments etc.
It may be boring to watch in a video.
Somebody could make a video of all the features in a well planned way and practice it beforehand. It would be very helpfull.

Anyway using Lazarus as it was Notepad and then running JCF is like cutting wood with a motor-saw without starting its engine and then wondering why it does not work very well.

Juha

Reply by email

Graeme Geldenhuys
to Juha Manninen: There are animations of the IDE here : http://wiki.freepascal.org/New_IDE_features_since…
Juha Manninen wrote
Somebody could make a video of all the features in a well planned way and practice it beforehand. It would be very helpfull.

That's kind of what I wanted when I started this wiki page: http://wiki.freepascal.org/New_IDE_features_since

Animated GIF's used to visually show features with a short description. But as the saying goes: "A picture is worth a thousand words" - just just imagine a moving picture. ;-)

Unfortunately since then some static screenshots got added by others, and worse, just text descriptions without images. Oh well, that's the nature of wikis.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Graeme Geldenhuys
to Aradeonas: Yes it can very good that shows what is a good work flow with Lazarus but it should made…
Aradeonas wrote
Yes it can very good that shows what is a good work flow with Lazarus but it should made by a person that know LAzarus and FPC well.

YouTube contains some very good videos - maybe not all related to FPC and Lazarus specifically, but rather Delphi. In most cases they apply to FPC and Lazarus too.

Maybe somebody could organise some of those videos in a YouTube play list, or create a collection of links in a FPC wiki page.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Anthony Walter
to Graeme Geldenhuys: That's kind of what I wanted when I started this wiki page:…

from: http://wiki.freepascal.org/New_IDE_features_since

How do I enable the HTML view for object inspector information box. Using a recent SVN trunk here and all I see is normal plain text in the info box.

Also work noting, what would everyone think about screen captures as mp4? All browsers now support the video tag, framerate and colors are usually better, videos can include sound.

http://cache.getlazarus.org/video/inspector.mp4

I am working on a cross platform screen recording app (depends on ffmpeg) which will allow for both full screen and screen rectangle area capture. I might add a save to optimized animated ".gif" option.

The way it works is you define a hotkey combo.
Then when you press the hotkey while using other program it starts recording.
The recording area is highlighted on screen.
Then you press hotkey again and are prompted with a summary of what you recorded and the option to:
Save to file.
Save to cloud storage (with a url copied to the clipboard). Or to discard the recording.

I am also considering a partially automated wizard to setup free cloud storage accounts with their choice of services between Amazon S3, Google Cloud Storage, and Microsoft Azure file storage. All offer a of free storage within some maximum allotted space.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151024/05ec2698/attachment.html>

Reply by email

Alexsander Rosa
to Aradeonas: How,Why?! ;) Graeme I will send you screenshots. Regards, Ara http://www.fastmail.com -…

2015-10-22 13:11 GMT-02:00 Aradeonas :

Show quoted text 12 lines
*From my 600+ KLOC project: Total Files: 961 Average File Size: 629,3 lines Source: StatSVN report * How,Why?! ;)

How: coding this way since day one.
Why: IMHO it's easier to maintain.

Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151024/f08b2806/attachment.html>

Reply by email

Jürgen Hestermann
to Alexsander Rosa
Alexsander Rosa wrote 17 lines
2015-10-22 13:11 GMT-02:00 Aradeonas < <mailto:>>: / From my 600+ KLOC project: Total Files: 961 Average File Size: 629,3 lines Source: StatSVN report / How,Why?! ;) How: coding this way since day one. Why: IMHO it's easier to maintain.

I am currently working on a program where the main unit has >20k lines but never found that the length is a problem. Alt+G to find procedures/functions helps a lot,
Bookmarks can be used, Ctrl+F(ind) is there too
so I don't know why I should split the unit without need. Just the opposite: Spreading the code over many files/units makes it much harder to find something (at least it does not make it easier IMO).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151024/7051d0f4/attachment.html>

Reply by email

Alexsander Rosa
to Jürgen Hestermann

2015-10-24 14:15 GMT-02:00 J?rgen Hestermann :

Show quoted text 30 lines
Am 2015-10-24 um 17:50 schrieb Alexsander Rosa: 2015-10-22 13:11 GMT-02:00 Aradeonas : > > > > > > > * From my 600+ KLOC project: Total Files: 961 Average File Size: 629,3 > lines Source: StatSVN report * > > How,Why?! ;) > > How: coding this way since day one. Why: IMHO it's easier to maintain. I am currently working on a program where the main unit has >20k lines but never found that the length is a problem. Alt+G to find procedures/functions helps a lot, Bookmarks can be used, Ctrl+F(ind) is there too so I don't know why I should split the unit without need. Just the opposite: Spreading the code over many files/units makes it much harder to find something (at least it does not make it easier IMO).

Our largest .pas file (out of 750) has 8+ KLOC.
Ctrl+mouse click opens the external file easily.

Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151024/b7de9a4a/attachment.html>

Reply by email

Graeme Geldenhuys
to Anthony Walter: from: http://wiki.freepascal.org/New_IDE_features_since How do I enable the HTML view…
Anthony Walter wrote
How do I enable the HTML view for object inspector information box. Using a recent SVN trunk here and all I see is normal plain text in the info box.

Not really related to this thread, but to answer your question.... As far as I know you need to install the TurboPowerIPro package into Lazarus. This then enables HTML info box in the Object Inspector, and enable HTML hints windows in the source code editor.

Also work noting, what would everyone think about screen captures as mp4? All browsers now support the video tag, framerate and colors are usually better, videos can include sound.

At the time I found Animated GIF's sufficient for the task (the wiki page), and they were very easy to create and ALL browsers (new and old) support Animated GIF's.

I personally think the W3C really failed us all with the VIDEO tag - by not specifying a specific codec for the HTML5 standard.

But if you must go the way of embedded videos, I would suggest a truly open standard codec and container format. For that reason I would recommend OGV files with Ogg Vorbis encoding for sound and Ogg Theora encoding for video.

https://en.wikipedia.org/wiki/Ogg

My other choice would be WebM.

Either way, definitely not MPEG anything.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Anthony Walter
to Graeme Geldenhuys

Graeme, all browsers (except opera mini) support h.264 now:

http://caniuse.com/#feat=mpeg4

See also OpenH264 https://en.wikipedia.org/wiki/OpenH264

Regarding other video formats, Vorbis, WebM, VP8 have much less support:

http://caniuse.com/#feat=webm
http://caniuse.com/#feat=ogv
http://caniuse.com/#search=vp8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151024/7c22fa66/attachment.html>

Reply by email

Graeme Geldenhuys
to Anthony Walter
Anthony Walter wrote
Graeme, all browsers (except opera mini) support h.264 now:

Yes and No. The difference between OGV & WebM vs H264 is that H264 requires external libraries for it to work. Especially on Linux or FreeBSD (read the fine print... appropriate gstreamer plug-ins are required).

On the other hand, OGV and WebM (I think) are fully baked into the browser source code - just like JPG or GIF support. At least for Opera, Chrome and Firefox.

Anything MPEG and H264 are patent nightmares and requires licensing. Do some Google searching to find out more - there are tons of information, especially for content producers (somebody making video files).

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email