This machine is quite old (~ 8 years ?), and rather “low-speced”.
If you really want to invest money in it, upgrade RAM to at least 8GB and upgrade the HDD to an SSD.
Don’t know how your budget looks like and how the second-hand market is where you are based, but maybe it could be worth investing a bit more and buy a newer machine.
Your major limitation there is obviously RAM. So finding a way to use less of it would be your obvious route. You could just work through all the major software components you’re using and trim as much as possible:
Desktop Environment: could you get by with one of the more lightweight ‘spins’ (XFCE or LXDE) from https://spins.fedoraproject.org/? This might be a bit of a hard ask if you’re new to Linux. I think it’s possible to switch DE by un/installing packages rather than reinstalling a different spin. If you want to try that have a search on the forum and/or add a question about that.
vscode while very functional is a memory hog. This might be your easiest route. If you could get by with neovim or sublime text that would help.
JVMs are generally tunable. Or there are quite a few JVMs around these days. Perhaps one of them uses less memory than OpenJDK?
Finally the browser. I haven’t used Brave, and given it’s Chrome-based I assume it has a similar memory-use profile. But it’s another area to consider.
I don’t have much specific to offer on the above points, but working through researching each is what I would do if I were trying to get by on limited RAM.
FYI, these two commands do the exact same thing, namely, it updates all your currently installed packages. Unlike apt you don’t need to run “update” before installing something. dnf/yum automatically keeps your package cache updated. While always a good idea to keep your system regularly patched, it isn’t necessary (though not harmful) to do an update before installing things.
Failure to understand and allow that some of the other users suggestions and comments are meant to simplify what is being suggested for the OP can become a problem.
These are the facts about yum and dnf.
Yum as a command has been replaced by dnf, and when you do an ls -l /usr/bin/yum you will see that it is a symlink to /usr/bin/dnf-3.
Dnf does not have an update command. In fact the man page for dnf shows
Thus it is easy to see that doing dnf update will have exactly the same result as dnf upgrade and update is not the preferred usage.
While following one command after the other as you posted dnf -y update; dnf -y upgrade; dnf -y install htop; htop; does not harm anything, it does use some cpu cycles to check and verify the upgrade is already complete before it can continue with the install of htop.
The command structure posted also will not work for the average user unless they have first managed to escalate their privileges to root, which by default is only done by using sudo with each command.
I always try to couch my suggestions in a way that the commands can be performed by the average user and not only by a power user/admin.
I am afraid that even running a web-site on this stack will require more than 4Gb of RAM, not saying about code intelligence, live reloading and other features needed for development. Swapping HDD with SSD will make it a little faster, because the insufficient memory will be replenished from swap, but it will also wear out your SSD faster.
I would actually be interested to hear about 2022 SOPs with best practices for measuring performance issues with Fedora, rather than relying on quite subjective and ephemeral htop watch. Fedora ships with performance co-pilot (https://pcp.io/). I don’t know if it is turned on by default. On my system it works in background, but I haven’t researched a way to see what’s it had been doing.
The question is biased … you can code on any device being a simple Raspberry Pi. Up Squared is a better choice allowing availability of wide choice of compilers or any ARM device. After running the program is something else and you connect two devices one to code and another to test it with compiler on one or other. Data transfer by wifi, cable, … Red Hat has wide choice of tools.