I use ed in scripts when you need to modify a file in place, something that you can’t do with sed.
The difference is that ed reads the entire input in memory, but it doesn't break symlinks. sed's in-place editing mode (just like perl -i or the newer awk -i inplace that is supported by GNU awk) breaks symlinks, on the other hand it can operate on arbitrarily large files.
you can also do
sed -i -e 's/a/b/' file
which will work for GNU and BSD sed.