现代C ++设计通用编程和设计模式 [英] Modern C++ Design Generic programming and Design Patterns Applied

查看:232
本文介绍了现代C ++设计通用编程和设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在公司购买这本书给我们的小组,也许是为了提高我们的设计技能,最终有更好的编程实践。当我阅读它,我发现,主要是一套漂亮的技巧,可以使用模板,不知道是否值得 - 而不是有害的 - 将其纳入我们的代码,从而引入代码复杂性/可读性和不可维护性。



我想了解从业者,你从那本书中使用什么?



对于这本书的一般想法,以及它如何适应大规模系统的软件开发(在

解决方案

/ div>

在标准模板使用之外,我发现关于通用C ++编程的信息最有用的操作是使用模板为无效代码场景创建编译时错误的能力。一旦你得到它的悬挂,你可以​​变得非常有效的把一个类是一个运行时错误编译为一个编译时错误。



我在工作中取得了很多成功。当然,它产生完全不可读的消息,我的同事偶尔会说世界上是什么?。但每次它是一个错误,他们无法编译它。我也大量评论特定的错误,希望它是适度可以理解的。


I have purchase this book for our group in the company, perhaps, to improve our design skills and ultimately have a better programming practices. As I read it, I find, mostly, a set of nifty tricks that can be used with template, and not sure if it is worthwhile - and not detrimental-to incorporate it into our code thus introducing code complexity/readability and un-maintainability.

I would like to find out from follow practitioners, what do you use from that book? What is relevant and important to professional software development, what should be avoided?

General thought about this book and how it fits into software development of large-scale system (on the same them, I love John Lakos book)?

What is the Alexandrescu effect?

解决方案

Outside of standard template uses, the operation I find most useful about the information talked about generic C++ programming, is the ability to use templates to create compile time errors for invalid code scenarios. Once you get the hang of it you can become very efficient at turning a class of what would be a runtime bug into a compile time error.

I've had a lot of success doing that at work. Sure it produces completely unreadable messages and my coworkers occasionally drop by and say "what in the world is that?". But every time it was a bug and they weren't able to compile it. I also heavily comment the particular errors in the hope that it's moderately understandable.

这篇关于现代C ++设计通用编程和设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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