DEV Community

Discussion on: Why (almost) all production code is garbage

Collapse
 
polterguy profile image
Thomas Hansen

I liked your comment. However, simply adding OO to the mix, makes the task of learning software development orders of magnitudes more cognitively challenging.

Collapse
 
thumbone profile image
Bernd Wechner

Really? I mean no need to touch OO for ages when learning Python, but the idea is not complicated, and introduced easily with ideas like Fruit as a class and Orange and Apple and objects ... etc.

Python does open up small nest of complexity by making private members impossible and so the more stuff a class implements in term of attributes (be they vars or funcs) the more noise its API presents. But c'est la vie, that's easy to avoid in the first hours of Python, in fact you can successfully code lots in Python and never go there. Though it does rear its head eventually given Python's intriguing implementation of everything as an object! Even class definitions are objects! That is, while simple, something many will struggle to get their heads around fully.

Thread Thread
 
polterguy profile image
Thomas Hansen

For you (and me) this is easily understood. For a noob, it's rocket science. When I started coding, I could turn on my computer, and within 3 seconds I could start writing line numbers and goto statements in a procedural language. Today you have to download an IDE, a compiler, and dozens of libraries and other tools. Before you've even started the downloading process, you've had to wade through hundreds of articles to figure out what you should even download in the first place. Such things does not inspire creativity ... :/

Thread Thread
 
thumbone profile image
Bernd Wechner

Not sure that I agree. I mean you can have similar all you need is to turn on the computer if it's set up right (I can do that for my kids) and in term type "python" and you're in the same spot. Just can't use GOTOs, and I'm not sure that was an easier an idea than while, or for ... it was sure as heck harder to follow and understand - I wrote a game of Pong that way using PEEK and POKE and GOTO as my first coding jaunt as a kid ;-), and it wasn't easy to follow GOTOs. And that fun convention of incrementing line numbers by 10, so we could slip new lines in ;-).

Not so sure that it needs to be much harder today. Though I do agree, it often is ... more immersive. For example, I just checked this out for the kids: py.checkio.org/ a full on adventure game with little Python exercises but yes, the first induction exercise throws this at you:

def mult_two(a: int, b: int) -> int:
    # your code here
    return None

print('Example')
print(mult_two(1, 2))

assert mult_two(3, 2) == 6
assert mult_two(0, 1) == 0

print("The first mission is done! Click 'Check' to earn cool rewards!")
Enter fullscreen mode Exit fullscreen mode

Which, I agree, is more than I expected for a Elementary level first exposure. I'd have started with:

a=3
b=2
# calculate c as the multiplication of a and b
Enter fullscreen mode Exit fullscreen mode

That is enough for a total noob, to tackle the abstraction of variables (as in these kids haven't done algebra yet ;-)

Alas, methinks they want/need asserts to provide automated success feedback. Shrug.