Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:22 10 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Is it possible to 'Compare' two versions of code?

Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 09:25pm 25 Jan 2025
Copy link to clipboard 
Print this post

G'day all,
I am not a trained nor skilled programmer.
I do my best with version control by putting comments about changes made to code up front and throughout and save with a new version number fairly regularly.

Despite this, I often can't tell what has changed in my code that is causing a new problem (either deliberately or by an erroneous 'click' or 'press').

1) Is is possible to compare two versions and highlight the differences?
2) What other tricks do 'shedders' use?

Cheers,

Andrew
 
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 235
Posted: 09:31pm 25 Jan 2025
Copy link to clipboard 
Print this post

Hi Andrew

I use VS code for larger changes in the code (and the built-in editor of MMBasic for testing). VS code is free and very powerful; it also has a very flexible function to compare code side by side.

Best
Thomas
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 220
Posted: 09:33pm 25 Jan 2025
Copy link to clipboard 
Print this post

Andrew, if you are working on Windows, try Notepad++

This is a very capable editor and i occasionally use the "compare" plugin, which may do what you want. Compares editor windows and intelligently highlites the changes. Just give it a try and play with it, i love it for it has lots of useful funtions. For normal programming i use MMedit, just unbeatable.
                                                                 
73 de OE1HGA, Gerald
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 10:31pm 25 Jan 2025
Copy link to clipboard 
Print this post

Hi Thomas and Gerald,
Thank you.
Yes I swear by MMEdit - I use it all the time.
I also use Notepad++ and was unaware of its "compare" plug in. (I've really only been using it instead of Notepad).
I've just fired it up and it looks perfect.

Many thanks,

Andrew
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1000
Posted: 10:50pm 25 Jan 2025
Copy link to clipboard 
Print this post

WinMerge a free download is the best I have ever found. Suggested to me by Peter.
Latest F4 Latest H7 FotS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 11:54pm 25 Jan 2025
Copy link to clipboard 
Print this post

I use ExamDiff Pro for most text comparison work as well as Notepad++ because Notepad++ is ALWAYS open.

HxD is my go to for binary files.

Jim
VK7JH
MMedit
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3358
Posted: 12:55am 26 Jan 2025
Copy link to clipboard 
Print this post

"++" for Notepad++. The "compare" feature is very powerful.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 03:29am 26 Jan 2025
Copy link to clipboard 
Print this post

In using ESPNOW code written by others I will load a few up in Geany.
   I can see how each does it bit and the cut out what I do not need to do
   Their doc's need to have a bit more simplified examples. Not cramming
   every thing in the demo code.

  Been My MMBasic off chip editor for a long time now. I has saved me from the
  bad versionitis I cause at times when moving old project forward to new chip.

  Quazee137
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 03:29am 26 Jan 2025
Copy link to clipboard 
Print this post

Hi Andrew, All,

I use ZTREE , an XTREE clone, rewritten for long file name support and allows different compression programs besides ZIP.

it has a file compare that is really good "JFC"

Regards,

Mick (The big one)



.
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 593
Posted: 03:54am 26 Jan 2025
Copy link to clipboard 
Print this post

Mick I still have XTREE GOLD on 3.25" and 5".
 Also found my CP/M 2 and 3 on 8"

Finally getting around to boxes boxed up in 1987. Sync magazines 1981-1984.
 micro-ACE, ZX80, 16k ram packs. Sadly on the ZX80s the keyboards connectors
 are dust do heat. ZASM and DASM tapes not touching them. I have eprom copies
 in an 8 slot 44pin backplane cage I wirewraped up.

 Still to open is my boxes of Radio electronics some back as far as 1952.
 Popular ELECTRONICS also old.

 I don't know what to do with all these magazines. Byte, Circuit Cellar,
 Electronics Now. I offered them a High School Library and was told no
 need of them.

Yup I'm old but dam its been GREAT getting here.
Quazee137
 
EDNEDN
Senior Member

Joined: 18/02/2023
Location: United States
Posts: 139
Posted: 04:21am 26 Jan 2025
Copy link to clipboard 
Print this post

  ville56 said  Andrew, if you are working on Windows, try Notepad++

This is a very capable editor and i occasionally use the "compare" plugin, which may do what you want.


Yes.  For sure this will help.   Or download a trial version of ExamDiff Pro and pull your file sets in it.    Either will do what you need.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1360
Posted: 12:35pm 26 Jan 2025
Copy link to clipboard 
Print this post

  disco4now said  WinMerge a free download is the best I have ever found. Suggested to me by Peter.




Using same for many years and there is also a portable version
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 02:31pm 26 Jan 2025
Copy link to clipboard 
Print this post

As already mentioned, Notepad++ is a great tool and the editor of choice for me. I like the way you can configure it for all sorts. Being able to edit multiple areas of the same file is a godsend not having to shovel large chunks of text back and forth. Bearing in mind, I develop straight into a console window, not a file transfer or anything... I embed commands and control codes in the source and deploying is simply a matter of Ctrl-A, Ctrl-C, right click in the (PuTTY) console window. Deployment takes 2-3 seconds which makes for a really quick dev environment


first line of file





last line(s) of file


(that "SUB" is embedded CHR(26) - Ctrl-Z and so terminates the transfer)

my tool chain is pretty much this and some habits regarding how I keep the source files.

For versioning of sources, for me I find the best and most controllable way is to have multiple issues of the source and the filename gives further info. Each time I go to start a new session of dev, I copy the current file and rename accordingly. I put a header inside the source file, repeating the version number with the date and then summarise why this file exists. This way I always have a full history of my work and if I break something and it is too complex/time consuming to fix, I can always go back to the last known good version and delete any file forward of it. Seeing it written out like this makes it sound complex but it really isn't and with good discipline, I don't have to remember what I was doing if I take a break between efforts.

This requires you to be disciplined. Filenames are along the lines of

myprog Vx,yya.bas

so something like
WorkShopClock V2.02a.bas

first number x is the major version number -
V0. is "draft" or not issued, i.e. initial development and not released. By definition it cannot have alpha releases
V1. is the first "in the wild version"

any *substantial* rewrites/additions/new features & functionality will bump this to V2... V3... etc...

second number yy is a two digit number for tweaks and minor improvements without substantially changing the code, so a better version of a function might take it from 00 to 01

The trailing letter, a, is for alpha testing in the wild. So once you are at V1+, not V0 because it is not released. Live releases on any version do not have an alpha

When I start work on a new version, I clone the file, bump it's yy and add an alpha so from the example above, I can see the workshop clock is at major version 2, tweak 2 and and alpha 1. Once I decide the code is releasable, it will lose the alpha idents and become simply V2.02 and it becomes a "stake in the ground" version - a fixed point in a project's evloution.
The next version can be expected to be V2.03a. I will copy V2.02 and rename it accordingly, adjust the header and it is ready for being worked on. I might take several stabs at dev before I release a version but still want to try it in the wild... so
WorkShopClock V2.03c.bas

will eventually go to V2.03


Each project lives in its own folder. The source lives at the top level, below which there will be two folders: "Old" for older versions and code fragments from experimentation etc... and "Data" whch will be pix, grabs, notes, PDFs for special components etc.

here's a real example... current milepost version and an alpha:

 

hth

h
Edited 2025-01-27 05:30 by CaptainBoing
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 08:04pm 26 Jan 2025
Copy link to clipboard 
Print this post

Good morning all (Au time).

Thank you for your contributions.
Notepad++ has already helped me find a major bug (my own "millennium" bug - the default DATE$ I was testing has recently changed).
The discussion about version numbering is good too.
The references to Xtree takes me back to the mid-1980s and my first PC (XT with a white on green display) . . .

Cheers,

Andrew
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5054
Posted: 07:42am 27 Jan 2025
Copy link to clipboard 
Print this post

Interesting explanation on version numbering. I noticed Peter uses a similar system.
2.03 alpha
2.03 beta
2.03 rc
then 2.03

I never got that. My versions alsways call the final the next number.
2.03_v01
2.03_v02
2.03_v12
and final 2.04...

I always suffer with file compare. So this has been helpful in 2 ways.
Thanks,
Volhout
PicomiteVGA PETSCII ROBOTS
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4037
Posted: 04:18pm 27 Jan 2025
Copy link to clipboard 
Print this post

  Quazee137 said  I don't know what to do with all these magazines. Byte, Circuit Cellar,
 Electronics Now. I offered them a High School Library and was told no
 need of them.

Maybe a museum.

John
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 04:31pm 27 Jan 2025
Copy link to clipboard 
Print this post

  Volhout said  Interesting explanation on version numbering ...


I recommend "semantic versioning": https://semver.org/

For comparing files I (on Linux) use Meld which (like many diff tools) can also handle differences between the "working" version and the HEAD when working within a git repository file structure.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1360
Posted: 04:57pm 27 Jan 2025
Copy link to clipboard 
Print this post

My versioning system:

"V2 after I screwed up the timing.bas"  
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 122
Posted: 11:00pm 27 Jan 2025
Copy link to clipboard 
Print this post

Hi Andrew
Like Disco4now and Peter I have been using WinMerge for years.
Like you Andrew, found it difficult to spot minor differences in code.
It's great as it will highlight a missing space.

My last download (years ago) of WinMerge allows one to review 3 files on the same screen.
Try it out.

Chrisk
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025