Ex 41, just a thought

I’m enjoying the book as beginner that has never code before, every time I go through an exercise I get alot of thoughts like “wow, I can do that and that while coding”, and ex 41 makes me so excited specially with nesting elements inside elements or lists inside list… etc I know it’s possible and zed already said it in previous exercises but looking to the code and saying wow I didn’t thought its legal to do so kind of things, makes thinking coding is like a while loop that never ends. Another thought, I know that anyone with experience can read the code with no struggle but can anyone with experience write a code like this and be so creative without struggling or its also easy. That’s few of hundreds of thoughts that goes in my mind from the moment I started the book(or middle of the book).

Well, obviously it gets a lot easier with practice. Keep in mind that complexity is not something to strive for, quite the contrary. Keep your solutions as simple as possible. Anybody who’s going to read and maintain your code, including your future self, will be grateful.

1 Like

I share this view. Sometimes you read a piece of code that is simple, but beautiful. Almost like poetry.

Other times you read some horrendous nested loops or decision trees, or worst still, clever one-liners that are terrible to work out what’s happening or debug.

The irony is both achieve the same goal, and the complexity is encapsulated. So it’s helpful to think from the outset, I better make my code maintainable as it’s me (or another developer) that will have the headache, not the programme user.

1 Like
A free service run by Zed A. Shaw for learncodethehardway.org.