What factors decide if a code is hard to understand?

Code that’s hard to understand leads to code that easily breaks when changed.

What if some people find MVC to be very easy to understand (for their own reasons) as compared to architectures like MVVM, MVP, VIPER, etc.? What if they break less code when using MVC compared to other architectures?

I use MVVM almost all of the time. But I know some big projects that are written in MVC and the devs prefer it to be that way (as I noticed). So reading the quoted sentence above, it led me to ask the question, what actually decides if a code is hard to understand?

Code architecture isn’t necessarily the same as code blocks. Code can be written in a hundred lines per method, with bad variable names, sparse or poorly descriptive comments and still be MVVM or VIPER.

Code that is easy to understand is clean within itself, within a block, within a line. You can come back to your own code a year later and fairly easily understand what is going on. Or the same with someone else’s code. If you are scratching your head when looking at your own code a few weeks after you wrote it, then it’s not good code.

1 Like

That makes sense. Thanks!