Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #15347
| From | nick_keighley_nospam@hotmail.com |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Methods for understanding complex, real world, C++ code? |
| Date | 2012-04-13 02:16 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <31962842.1137.1334308566586.JavaMail.geo-discussion-forums@vbue17> (permalink) |
| References | <jm1l4g$a6e$1@dont-email.me> <026ff07f-a554-4ebf-96bf-35a0ae3d130a@d4g2000vbn.googlegroups.com> <b0a62f36-00fa-4216-b4ce-2964c0536d93@w5g2000vbp.googlegroups.com> <4f87905c$0$20314$c3e8da3$9deca2c3@news.astraweb.com> |
On Friday, April 13, 2012 3:32:59 AM UTC+1, Pavel wrote: <snip> > [...] there is often under-reported trade-off between the code's > flexibility and expandability and its readability. > > To mitigate, try to limit your use of the nastiest for reading > large codebases (IMHO) C++ features: > > - do not overload operators or write member operator functions (other > than for well-known *to others* idiomatic use, such as comparators for STL > containers or functors for STL algos) and those following normal mathematical conventions. It seems natural to use operator+ for, say, vector addition > - do not rely on namespaces to resolve name conflicts; at least not fully; > always get part of the namespace name into the class name not sure of the reasoning behind this. > (and maybe even some function name). *really* don't see this! You'd write queue.addToQueue (thingy); rather than queue.add (thingy); more typing, less clarity! > - try to avoid function overloading as much as possible ok. I'm not a heavy user so no argument. > - do not call your member functions anyhow similar to system function. why not! Each class is effectivly a namespace. This is one of the things that makes C++ clearer than C. IMHO. > That is, > avoid names like 'write'; instead be as specific as possible > 'writeCrocodileIndexToXyzHeader()' no. really, no. xyzHeader.write (crocodileIndex); or xyzHeader << crocodileIndex; short and clear. Where comes this mania for War-and-Peace identifier names? > [...] but the "line-of-code real estate" is at premium when you start > using really useful names so you might want to at least look into using camels). I don't accept that "long" is synonomous with "meaningful" > - Do not use utility methods in the namespaces; instead use utility > classes with static function (to enforce the qualification of function > name with the class name). you don't like namespaces so you reinvent namespaces > The above might explain why I often favor C over C++ for bigger projects > (despite the C++ supposedly being better for them). it shows. You seem to be trying to make C++ look like C. I'm not sure why > The following are not C++-specific > > - use long readable names for variables (other than parameters of short > functions with self-explaining names) up to a point. > - (I know, this will have lots of enemies) do not over-break your functions onto > smaller ones without significant and immediate gain (within reason, of course -- > a function longer than a screen may be worth breaking down). It is easier to > follow one 50-line function with one-liner "section headers" in comments than 10 > 5-line functions calling each other not sure this is always true. > and intermixed in alphabetical order yuk. This is a pain to maintain and not as helpful as some imagine. Your editor does have a search facility? Or are you still using coding pads? > even if > their names as so good that they "do not require comments"). you presumably don't agree this is possible? <snip> > - and in general, only add an infrastructure facility if and when it > is needed and gives palpable and immediate gain. Do not add code > "for future". YAGNI it's called > - Do not hesitate to remove "perfectly good" infrastructure code or > glue as soon as it is no longer used (even if you are 100% sure it is > not used only temporarily). sounds like work creation > To feel better about it, just think how much less you will have to > explain to your nasty manager or comment. > > And the following is not even technical at all: > > - Try to gain friends, not enemies, among your co-workers. Explain your > ideas. > Take other people's ideas (sometimes do it even if you believe their > ideas have no technical merit) sorry I'm too Geek to even *think* this! I'd rather saw my own head off. Friends? Friends!? we're computer programmers we don't have no stinking friends! > to get them involved. And sometimes you will avoid the trap > of your own biases against their ideas this way. As soon as they are on "write" > rather than "read" side of the fence, you have your allies. Make them invested > by letting them have a piece. Never get tired to explain (to me personally, > vis-a-vis and e-mails is a much better setting for getting ideas across than the > team meetings where a participant's goal is sometimes to look good rather than > to build understanding). 90% of meetings are a complete waste of time and 90% of the time spent in the other meetings is also a wasted.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Methods for understanding complex, real world, C++ code? mathog <dmathog@gmail.com> - 2012-04-10 08:54 -0700
Re: Methods for understanding complex, real world, C++ code? "K. Frank" <kfrank29.c@gmail.com> - 2012-04-10 12:55 -0700
Re: Methods for understanding complex, real world, C++ code? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 09:23 -0700
Writing extensions, like VBA "macros", Perl or JavaScript. @Jeff-Relf.Me - 2012-04-11 11:22 -0700
Re: Methods for understanding complex, real world, C++ code? Lynn McGuire <lmc@winsim.com> - 2012-04-11 14:35 -0500
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-11 21:53 +0000
Re: Methods for understanding complex, real world, C++ code? mathog <dmathog@gmail.com> - 2012-04-12 12:01 -0700
Re: Methods for understanding complex, real world, C++ code? "K. Frank" <kfrank29.c@gmail.com> - 2012-04-11 16:06 -0700
Re: Methods for understanding complex, real world, C++ code? Christopher Pisz <someone@somewhere.net> - 2012-04-12 11:46 -0500
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-12 22:32 -0400
Re: Methods for understanding complex, real world, C++ code? nick_keighley_nospam@hotmail.com - 2012-04-13 02:16 -0700
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-15 10:21 +0000
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-15 19:33 -0400
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-16 09:59 +0900
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-15 21:32 -0400
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-17 09:32 +0900
Re: Methods for understanding complex, real world, C++ code? scott@slp53.sl.home (Scott Lurndal) - 2012-04-17 02:06 +0000
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-17 11:35 +0900
Re: Methods for understanding complex, real world, C++ code? Ian Collins <ian-news@hotmail.com> - 2012-04-17 16:06 +1200
Re: Methods for understanding complex, real world, C++ code? scott@slp53.sl.home (Scott Lurndal) - 2012-04-17 15:24 +0000
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-18 04:50 +0900
Re: Methods for understanding complex, real world, C++ code? scott@slp53.sl.home (Scott Lurndal) - 2012-04-17 20:18 +0000
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-18 10:31 +0900
Re: Methods for understanding complex, real world, C++ code? scott@slp53.sl.home (Scott Lurndal) - 2012-04-18 01:36 +0000
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-18 11:00 +0900
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-18 22:09 -0400
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-19 11:41 +0900
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-18 23:04 -0400
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-19 13:33 +0900
Re: Methods for understanding complex, real world, C++ code? Ian Collins <ian-news@hotmail.com> - 2012-04-19 15:56 +1200
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-19 22:54 -0400
Re: Methods for understanding complex, real world, C++ code? Miles Bader <miles@gnu.org> - 2012-04-20 14:31 +0900
Re: Methods for understanding complex, real world, C++ code? Tobias Müller <troplin@bluewin.ch> - 2012-04-16 06:39 +0000
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-18 22:25 -0400
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-19 13:58 +0000
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-19 23:39 -0400
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-22 16:37 +0000
Re: Methods for understanding complex, real world, C++ code? Dombo <dombo@disposable.invalid> - 2012-04-19 23:20 +0200
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-19 23:54 -0400
Re: Methods for understanding complex, real world, C++ code? nick_keighley_nospam@hotmail.com - 2012-04-17 03:50 -0700
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-17 12:01 +0000
Re: Methods for understanding complex, real world, C++ code? Ian Collins <ian-news@hotmail.com> - 2012-04-11 08:04 +1200
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-10 22:26 +0000
Rewrite it. @Jeff-Relf.Me - 2012-04-10 16:31 -0700
Re: Rewrite it. nick_keighley_nospam@hotmail.com - 2012-04-11 01:20 -0700
Re: Rewrite it.  Rui Maciel <rui.maciel@gmail.com> - 2012-04-11 10:06 +0100
Re: Rewrite it. nick_keighley_nospam@hotmail.com - 2012-04-11 03:45 -0700
Building a "house" that you can live in for decades to come. @Jeff-Relf.Me - 2012-04-11 08:52 -0700
Re: Building a "house" that you can live in for decades to come. Miles Bader <miles@gnu.org> - 2012-04-12 13:19 +0900
Re: Methods for understanding complex, real world, C++ code? "K. Frank" <kfrank29.c@gmail.com> - 2012-04-10 17:37 -0700
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-12 21:40 -0400
Re: Methods for understanding complex, real world, C++ code? michael.boehnisch@gmail.com - 2012-04-10 17:29 -0700
Re: Methods for understanding complex, real world, C++ code? Rui Maciel <rui.maciel@gmail.com> - 2012-04-11 10:02 +0100
Re: Methods for understanding complex, real world, C++ code? jgk@panix.com (Joe keane) - 2012-04-11 22:36 +0000
Re: Methods for understanding complex, real world, C++ code? Noah Roberts <roberts.noah@gmail.com> - 2012-04-11 16:05 -0700
Re: Methods for understanding complex, real world, C++ code? Robert Wessel <robertwessel2@yahoo.com> - 2012-04-11 19:37 -0500
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-12 21:48 -0400
Re: Methods for understanding complex, real world, C++ code? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-15 09:56 +0000
Re: Methods for understanding complex, real world, C++ code? Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-04-15 19:43 -0400
csiph-web