[翻译]《Programming - Principles and Practice Using C++, Second Edition》- Chapter 1

本书探讨了编程的重要性和趣味性,介绍了计算机、软件、人与编程的关系,强调了编程作为理解工具的价值。作者指出,编程不仅仅是技术,更是理解和解决问题的过程。书中通过分析编程在日常生活中的广泛应用,揭示了其在现代社会中的核心作用。
摘要由CSDN通过智能技术生成

书籍封面

Computers, People, and Programming 计算机,人和编程

Specialization is for insects. 专业化是为昆虫准备的。(而人应该什么都会做)
——R. A. Heinlein 罗伯特 · 海因莱因 1
在这里插入图片描述


In this chapter, we present some of the things that we think make programming important, interesting, and fun.
这一章,我们要讲一些对于编程很重要,有趣的东西。


We also present a few fundamental ideas and ideals. We hope to debunk a couple of popular myths about programming and programmers.
我们还会将几种基础的观点和想法。我们希望破除一些比较流行的关于程序和程序员的误解。


This is a chapter to skim for now and to return to later when you are struggling with some programming problem and wondering if it’s all worth it.
这章适合你在后面的编程学习卡住时回看,有助于你思考学习编程是否值得。

1.1 Introduction 介绍

Like most learning, learning how to program is a chicken and egg problem: We want to get started, but we also want to know why what we are about to learn matters.
就像学习其他学科一样,学习如何编程也是一个鸡生蛋蛋生鸡的问题:我们想要马上动手,而我们又想知道学编程是为了什么?

We want to learn a practical skill, but also make sure it is not just a passing fad. We want to know that we are not going to waste our time, but don’t want to be bored by still more hype and moralizing.
我们想要学习这门实践技能,但有不确定它是否只是昙花一现。我们感觉学这个不会浪费时间,但又不想陷入盲目的狂热和说教之中。

For now, just read as much of this chapter as seems interesting and come back later when you feel the need to refresh your memory of why the technical details matter outside the classroom.
至于现在,我们不想这些有的没的,一章章地认真看书吧。

This chapter is a personal statement of what we find interesting and important about programming. It explains what motivates us to keep going in this field after decades.
这一章的内容主要是我自己挑选出一些编程中有趣且重要的事物。这些事物解释了是什么驱动着人们在编程这个领域耕耘了几十年。

This is a chapter to read to get an idea of possible ultimate goals and an idea of what kind of person a programmer might be.
这章还讨论了一个人成为程序员的终极目标和他应具有的素质。

A beginner’s technical book inevitably contains much pretty basic stuff. In this chapter, we lift our eyes from the technical details and consider the big picture: Why is programming a worthwhile activity? What is the role of programming in our civilization? Where can a programmer make contributions to be proud of? Where does programming fit into the greater world of software development, deployment, and maintenance? When people talk about “computer science,” “software engineering,” “information technology,” etc., where does programming fit into the picture? What does a programmer do? What skills does a good programmer have?
一本技术入门书必然会包含许多基础知识。在这一章,我们不关注技术细节,而是着眼于专业全景:为什么编程是件有价值的事情?在人类文明中编程具有什么地位?程序员从何处获取到奉献的自豪感?为何编程正好顺应了软件开发,部署和维护(的潮流)?当人们谈论「计算机科学」、「软件工程」、「IT」时,编程在这些领域中又扮演着什么角色?程序员到底做什么工作?一个好的程序员应该具备什么样的素质?

To a student, the most urgent reason for understanding an idea, a technique, or a chapter may be to pass a test with a good grade — but there has to be more to learning than that!
对于学生来说,学习编程的首要理由是要以一个好的成绩通过考试——但真正的目标远不止于此。

To someone working in the software industry, the most urgent reason for understanding an idea, a technique, or a chapter may be to find something that can help with the current project and that will not annoy the boss who controls the next paycheck, promotions, and firings — but there has to be more to learning than that!
而对于那些已经在软件开发企业工作的人来说,当务之急是马上弄明白一个idea,技术或者从这章找出对正在着手的项目有用的东西,避免把老板整生气,从而影响下个月的薪水,升职,甚至被炒鱿鱼。——但还是那句话:真正的目标远不止于此!

We work best when we feel that our work in some small way makes the world a better place for people to live in. For tasks that we perform over a period of years (the “things” that professions and careers are made of ), ideals and more abstract ideas are crucial.
我们努力工作,因为我们知道自己正在为世界和人类做贡献,哪怕微不足道。而对于动辄需要数年,十数年,甚至数十年的事业,理想和更抽象的观念就变得十分重要。

Our civilization runs on software. Improving software and finding new uses for software are two of the ways an individual can help improve the lives of many. Programming plays an essential role in that.
我们的文明运行在软件之上。改进软件性能,寻找新的应用领域,这两种利用软件的方式可以改善许多人的生活。而编程之于软件,就是重中之重。

1.2 Software 软件

Good software is invisible. You can’t see it, feel it, weigh it, or knock on it. Software is a collection of programs running on some computer.
好的软件是隐形的。你看不见,感觉不到,碰不到它。软件是运行在某台计算机上的程序集合。

Sometimes, we can see the computer. Often, we can see only something that contains the computer, such as a telephone, a camera, a bread maker, a car, or a wind turbine.
有时,我们可以看见计算机。但更多时候,我们看见的是装着计算机的东西——比如电话,照相机,烤面包机,汽车或者风力发电机。

We can see what that software does. We can be annoyed or hurt if it doesn’t do what it is supposed to
do. We can be annoyed or hurt if what it is supposed to do doesn’t suit our needs.
我们已经看到软件都能做什么。当软件无法正确运行,或者不能给出我们想要的结果的时候,我们会很生气。


How many computers are there in the world? We don’t know; billions at least. There may be more computers in the world than people. We need to count servers, desktop computers, laptops, tablets, smartphones, and computers embedded in “gadgets.”
世界上一共有多少台计算机?没人知道准确的数字;少说有十亿台。这世界上计算机的数量或许比人还要多。我们要把服务器,桌面电脑,笔记本,平板电脑,智能手机和嵌入在「小设备」中的计算机都算进去。

How many computers do you (more or less directly) use every day? There are more than 30 computers in my car, two in my cell phone, one in my MP3 player, and one in my camera.
每天你又会使用多少个计算机?以我的情况来看,我的汽车里差不多有30个,手机里有2个,MP3里有1个,照相机里有1个。

Then there is my laptop (on which the page you are reading is being written) and my desktop machine. The air-conditioning controller that keeps the summer heat and humidity at bay is a simple computer.
然后还有我的笔记本电脑(也就是我正用来写这本书的)和我的台式机。还有空调里的控制器,也算一个简单的计算机。

There is one controlling the computer science department’s elevator. If you use a modern television, there will be at least one computer in there somewhere
我所在的计算机学院的电梯里面也有一个控制电梯的计算机。如果你家里的电视是智能电视,那么它的里面也至少有一个计算机。

A bit of web surfing gets you into direct contact with dozens — possibly hundreds — of servers through a telecommunications system consisting of many thousands of computers — telephone switches, routers, and so on.
而你简简单单,网上冲会儿浪就可能与几十台——甚至上百台服务器通讯交互,而这些服务器是处在由成千上万台计算机——交换机,路由器以及其他设备——组成的电信系统之中。


No, I do not drive around with 30 laptops on the backseat of my car! The point is that most computers do not look like the popular image of a computer (with a screen, a keyboard, a mouse, etc.); they are small “parts” embedded in the equipment we use.
声明一下,我并不是说我的车的后座上有30台笔记本电脑!我的意思是大部分电脑并不是以我们熟悉的形式(一个屏幕,一个键盘,一个鼠标),而是非常小,嵌入到我们使用的设备中。

So, that car has nothing that looks like a computer, not even a screen to display maps and driving directions (though such gadgets are popular in other cars).
所以,车里面没有长得像电脑的东西,甚至是显示地图和方位的显示屏。

However, its engine contains quite a few computers, doing things like fuel injection control and temperature monitoring.
然而,发动机中有很多电脑,他们控制着燃油喷嘴,监视着运行温度。

The power-assisted steering involves at least one computer, the radio and the security system contain some, and we suspect that even the open/close controls of the windows are computer controlled. Newer models even have computers that continuously monitor tire pressure
助力转向系统以至少有一个计算机,广播和安全系统也包括几台,开关窗也是由计算机控制的。新的车型还会有专门的计算机监控胎压。


How many computers do you depend on for what you do during a day? You eat; if you live in a modern city, getting the food to you is a major effort requiring minor miracles of planning, transport, and storage.
一天之中计算机又帮助你做了多少决策呢?以「吃」为例;如果你住在城市里,得到事物这个需要付出巨大努力的事情的背后是有计划、运输、仓储等一系列小「奇迹」作为依靠的。

The management of the distribution networks is of course computerized, as are the communication
systems that stitch them all together. Modern farming is highly computerized; next to the cow barn you find computers used to monitor the herd (ages, health, milk production, etc.), farm equipment is increasingly computerized, and the number of forms required by the various branches of government can make any honest farmer cry.
物流网络的管理很显然是需要计算机做计算支持的,网络又把不同的物流网络连在一起。现代农业高度依赖计算机;牛棚的旁边你可以找到显示屏,上面有牛的年龄,健康状况和产奶量等指标的数据,农场其他设备也需要计算机,政府各个部门要求填的表格让农民苦不堪言。

If something goes wrong, you can read all about it in your newspaper; of course, the articles in that paper were written on computers, set on the page by computers, and (if you still read the “dead tree edition”) printed by computerized equipment — often after having been electronically transmitted
to the printing plant. Books are produced in the same way.
你可以从报纸上知道发生了什么事情;当然,报纸上的新闻是用计算机上的软件编辑、分页、排版、打印的。书籍和报纸一样。

If you have to commute, the traffic flows are monitored by computers in a (usually vain) attempt to avoid traffic jams. You prefer to take the train? That train will also be computerized; some even operate without a driver, and the train’s subsystems, such as announcements, braking, and ticketing, involve lots of computers.
通勤途中,交通状况的数据也会显示在交通指挥中心的大屏幕上来帮助交警进行调度,防止交通堵塞(通常没有吊用)。你喜欢坐火车么?火车也受计算机控制;一些火车甚至没有司机,火车上的各种系统,比如广播,刹车,检票系统,都依靠计算机运行着。

Today’s entertainment industry (music, movies, television, stage shows) is among the largest users of computers. Even non-cartoon movies use (computer) animation heavily; music and photography are also digital (i.e., using computers) for both recording and delivery.
今天的娱乐产业(音乐,电影,电视,舞台秀)都离不开计算机。即便不是动画的真人电影,也会使用计算机动画技术;音乐和摄影都需要使用计算机进行录制和分发。

Should you become ill, the tests your doctor orders will involve computers, the medical records are often computerized, and most of the medical equipment you’ll encounter if you are sent to a hospital to be cured contains computers
人一定会生病,医生用计算机开处方,你的用药记录、就诊记录也存在计算机里。

Unless you happen to be staying in a cottage in the woods without access to any electrically powered gadgets (including light bulbs), you use energy.
即使你碰巧住在没有电力供应的丛林小木屋里,你也逃不过计算机,因为你需要使用能量。

Oil is found, extracted, processed, and distributed through a system using computers every step along the way, from the drill bit deep in the ground to your local gas (petrol) pump.
而能量的来源——石油的勘探,加工,运输都基于一个有计算机的系统里,从石油从钻井里被打出来,到石油液化气加到你所在城市的加油站的泵里,这中间的每一步,都需要计算机。

If you pay for that gas with a credit card, you again exercise a whole host of computers. It is the same story for coal, gas, solar, and wind power
你用信用卡支付气的费用时,你就又和众多计算机交互了。对于煤,天然气,太阳能,风能,都是如此。


The examples so far are all “operational”; they are directly involved in what you are doing.
这些例子都是生活中「能做到」的,和你的日常生活里直接相关。

Once removed from that is the important and interesting area of design. The clothes you wear, the telephone you talk into, and the coffee machine that dispenses your favorite brew were designed and manufactured using computers.
还有设计领域。你穿的衣服,你用的电话,你使的咖啡机,从它们的设计到生产都用到了计算机,他们本身也都包含计算机。

The superior quality of modern photographic lenses and the exquisite shapes in the design of modern everyday gadgets and utensils owe almost everything to computer-based design and production methods.
如今高质量的摄影镜头和其他形状奇特,具有现代感的事物,器具,无不是借助计算机设计和生产出来的。

The craftsmen/designers/artists/engineers who design our environment have been freed from many physical constraints previously considered fundamental. If you get ill, the medicines given to cure you will have been designed using computers.
工程师/设计师/艺术家/建筑师借助计算机的力量,得以突破物理世界的限制,尽情发挥他们的才能。如果你病了,你用的药物的合成结构甚至都是计算机设计出来的。


Finally, research — science itself — relies heavily on computers. The telescopes that probe the secrets of distant stars could not be designed, built, or operated without computers, and the masses of data they produce couldn’t be analyzed and understood without computers
最后,还有科研,也是极度依赖计算机的领域。没有计算机,天文望远镜没法设计制造出来,就更别谈使用和处理望远镜获取的海量数据。

An individual biology field researcher may not be heavily computerized (unless, of course, a camera, a digital tape recorder, a telephone, etc. are used), but back in the lab, the data has to be stored, analyzed, checked against computer models, and communicated to fellow scientists.
生物学家也离不开计算机,实验室数据需要存储,分析,模型需要在计算机上检验正确与否,科学家也需要通过计算机交流科研成果。

Modern chemistry and biology — including medical research — use computers to an extent undreamed of a few years ago and still unimagined by most people. The human genome was sequenced by computers. Or — let’s be precise — the human genome was sequenced by humans using computers.
现代化学家生物学家,包括药学家,使用计算机能实现以前想都不敢想的事情。人类基因组计划就是靠计算机得出基因序列的。或者我们准确地说,人类基因是靠着人使用计算机测序的。

In all of these examples, we see computers as something that enables us to do something we would have had a harder time doing without computers.
这所有的例子,无不在证明我们已经离不开计算机,很多事情没了计算机很难做成。


Every one of those computers runs software. Without software, they would just be expensive lumps of silicon, metal, and plastic: doorstops, boat anchors, and space heaters.
每台计算机上都运行着软件。没有软件的计算机,就是一坨昂贵的,由硅片,金属和塑料组成的,浪费巨大空间的「门挡」,沉的要死的「船锚」,或者能给整个房间取暖的「小太阳」,毫无用处。

Every line of that software was written by some individual. Every one of those lines that was actually executed was minimally reasonable, if not correct. It’s amazing that it all works!
软件的没一行代码都是由某人编写的。每一行,哪怕有错误,只要能执行,就有它的道理。

We are talking about billions of lines of code (program text) in hundreds of programming languages. Getting all that to work took a staggering amount of effort and involved an unimaginable number of
skills.
我们所讨论的是由上百种语言编写的数十亿行代码。可以想象,产出这么多代码需要付出多少人的心血,多长时间的努力。

We want further improvements to essentially every service and gadget we depend o

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
《计算机图形学:原理与实践》第21章-动画 动画在计算机图形学中起着重要的作用,它可以通过计算机生成逼真的运动图像来模拟现实世界中的动态效果。第21章详细介绍了动画的原理和实践。 动画的目标是通过序列帧的播放来创造出连续的运动感。本章介绍了两种常见的动画制作方法:关键帧动画和插值动画。 关键帧动画是通过在时间轴上选择关键帧来定义动画的开始和结束状态,然后计算机会自动填充中间帧。这种方法可以减少制作动画的工作量,但帧与帧之间的过渡可能不够平滑。 插值动画则通过在关键帧之间插入中间帧来创建流畅的动画效果。其中,线性插值是最简单的方法,通过计算两个关键帧之间的过渡来生成中间帧。其他的插值方法还包括贝塞尔曲线插值和样条插值等,它们能够更好地保持物体的形态和运动特性。 此外,本章还介绍了动画中的常见技术,如运动模糊和骨骼动画。运动模糊通过在连续帧之间模糊对象来模拟物体的运动轨迹,使动画更加真实。骨骼动画则是通过在物体上添加骨骼和关节来模拟物体的形变和动作,从而实现更加灵活和逼真的动画效果。 此外,本章还介绍了动画中使用的额外技术,如动画蒙皮和递归动画。动画蒙皮是将物体的外表表面贴上一个虚拟的模型,使其能够更好地跟随物体的运动。递归动画则是通过将一个物体分解成多个部分,然后对每个部分进行独立的动画处理,最终合成整个物体的动画。 总而言之,《计算机图形学:原理与实践》第21章详细介绍了动画的原理和实践,包括关键帧动画、插值动画、运动模糊、骨骼动画、动画蒙皮和递归动画等技术。通过学习本章内容,读者可以更好地理解和应用计算机图形学中的动画技术。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值