Recent

Author Topic: The right way to work on two or more different projects at a time  (Read 1676 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8564
Re: Here's a little variation on the original question...
« Reply #15 on: February 23, 2025, 04:21:42 pm »
The advantage of this "method" is that it is very simple and, you can use it as a "project backup" as well. One of the disadvantages is that it takes more disk space (since every directory should have a complete copy of the original directory.)

One of the disadvantages is that in an attempt to avoid lots of duplicated code one is tempted to use .inc files, which can confuse both FPC (rebuilds skipped) and the Lazarus IDE ("file changed on disk" errors as discussed in another thread.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12297
  • Debugger - SynEdit - and more
    • wiki
Re: Here's a little variation on the original question...
« Reply #16 on: February 23, 2025, 04:25:56 pm »
OTH, for strictly personal projects you can simply create subdirectories, e.g, v1, v2...vn for every version.  IOW, every time you decide to make changes that may break the program, create a new directory, "save" that version there and then work on the new version.

This is ok, if you only want to keep each final version. Personally, even for small personal projects, I prefer git.

- While I make changes (for a next version, if you can call it that) I can keep dozens of snapshots. If something goes wrong, I can exactly identify where. (squash them at the end)
- I also have a commit for ever functional change that lead to a new "feature".
- I can keep "gone wrong" trial and error branches. And later harvest them for any useful info to do a better approach. (and as branches, I can see where they fit in history / with a dozen different folders that be a challenge).
- Not to mention, it also solves synchronizing with my laptop (and VM) / and backing up all versions to an external drive. (no need for some backup software / just set a remote, and run a push when needed)
- ...

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12297
  • Debugger - SynEdit - and more
    • wiki
Re: The right way to work on two or more different projects at a time
« Reply #17 on: February 23, 2025, 04:29:22 pm »
What's the situation integrating git with the IDE?

There was some mention of a 3rd party attempt on "controlling git" from the IDE. That still would probably trigger the reload.
Other that that, I have no info on anything going on.

440bx

  • Hero Member
  • *****
  • Posts: 6364
Re: Here's a little variation on the original question...
« Reply #18 on: February 23, 2025, 05:35:06 pm »
One of the disadvantages is that in an attempt to avoid lots of duplicated code one is tempted to use .inc files, which can confuse both FPC (rebuilds skipped) and the Lazarus IDE ("file changed on disk" errors as discussed in another thread.
It's crucial not to have any dependencies whatsoever between project directories and, yes, making a full copy of the project into a separate directory isn't space efficient (on today's multi-terabytes drives, that's not much of a concern.)




@Martin,

There are most definitely many advantages to using a vcs, no doubt about that.

There are costs associated with the simplicity of having a separate directory for each version.  They can be mitigated, as long as, it's a _personal_ project, i.e, not shared.

One of the things I like about keeping different versions in separate folders is that it functions as a "sort of" project backup.

FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12297
  • Debugger - SynEdit - and more
    • wiki
Re: Here's a little variation on the original question...
« Reply #19 on: February 23, 2025, 06:03:52 pm »
There are costs associated with the simplicity of having a separate directory for each version.  They can be mitigated, as long as, it's a _personal_ project, i.e, not shared.
git (and other vcs) of course require some time to learn them. But that is well spent, and may even benefit outside the projects.

Quote
One of the things I like about keeping different versions in separate folders is that it functions as a "sort of" project backup.
So does the vcs.  That is, if you connect the vcs to a separate folder. So that even if (in case of git) the .git directory gets damaged, then you still have the data.

And because of "space is cheap", my git is set to keep reflogs for a full year. So even, if I mess up there still is a way back. (and my "backup"/clone on the external drive never deletes a branch unless the name is reused for a new branch (and then it has the reflog for another year)).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12771
  • FPC developer.
Re: The right way to work on two or more different projects at a time
« Reply #20 on: February 23, 2025, 09:32:50 pm »
I have

  • A svn repository for stuff that doesn't change with very low frequency (years, like components)
  • A main repository with a couple of shared directories, each successive directory getting more specific
  • Within application that need customer specific changes, I remove most files from the project, and work with an
    include file where I can set the customer name, and that file is included in every major unit of the project after the INTERFACE
    keyword
  • In that include file, the customer name define maps to a set havexxxx defines that enable certain modules or not
    in the rest of the source

As soon as projects gets older and less frequently, I usually branch them off into fixes branch. If it gets live again, I try to make a decision if it is worthwhile to pull it back to the main branch.

Ten_Mile_Hike

  • Full Member
  • ***
  • Posts: 136
Re: The right way to work on two or more different projects at a time
« Reply #21 on: February 23, 2025, 10:11:56 pm »
As a hobbyist my Lazarus projects are likely much less complex than most of the people here. Nevertheless I will share what I do. I wrote a Lazarus program (could easily also be done in Batch or PowerShell) that automatically backs up (the folder that I choose) into a new folder and subfolder every x (I can set the interval) minutes.
If the current project is in the folder "PointerPlay" then...

     *****Pseudocode*****
  Every 5 minutes
  if folder doesn't exist create    D:\My_Laz_Projects\PointerPlay\Current_datetime
  Copy (.lpi,.lpr,.pas,.lfm)   from C:\My_Laz_Projects\PointerPlay
                                 to D:\My_Laz_Projects\PointerPlay\Current_datetime


Works for me...YMMV
[/font]

« Last Edit: February 23, 2025, 10:14:30 pm by Ten_Mile_Hike »
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

 

TinyPortal © 2005-2018