Simplicity is not ease

People always seem to disagree with me when I say that "simple != easy", here's a blog to explain the difference between simple and easy, well at least when it comes to programming

So, let's take python and x86_64 Linux FASM Assembly as easy and simple examples

Python is easy, we can all agree on this:

print("Hello world")

This will print "Hello world", seems simple right? Yeah no. Python does a lot more than this under the hood, it calls loads of syscalls just for that program alone:

ari@ari-gentoo ~ % strace python3 2>&1 | wc -l

And these are only the syscalls, imagine the control flow, there are probably many jumps, complicated loops and generally, if we theoretically generated a CFG for python it'd probably be huge and extremely complicated, this is the reason why it's not simple, in logic it does much more than we tell it to, python isn't explicit so it makes it very easy to write

Now, let's write the same program in x86_64 Linux FASM Assembly:

format ELF64 executable 3
segment readable executable

    mov rax, 1
    mov rdi, 1
    mov rsi, hello
    mov rdx, hello_len

    mov rax, 60
    mov rdi, 0

segment readable
    hello: db "Hello world", 10
    hello_len = $ - hello

Now this is where the fight would begin after I mention "easy != simple", because they have an opinion of "Less code = simple", this code is simple believe me or not, this code is just not easy, for a average virgin JavaScript or some high-level language developer this code seems overly complicated and they call this code "Not simple", when it actually is very simple, it's just again, as I mentioned, not easy.

So if we compile it and run this binary:

ari@ari-gentoo ~ % fasm hello_world.asm
flat assembler  version 1.73.30  (16384 kilobytes memory, x64)
3 passes, 234 bytes.

ari@ari-gentoo ~ % strace ./hello_world 2>&1 | wc -l

See how much simpler this is, it's only 5 lines of strace output and it's actually faster because of the simplicity of this program

Python takes 0:00.05 seconds where as assembly takes 0:00.00 seconds, simplicity not only improves the performance, it improves how much your program needs in resources, python does much much more meaning it needs a lot more memory, CPU and storage to run

So basically, simplicity is not ease, ease is what you do and simplicity is what your program does, easy as that, hopefully I clarified what I mean by "Simple != easy" and hopefully I won't need to explain it again :)

Have a nice rest of your day and I hope you now understand what is the difference between easy and simple :D