好文档 - 专业文书写作范文服务资料分享网站

初学者 你应当如何学习C 以及编程

天下 分享 时间: 加入收藏 我要投稿 点赞

Software developers have become adept at the difficult art of

building reasonably reliable systems out of unreliable parts. The snag is that often we do not know exactly how we did it: a system just sort of evolved into something minimally acceptable. Personally, I prefer to know when a system will work, and why it will.

There are more useful systems developed in languages deemed awful than in languages praised for being beautiful--many more. The purpose of a programming language is to help build good systems, where good can be defined in many ways. My brief definition is, correct, maintainable, and adequately fast. Aesthetics matter, but first and foremost a language must be useful; it must allow real-world programmers to express real-world ideas succinctly and affordably.

I'm sure that for every programmer that dislikes C , there is one who likes it. However, a friend of mine went to a conference where the keynote speaker asked the audience to indicate by show of hands, one, how many people disliked C , and two, how many people had written a C program. There were twice as many people in the first group than the second. Expressing dislike of something you don't know is usually known as prejudice. Also, complainers are always louder and more certain than proponents--reasonable people acknowledge flaws. I think I know more about the problems with C than just about anyone, but I also know how to avoid them and how to use C 's strengths.

In any case, I don't think it is true that the programming languages are so difficult to learn. For example, every first-year university biology textbook contains more details and deeper theory than even an expert-level programming-language book. Most applications involve standards, operating systems, libraries, and tools that far exceed modern programming languages in complexity. What is difficult is the appreciation of the underlying techniques and their application to real-world problems. Obviously, most current languages have many parts that are unnecessarily complex, but the degree of those complexities compared to some ideal minimum is often exaggerated.

We need relatively complex language to deal with absolutely complex problems. I note that English is arguably the largest and most complex language in the world (measured in number of words and idioms), but also one of the most successful.

C provides a nice, extended case study in the evolutionary approach. C compatibility has been far harder to maintain than I or anyone else expected. Part of the reason is that C has kept evolving, partially guided by people who insist that C compatibility is neither necessary nor good for C. Another reason-- probably even more important--is that organizations prefer interfaces that are in the C/C subset so that they can support both languages with a single effort. This leads to a constant pressure on users not to use the most powerful C features and to myths about why they should be used carefully, infrequently, or by experts only. That, combined with backwards-looking teaching of C , has led to many failures to reap the potential benefits of C as a high-level language with powerful abstraction mechanisms.

The question is how deeply integrated into the application those system dependencies are. I prefer the application to be designed

conceptually in isolation from the underlying system, with an explicitly defined interface to the outer world, and then integrated through a thin layer of interface code.

Had I had a chance to name the style of programming I like best, it would have been class-oriented programming, but then I'm not

particularly good at finding snappy names. The school of thought that I belong to - rooted in Simula and related design philosophies -

emphasizes the role of compile-time checking and flexible (static) type systems. Reasoning about the behavior of a program has to be rooted in the (static) structure of the source code. The focus should be on guarantees, invariant, etc. which are closely tied to that static structure. This i

初学者 你应当如何学习C 以及编程

Softwaredevelopershavebecomeadeptatthedifficultartofbuildingreasonablyreliablesystemsoutofunreliableparts.Thesnagisthatoftenwedonotknowexactlyhowwedidit:as
推荐度:
点击下载文档文档为doc格式
9cr196nptu4g4gh0kzl91od1e2lmz900xt4
领取福利

微信扫码领取福利

微信扫码分享