看到国外一个论坛上一个低年级学生发问,大概意思就是,他不用写算法就可以把程序写的很好。
实际上,写算法等于写解决问题的步骤,对于简单问题,即便不写算法,这步骤也在脑子里了,谁让这问题简单了。如果遇到复杂问题,还能靠脑子么?还是需要一个步骤、计划。
初学者看的编程教材,没有一个是教编程序逻辑的,都是教语法规则,所以那些题目自然都不是现实中的需求,都是经过设计之后的问题。比如那些基于排序衍生出的各种题目。
学编程,是学编程逻辑,是解决现实问题的逻辑,不是编程语法。
“I'm in CS 1 and learning Java. I'm doing well (thank God), but one aspect that I'm just not understanding how to utilize correctly: Using the algorithm the correct way. I understand the point of algorithms, it always make sense to have a good, concrete plan to attack a problem and follow it.
My issue is, I think I almost have a harder time writing an algorithm. I'll be told to write an algorithm first, then code. Most of the time, I find myself sitting there for so long wondering hmm what should be done first... what 2nd, what third etc. What I'll end up doing, is skipping the algorithm, and just start coding without one. And I fill it in in reverse basically, doing the main code first and algorithm afterwards, just so show I did an algorithm.
I don't know if this sounds absolutely ridiculous or stupid. I am still new to this. Basically, I can work out code in my head while coding, and I move and correct myself as I go, and it almost always turns out nicely. It feels easier to me to code without having to write an algorithm first, because I don't know how to write said algorithm until I start seeing what things look like.
Does any of this make sense? Please tell me I'm not crazy, and make me realize that this is the wrong way to go about this. I'm sure if I become a developer one day, this habit will not work out at all.”