了解大型C ++程序 [英] Understanding large C++ programs

查看:67
本文介绍了了解大型C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

X-No-Archive:


是否有任何好书可以提供有关如何理解的提示和

与...一起玩大型C ++程序?这似乎是一项非常重要的技能,但它在大学里几乎没有教过。基本的编程技巧

和语言结构的知识似乎不足以理解更大的程序。

解决方案

sasquatch写道:


是否有任何好书提供有关如何理解的提示和

玩耍大型C ++程序?



实际上,编写这些程序的语言并不重要。

理解大型系统需要采用与编写不同的方法

代码。这就是为什么在大多数情况下它是软件工程的原因。问题

而不是编程一个。


这似乎是一项非常重要的技能,



是的。教授并不是一项简单的技巧。知道如何铺设砖块并不足以建造房屋。但是,你可以学习如何建造房屋而不必学习砖块。


但它在大学里几乎没有教过。



我会接受你的话。


基本编程

b语言结构的技能和知识似乎不足以理解更大的程序。



他们不是。


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问


"萨斯克奇" < an **** @ gmail.comwrote in message

news:11 ********************** @ h48g2000cwc.googlegr oups.com ...


X-No-Archive:


有没有提供有关如何提示的好书理解和

玩大型C ++程序?这似乎是一项非常重要的技能,但它在大学里几乎没有教过。基本的编程技巧

和语言结构的知识似乎不足以理解更大的程序。



有些大型系统比其他系统更容易学习。它不是轻易教授的东西,因为有时甚至理解一个小程序可能会很痛苦

取决于它的编写方式。


一般来说,当我想了解一个程序时,我会在我最喜欢的编辑器中加载它并开始把它放到我熟悉的格式中。这个

做了两件事,它让我更容易阅读,但它也让我熟悉代码。我不会保存我做的编辑,但它只是帮助

我因为我必须完成整个代码。我不知道其他人是否这样做了b $ b。另一方面,如果代码已经是一种对我来说很容易的格式,那么我很高兴。


一我在那里做的事情是将愚蠢的变量名称改为

,如果他们没有这样做的话。哦,他们使用了ii步骤,

让我用搜索将其更改为NumOfSteps并替换我是否可以等等。


通常由时间我完成了我理解代码。如果没有,那么

我需要开始仔细观察它。


有些程序只是一种阅读的乐趣,带有良好的结构化代码和

逻辑变量名称我发现我可以像书一样简单地阅读它,如果不是更容易的话。


有一个程序我是然而,正在努力修改即使在3个月后工作的时候,我仍然完全不理解那些代码,它是如此可靠的b / b
可怕写的(C代码,而不是C ++)。


我真的不知道该告诉你什么。




sasquatch写道:


X-No-Archive:


是否有任何好书提供有关如何获取的提示理解和

玩大型C ++程序?这似乎是一项非常重要的技能,但它在大学里几乎没有教过。基本的编程技巧

和语言结构的知识似乎不足以理解更大的程序。



没有真正的方法来理解更大的程序。对于大多数人类大脑来说,这个问题太大了。如果

设计是好的,你可以理解大局。您可以非常好地理解特定部件以及如何将b / b
插入到更大的设计中。有时你比其他时候知道不同的部分

。我一下子只能绕着几行b
千行代码。这就是为什么我使用提醒

(描述性名称和小函数)以及不容易错误使用的构造。


真正的问题是能够跟踪和破译

代码的本地化区域,并了解您正在处理的区域。在这方面,一些

设计比其他设计更容易;例如,小的

函数总是比长函数更容易理解。一个技巧是

来做一个叫做刮刮的重构......也就是说,进入代码并且

在你看到需要的地方做一些清洁,当你是你把它扔掉了b $ b,然后重新开始,更清楚地知道需要什么。有效地描述了迈克尔的遗产代码中有效的描述

羽毛...或者你可以谷歌吧。


说到谷歌,一些好的关键词是重构。和设计

模式。


大多数大学教你在

劳动力中几乎不需要你。这种类型的东西只能通过经验获得。

有很多可以玩的操作系统项目,有些非常大。

您可以随时下载源代码并尝试要了解它即使

他们也不允许你提交更改。


X-No-Archive:

Are there any good books that provide tips about how to understand and
"play with" large C++ programs? It seems like a very important skill,
and yet its hardly taught in the universities. Basic programming skills
and knowledge of language constructs don''t seem enough for
understanding larger programs.

解决方案

sasquatch wrote:

Are there any good books that provide tips about how to understand and
"play with" large C++ programs?

Actually, it doesn''t matter in what language those programs are written.
Understanding large systems requires a different approach than writing
code. That''s why in most cases it''s a "software engineering" problem
and not a "programming" one.

It seems like a very important skill,

Yes. And it''s not a simple skill to teach. Knowing how to lay
bricks isn''t enough to build a house. However, you can learn to
build houses without ever learning to lay bricks.

and yet its hardly taught in the universities.

I''ll take your word for it.

Basic programming
skills and knowledge of language constructs don''t seem enough for
understanding larger programs.

They aren''t.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


"sasquatch" <an****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...

X-No-Archive:

Are there any good books that provide tips about how to understand and
"play with" large C++ programs? It seems like a very important skill,
and yet its hardly taught in the universities. Basic programming skills
and knowledge of language constructs don''t seem enough for
understanding larger programs.

Some large systems are easier to learn than others. It''s not something that
easily taught, as sometimes even understanding a small program can be a pain
depending on how it''s written.

Generally when I want to understand a program I will load it up in my
favorite editor and start putting it into a format I''m familiar with. This
does two things, it makes it easier for me to read, but it also makes me
familiar with the code. I will not save the editing I do, but it just helps
me becuase I have to go through the entire code. I don''t know if others do
this. If, on the other hand, code is already in a format that''s easy for me
to read then I''m happy.

One of the things I do there is change stupid variable names to ones that
make sense if they didn''t do that. Oh, they used ii for number of steps,
let me change that to NumOfSteps with search and replace if I can, etc..

Usually by the time I"m done with that I understand the code. If not, then
I need to start looking at it closer.

Some programs are just a joy to read, withi good structured code with
logical variable names I find I can read it as easy as a book, if not
easier.

There was one program I was working on, however, modifying that even after 3
months of working on it I still didn''t understand that code fully, it was so
horribly written (C code, not C++).

I really don''t know what to tell you.



sasquatch wrote:

X-No-Archive:

Are there any good books that provide tips about how to understand and
"play with" large C++ programs? It seems like a very important skill,
and yet its hardly taught in the universities. Basic programming skills
and knowledge of language constructs don''t seem enough for
understanding larger programs.

There is no real way to understand larger programs. The problem is too
large for most human brains. You can understand the big picture if the
design is good. You can understand particular parts very well and how
they plug into the bigger design. Sometimes you know different parts
than you do at other times. I can only wrap my head around a few
thousand lines of code at once. This is why I use reminders
(descriptive names and small functions) and constructs that are not
easily used incorrectly.

The real issue is being able to follow and decipher localized areas of
code and create an understanding of the area you are working on. Some
designs are easier than others in this regard; for instance, small
functions are always easier to understand than long ones. One trick is
to do what is called a scratch refactor...that is, go into the code and
do some cleaning wherever you see a need, when you are done you throw
it away and start over with a clearer idea of what is needed. It is
described better in Working Effectively with Legacy Code by Michael
Feathers...or you can google it.

Speaking of google, some good keywords are "refactoring" and "design
patterns".

Most Universities teach you next to nothing that you need in the
workforce. This type of thing is only recieved through experience.
There are plenty of OS projects you can play with, some are VERY large.
You can always download the source and try to understand it even if
they don''t let you submit changes.


这篇关于了解大型C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆