用于重构头文件的工具 [英] Tools for refactoring header files

查看:67
本文介绍了用于重构头文件的工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道任何重构头文件的工具?


我们在工作中使用第三方代码库,几乎每个文件都是

包括一个50Mb的预编译头文件。我正在寻找一个工具,它将会让我们知道每个.cpp实际需要哪些头文件,并且

允许我们将其分解,以便我们不是每个人都包括这个世界。


理想情况下,同样的工具也会识别#include可以替换的地方

带有前向声明,甚至更好,它会自动更新

代码文件。


有没有这样的工具?或者我是SOL,直到一些明亮的火花写一个?


谢谢,

Si

解决方案

Simon Cooke写道:

有没有人知道任何重构头文件的工具?




我可以回想一下Lakos在他的书/大规模C ++中指出了一个谣言:b
软件设计/,我可以回想起它不受支持的传言。你的Google

和我的一样好。


我敢打赌人们不需要一个,因为当他们有第三方时/>
代码库在工作中,其中几乎每个文件都包含一个50Mb预编译的

头文件,他们倾向于抛出一种名为Pimpl的技术:

http://www.gotw.ca/publications/mill04.htm


获取上述书籍,并获得/ C ++编码标准/ Sutter&

Alexandrescu。


然后追捕写下这段代码的人并用这些书砸他们。 C ++

有效,因为干净的逻辑设计可以实现干净的物理设计,而且我认为你的物理设计也值得怀疑。阅读/工作

有效地使用Legacy Code / Mike Feathers来解决这个问题。


其他人可能确实知道一个工具。我只是张贴,因为你的帖子

过时了,你并没有宣称Pimpl是你的第一道攻击线。

通常是。它对你的情况很有好处,因为它显示了如何清理几乎所有.h文件中的所有内容而不改变任何符合逻辑的b $ b设计。长期,改善逻辑设计


-

Phlip
http://www.greencheese.org/ZeekLand < - 不是博客!!!


< blockquote>

Phlip写道:

Simon Cooke写道:

有没有人知道任何重构头文件的工具?


我敢打赌人们不需要一个,因为当他们有第三方工作时的代码库时,其中几乎每个文件都包含一个50Mb预编译的头文件,他们倾向于抛出一种名为Pimpl的技术:

http://www.gotw.ca/publications/mill04.htm




Pimpl无法帮助已经知道标题的OP需要

重构。


解决这个问题的唯一方法是分钟和小时的剪切和粘贴

操作然后编译,然后追踪错误

来自哪里。整体标题太复杂了,无法将你的头部包裹起来,所以你_have_分解并使用编译器作为

错误跟踪工具。它不是一个非常好的并且会吐出来很难解释错误但是这是你在这种情况下最好的。


Took我连续两天完成了我们的工作,还有一个我从未接触过的
很多,直到我需要把它拉开来。


好运气。


On Tue,2006年4月18日11:13:49 -0700,Simon Cooke

< sc************@surr-nospam-eal.com>写道:

有没有人知道任何重构头文件的工具?




C ++缺乏良好的重构工具,主要是因为复杂的/>
语法。另见例如
http://www.artima .com / weblogs / viewpost.jsp?thread = 11070

祝福,

Roland Pibinger


Does anyone know of any tools for refactoring header files?

We''re using a third party codebase at work, and pretty much every file
includes a 50Mb precompiled header file. I''m looking for a tool that will
let us figure out which header files are actually needed by each .cpp, and
allow us to break this up so that we''re not including the world in each one.

Ideally, the same tool would also recognize where #includes can be replaced
with forward declarations, and even better, it''d automate the updates to the
code files.

Is there such a tool? Or am I SOL until some bright spark writes one?

Thanks,
Si

解决方案

Simon Cooke wrote:

Does anyone know of any tools for refactoring header files?



I can recall rumors that Lakos pointed out one in his book /Large Scale C++
Software Design/, and I can recall rumors it is not supported. Your Google
is as good as mine.

I would bet folks don''t need one because, when they have "a third party
codebase at work," where "pretty much every file includes a 50Mb precompiled
header file," they tend to throw a technique called Pimpl at it:

http://www.gotw.ca/publications/mill04.htm

Get the above-mentioned book, and get /C++ Coding Standards/ by Sutter &
Alexandrescu.

Then hunt down whoever wrote this code and smack them with those books. C++
works because clean logical designs enable clean physical designs, and I
would bet your physical design is also questionable. Read /Working
Effectively with Legacy Code/ by Mike Feathers to get ahead of that problem.

Someone else might indeed know of a tool. I''m only posting because your post
went stale, and you didn''t declare that Pimpl was your first line of attack.
It usually is. It''s good for your situation because it shows how to clean
nearly everything out of a .h file without changing anything''s logical
design. Long term, improving the logical design

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!



Phlip wrote:

Simon Cooke wrote:

Does anyone know of any tools for refactoring header files?

I would bet folks don''t need one because, when they have "a third party
codebase at work," where "pretty much every file includes a 50Mb precompiled
header file," they tend to throw a technique called Pimpl at it:

http://www.gotw.ca/publications/mill04.htm



Pimpl doesn''t help the OP, who already knows the header needs
refactoring.

The only way to fix this problem is hours and hours of cut and paste
operations followed by compiling, followed by tracing where the errors
are comming from. Monolithic headers are just way too complex to wrap
your head around so you _have_ to break down and use the compiler as an
error tracing tool. It doesn''t make a very good one and will spit out
difficult to interpret errors but it is the best you got in this case.

Took me over two solid straight days to do ours and there is still a
lot I never touched and let be until I need to pull it apart.

Good luck.


On Tue, 18 Apr 2006 11:13:49 -0700, "Simon Cooke"
<sc************@surr-nospam-eal.com> wrote:

Does anyone know of any tools for refactoring header files?



C++ lacks good refactoring tools, mostly due to the complicated
syntax. See also e.g.
http://www.artima.com/weblogs/viewpost.jsp?thread=11070 .

Best wishes,
Roland Pibinger


这篇关于用于重构头文件的工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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