DEV Community

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

 
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.