星期一的早上就看到如此有趣的文章,让我心情愉快。
C++程序员难道真的就低人一等(或者说,高人一等)吗?作为一种常用的OO语言,C++得到的支持少得可怜。特别是,自动化重构工具和单元测试IDE集成的缺乏,使得C++几乎不可能成为XP团队的首选——或者说,使得很多C++团队错失了实施XP的机会。
————————
Let's Reconsider That
Aren't C++ Programmers People Too?
by Michael Feathers
August 23, 2003
Summary
The industry needs refactoring tools for C++. Now.
C++ programmers are people too, aren't they? You wouldn't think anyone thought so, the way the industry looks today. Java started its run in the late 90s and it rapidly became the lingua franca of programming. Over night, authors started using it for all of their examples in books and articles. Certainly this was response to the market, but Java is also a much more succinct language. If you are going to write about design, Java gives you a better chance of fitting a code snippet on a page. The net effect, however, is that if you look around for evidence of C++'s continued existence, it is pretty easy to miss it. And, if you are one of these invisible C++ programmers and you are aware of that tools are available for Java but not C++, well, you should be screaming. C++ was my first OO language and every time I go back to program in it I notice the lack of support.
A few weeks ago, I was working with a team whose code is split right down the middle. Half of the code is Java and the other half is C++. At the beginning of each iteration, the team members sign up for tasks. When someone walks into the room each morning you can pretty much tell whether they'll be working in C++ or Java. Their faces tell the story. The people who are going to be working in Java march in confidently and start up their Java-based IDE, then they go to get coffee while it loads (yes, there still are some issues in Java-land). When they get back with steaming cups in hand, they look around at the code, find the methods they need to change. They click a menu item and it shows them all of the places that send a particular message. Then they start going through the work of carving out a space to work with their code. They click the mouse around to extract interfaces and methods automatically so that they can get some tests in place for their changes. The C++ programmers come in and bring up vi or emacs (they load quickly so no coffee for the C++ guys) then they browse around the code manually and start to figure out where to make their changes. Figuring out what uses what is often a blind-alley search. When they are ready to break some dependencies, they sit there and try to manually peel off interfaces by introducing virtual functions. They create new header files and extract methods by hand, all the while hoping and praying that they aren't breaking anything. Without an automated tool to check their refactorings it is a nerve-wearing process and it's also several times slower. They know that the Java code is getting better, but it is hard to feel the progress on the C++ side. I don't think the lack of coffee has anything to do with it.
Occasionally, some C++ teams I visit don't know what refactoring tools are out there. I was showing a team a testing technique a while back. The technique was language independent, so I pulled up a Java IDE. Over the course of my coding I found a method name that I didn't like. I pulled down a menu and hit rename. When I typed in the new name it was replaced every place it was used. Not every place in the file, every place it was used. Three of the team members recognized what they saw when I did it and they shouted "NNNOOO WAAAAAYYY!!!" I think I could have induced dead faints if I'd shown an automated extract method refactoring.
The sad thing is, it shouldn't be like this.
The first research into automated OO refactoring was done by Bill Opdyke and Ralph Johnson in the early 1990s, in C++. After that, John Brant and Don Roberts developed the first Smalltalk refactoring browser. Later, Martin Fowler wrote the book 'Refactoring.' That book and Extreme Programming really put refactoring on the radar screen. Java vendors scrambled to build refactoring tools into their IDEs. After all, it was the lingua franca, the language everyone is using, right?
In a few weeks, I'll be visiting another C++ team. This isn't atypical. There is a lot of C++ out there. More than anyone would imagine from looking at literature in "the industry." I wish I could tell them that someday there will be a refactoring tool for C++. For teams with large existing code bases it would be an immediate boost.
分享到:
相关推荐
在C++程序员的成长道路上,经常会遇到一些常见的误区和弯路,这些弯路不仅会浪费大量时间,还可能阻碍技能的真正提升。以下是C++程序员在成长过程中最常走的四条弯路,以及如何避免它们。 ### 弯路一:通过MS-VC++ ...
### C++程序员的婚礼——一场别开生面的友元关系结成典礼 #### 背景介绍 本文档描述了一场独特的婚礼仪式,名为“C++程序员的婚礼”,旨在纪念两位程序员达瑞(Darren)和卡娜(Katrina)。这场婚礼不仅仅是一场...
标题和描述中提到的是一个关于C++编程的学习项目,旨在帮助初级程序员通过创建一个简单的银行储蓄系统来掌握面向对象编程的基本概念和C++语言的应用。这个项目的核心是设计和实现两个类:Bank和Account,分别代表...
C、C++语言是IT行业的主流编程语言,也是很多程序员必备的软件基本功,是软件开发行业招聘考查的重点。本书以流行的面试题讲解为主要内容,介绍了C、C++语言基本概念,包括保留字、字符串、指针和引用、结构体、...
这个名为“C_C++程序员大全 代码+学习软件”的资源包显然是为了帮助程序员们提升C/C++技能而设计的。 C语言,由Dennis Ritchie在1972年创建,是一种静态类型的、过程式的、编译型的语言。它的设计目标是提供一种低...
标题 "C++程序员生活剧目" 暗示了这个压缩包内容可能是一个与C++编程相关的创意作品,可能是剧本或者故事,通过一种娱乐化的方式来展现C++程序员的生活。描述中的"Diegozhou2008的元旦节目剧目编排"表明这是一次庆祝...
"C++程序员面试自我介绍" 本文将从标题、描述、标签和部分内容四个方面对C++程序员面试自我介绍进行详细分析,并生成相关知识点。 标题分析 从标题"C++程序员面试自我介绍"可以看出,这是一个关于C++程序员面试的...
面试中,C++程序员经常会被问到一些关于语言核心特性的题目。以下是一些关键知识点,涉及到C++的引用这一特性及其在函数参数和返回值中的应用。 1. **函数func(x)的返回值**:此函数用于计算整数x二进制表示中1的...
《C和C++程序员面试秘笈》是一本专门为C和C++开发者准备的面试指南,由董山海撰写,共计467页,全面涵盖了C和C++编程语言的基础、进阶以及面试常见问题。这本书旨在帮助求职者在面试过程中展现出扎实的编程基础和...
【C++程序员创业案例分析】 在IT行业中,C++程序员以其强大的编程能力和高效的语言特性,常常在游戏开发、系统编程等领域发挥着重要作用。然而,作为程序员,如何从技术背景出发,成功转型为创业者,建立自己的公司...
然而,对于大多数C++程序员来说,从技术专家转变为创业者并非易事,但并非不可能。以下是对C++程序员如何创业的一些关键点分析: 1. 技术背景与市场洞悉: C++程序员往往具有扎实的编程基础,特别是在处理复杂系统...
许多现代编程语言,如C++、Java、C#等,都是在C语言的基础上进行扩展或改写而来的。程序员之所以需要学习C语言,原因如下: 1. 理解计算机底层原理:C语言是一种低级语言,它与计算机硬件非常接近。通过学习C语言,...
### C++ 程序员学习过程 在 IT 领域中,C++ 是一种极为重要的编程语言,尤其在高性能计算、系统软件开发、游戏引擎等领域占据着核心地位。对于希望成为 C++ 专家的程序员来说,掌握一系列关键概念和技术至关重要。...
《C/C++程序员实用大全》是一本面向C++编程者的宝贵资源,包含了丰富的源代码示例,旨在帮助读者深入理解和熟练应用C++编程语言。这个压缩包中的内容可能包括各种编程技巧、常见问题的解决方案以及实用的小程序示例...
随着技术的进步,编程的思维和模式、方法也会发生翻天覆地的转变,现在思路跟三五年前相比可能就会大不相同,现在做项目需要的是新的、巧的设计思想, 所以程序员必须要提高系统设计的能力,否则永远出不了头;...
对于C++程序员来说,掌握基础语法、数据结构、算法以及设计模式等核心概念是至关重要的。本资源"《C++程序员必读常用面试题》"包含了面试中常见的问题和解答,旨在帮助C++开发者准备面试,提升技能。 1. **基础语法...
### Visual C++程序员面试技巧全解析 面试是程序员求职道路上至关重要的一步,尤其是对于专注于Visual C++领域的开发者而言。本文将深入探讨Visual C++程序员在面试前、面试中以及面试后的全方位策略,帮助求职者更...