1

作为一名业余程序员已经 3 年(主要是 Python 和 C)并且从未编写过超过 500 行代码的应用程序,我发现自己面临着两种选择:

(1) 学习数据结构和算法设计的基本知识,这样我就可以成为一名 33 岁的计算机科学家。

(2) 学习 Qt,这将帮助我构建我一直渴望构建的项目。

对于学习(1),大家似乎都推荐阅读CLRS。不幸的是,阅读 CLRS 至少需要一年的学习时间(或者更多,我不是 Peter Krumins)。我也明白,要使用 (2) 完成任何中等复杂的任务,我至少需要了解 (1) 的基础知识,这让我想到了我的问题:假设我使用 C++ 作为选择的编程语言,哪些部分CLRS 会给我足够的算法和数据结构知识,以便使用 (2) 处理大型项目?

换句话说,我需要一份对日常应用程序编程任务绝对必要的理论 CompSci 主题列表。此外,我想将 CLRS 用作方便的参考,因此我不想跳过任何对理解本书后面部分至关重要的材料。

不要在这里误会我的意思。离散数学和 CompSci 的理论基础已经在我的“TODO: URGENT”列表上大约 6 个月了,但由于大学工作,我没有足够的时间。很长一段时间后,我有 15 天的假期来做任何我喜欢做的事,我想用这 15 天来构建我真正想要构建的应用程序,而不是坐在办公桌前,手里拿着笔和纸,试图写下来教科书问题的解决方案。

(顺便说一句,关于算法的少数学多代码资源将受到高度赞赏。我刚从高中毕业,我的数学还没有达到应有的水平。)

谢谢 :)

4

8 回答 8

7

This could be considered heresy, but the vast majority of application code does not require much understanding of algorithms and data structures. Most languages provide libraries which contain collection classes, searching and sorting algorithms, etc. You generally don't need to understand the theory behind how these work, just use them!

However, if you've never written anything longer than 500 lines, then there are a lot of things you DO need to learn, such as how to write your application's code so that it's flexible, maintainable, etc.

于 2008-12-17T17:39:57.347 回答
2

要获得比 CLRS 更少的数学、更多的算法代码资源,请查看Algorithms in a Nutshell。如果您要编写桌面应用程序,我不认为 CLRS 是必读的。如果您使用的是 C++,我认为Sedgewick是更合适的选择。

于 2008-12-17T17:16:04.323 回答
2

尝试一些在线计算机科学课程。伯克利有一些,麻省理工学院也有。软件工程广播也是一个很棒的播客。

另请参阅以下问题:

对于盲人程序员来说,有哪些好的计算机科学资源? https://stackoverflow.com/questions/360542/plumber-programmers-vs-computer-scientists#360554

于 2008-12-17T17:27:53.037 回答
1

Heed the wisdom of Don and just do it. Can you define the features that you want your application to have? Can you break those features down into smaller tasks? Can you organize the code produced by those tasks into a coherent structure?

Of course you can. Identify any 'risky' areas (areas that you do not understand, e.g. something that requires more math than you know, or special algorithms you would have to research) and either find another solution, prototype a solution, or come back to SO and ask specific questions.

于 2008-12-17T17:50:04.100 回答
0

Moving from 500 loc to a real (eve if small) application it's not that easy. As Don was pointing out, you'll need to learn a lot of things about code (flexibility, reuse, etc), you need to learn some very basic of configuration management as well (visual source safe, svn?)

But the main issue is that you need a way to don't be overwhelmed by your functiononalities/code pair. That it's not easy. What I can suggest you is to put in place something to 'automatically' test your code (even in a very basic way) via some regression tests. Otherwise it's going to be hard.

As you can see I think it's no related at all to data structure, algorithms or whatever.

Good luck and let us know

于 2008-12-17T18:03:50.217 回答
0

I must say that sitting down with a dry old textbook and reading it through is not the way to learn how to do anything effectively, even if you are making notes. Doing it is the best way to learn, using the textbooks as a reference. Indeed, using sites like this as a reference.

As for data structures - learn which one is good for whatever situation you envision: Sets (sorted and unsorted), Lists (ArrayList, LinkedList), Maps (HashMap, TreeMap). Complexity of doing basic operations - adding, removing, searching, sorting, etc. That will help you to select an appropriate library data structure to use in your application.

And also make sure you're reasonably warm with MVC - i.e., ensure your model is separate from your view (the QT front-end) as best as possible. Best would be to have the model and algorithms working on their own, and then put the GUI on top. Or a unit test on top. Etc...

Good luck!

于 2008-12-17T18:37:23.270 回答
0

It's like saying you want to move to France, so should you learn french from a book, and what are the essential words - or should you just go to France and find out which words you need to know from experience and from copying the locals.

Writing code is part of learning computer science. I was writing code long before I'd even heard of the term, and lots of people were writing code before the term was invented.

Besides, you say you're itching to write certain applications. That can't be taught, so just go ahead and do it. Some things you only learn by doing.

(The theoretical foundations will just give you a deeper understanding of what you wind up doing anyway, which will mainly be copying other people's approaches. The only caveat is that in some cases the theoretical stuff will tell you what's futile to attempt - e.g. if one of your itches is to solve an NP complete problem, you probably won't succeed :-)

于 2008-12-17T18:40:11.983 回答
0

I would say the practical aspects of coding are more important. In particular, source control is vital if you don't use that already. I like bzr as an easy to set up and use system, though GUI support isn't as mature as it could be.

I'd then move on to one or both of the classics about the craft of coding, namely

You could also check out the list of recommended books on Stack Overflow.

于 2008-12-17T18:42:09.890 回答