there is a difference between the two. the 40 has a little sharper recoil, not unpleasant, but sharper. material of the pistol will translate into how it absorbs recoil. lighter pistols tend to have more felt recoil than heavier ones. size can make a difference in felt recoil also. compacts are sometimes harder to manage recoil due to their grip size.

if you are curious about them and how they shoot, then see if you have a gun range near you that rents pistols to shoot and try them out to find out about the recoil.

I only have one .40. It's a S&W Sigma.
Recoil is snappier than my 1911.
What others have said about weight, bbl, length are are all contributing factors.
Comparisons to a polymer frame and all steel frame, the ergonimics, etc is like comparing apples to oranges.
I have an XD Tactical in .45. Thirteen rds, in the mag. As you shoot it and as the weight of the ammo lessens with each shot you can feel a slight difference in recoil.
The Sigma is my truck gun due to it's size, stainless steel and polymer being a low maintenance pistol.
I prefer shooting my .45's,

As others have said, both cartridges are different. The .45 is a lower velocity, somewhat lower pressure round. So, yes they recoil differently.

Yes barrel length can have some effect on recoil in either cartridge chambering. The extra weight may reduce felt recoil or actually dampen it, or it may increase some leverage at the muzzle and increase the perception if recoil with increased muzzle rise.

Different gun designs and materials have effects as well. Polymer framed guns may be lighter in weight but they may also have some shock absorbing flex in their material properties. How high the bore is above the hand also influences muzzle rise or muzzle flip which can increase perceived recoil.

I have noticed that a Sig 220 and a Glock 21, each chambered in .45 ACP, give different perceived recoil. The Glock sits with the bore axis lower and closer to the hand, and the polymer frame flexes somewhat, so it feels like it recoils less and it dies have less muzzle flip.

I'm not a fan of .40 S&W. For all intents and purposes, it shouldn't exist. It is a high pressure round and it wears guns out faster. I also, don't care for high pressure rounds either. There is very little difference in ballistics and the added wear and recoil isn't rewarded with superior ballistics.

I will never own a gun in .40 S&W. Of you want a .40, get the real deal and pick up a 10mm.