4 ms·
From my point of view, this isn't programming. This is high level language tricks. It would be much more fun doing it in Assembly language, without any use of
by netmonk 7y ago
From my point of view, this isn't programming.
This is high level language tricks.
It would be much more fun doing it in Assembly language, without any use of any kind of library, expect for input and output. This way student would have learnt so much more, about how integer are manipulated into cpu (just bits in base 2) doing smart math conversion to represent it in base 10. And why not generalise the problem to also compute the size in base 8, or any base N.
I hate those programming class just trying to teach python surface use, while in a programming class you have time to go deeper and learn about how python works, cause basically python use all str to binary and loop for doing all the work requested by the teacher, without student even being aware of how it does it !
- coldtea 7y ago>It would be much more fun doing it in Assembly language, without any use of any kind of library, expect for input and output. This way student would have learnt so much more, about how integer are manipulated into cpu (just bits in base 2) doing smart math conversion to represent it in base 10. And why not generalise the problem to also compute the size in base 8, or any base N. One could say as well: this isn't programming, this is low level language tricks. You don't need to know "how integers are manipulated into cpu" when learning to program, and at an introductory class like that described in the article you shouldn't either. There's a reason SICP at MIT was in Lisp and then Python. I also very much doubt it would be "much more fun doing it in Assembly language". The author went at length to explain how this is a useful exercize for programming, as it introduces edge cases, alternative implementations, testing, etc.
- roel_v 7y ago"The author went at length to explain how this is a useful exercize for programming, as it introduces edge cases, alternative implementations, testing, etc. " Well, as long as he disallowed the obvious solution (last paragraph of the OP), and then he still got the solution wrong... (see other comments up threat)
- netmonk 7y agoI understand what you say, but i think you are wrong. Assembly is closest to what a cpu actually does for REAL, so you are programming. When using Python or whatever any advanced language, you are less programming CPU and more relying and tons of layers from other's works which are basically created to never let you understand how to program a CPU. So peoples feels they are programming, while they are just integrating tons of library and set them to do something usefull (which is good too). But if you want to teach programming, i would follow my path, and provide a deeper understanding at how to control a cpu and how it really works. In order to demystify computer and gives student a real experience of all the hidden works that are done with a 4 lines python code. and for the fun side, guess why assembly is the second searched language on Stack overflow during weekend : https://stackoverflow.blog/2017/02/07/what-programming-languages-weekends/ https://stackoverflow.blog/2017/02/07/what-programming-langu... i guess people are trying to have more fun on weekend than on boring office project during work days :) And those numbers show a real interest about Assembly which is usually greatly discarded in any common CS teaching anywere. So teachers decides it's not interesting, while in fact most peoples search about it on weekend...I mean it illustrates a real issue here. May be understanding how to program a cpu at low level is something natural, that only scholar peoples cannot understand, therefore neglecting natural tendency of normal peoples to try to understand how things really work... And for those really wanting to even dig deeper and understand what is a CPU, i strongly suggest looking for "from nand to tetris" https://www.nand2tetris.org/ https://www.nand2tetris.org/ wich basically start at nand logical gate, to the extent to create a full working cpu and programming it to play tetris.
- SamReidHughes 7y agoYou can always learn assembly language later. Putting it in the intro class is a bad idea.
- netmonk 7y agowell can you develop a little bit your answer cause a one sentence opinion is just nothing.
- soVeryTired 7y ago
- rozab 7y agoYou think students should be writing assembly before they even know what a string is?
- unionpivo 7y agoBasic assembly is easy. (adding numbers, counting, basic comparisons, even basic branching, all you need is 12 or so instructions ). In our collage, one of the first semester classes we were doing assembly on old Motorola 8 bit, the other one was Java. people that never programmed before had more trouble with java, than assembler.
- netmonk 7y agoThis is exactly what i mean ! :)
- proc0 7y agoExactly this and programming screening interviews are full of this! > Evaluating different solutions leads to natural questions about the definitions implicit in the problem statement: mathematically, what is digit length? OF COURSE! This is a MATHEMATICAL problem that is posed as a PROGRAMMING question. This has always confused me and I could never justify until reading this article why I felt them to be irrelevant to showcasing my programming knowledge. At the very least just tell people, this is the mathematical reasoning behind it, and watch the person implement it.