I think there's a difference if your employer locks you in to an unreasonably long notice period. (Which is usually something I like about German employment law, but let me elaborate). So I guess if we're talking the first couple weeks, there's always stuff to wrap up and document better - unless you've already done that. I also like not taking on any new tickets which are big in scope, but support your coworkers with their stuff. Or schedule dedicated handover meetings for subsystems you've had a big part of.
It can get really annoying if you have to sit out some 3 months though and I think that's the reason why many companies might actually let you leave earlier than stated by your contract - they know you will not be 100% in anymore if you're already looking forward to your next gig.
That said, I 100% prefer this over at-will.