6 ms·
Hey! This is great! I can fill my C++ code with statefull functors and lazy evaluation. The enemy shall not pass. No one will ever be able to debug it. Instant
by throwaway7548 12y ago
Hey! This is great! I can fill my C++ code with statefull functors and lazy evaluation. The enemy shall not pass. No one will ever be able to debug it. Instant job security.
Seriously. I like experiments, but just keep this away from production code.
- throwaway7548 12y agoSorry about being an asshole here, but really. The problem with articles like that, is that a novice developer, with some 5-10 years of experience can pick up an article similar to that one and use such techniques without any need. With disastrous consequences. How do I know it? I've seen it happen. Again and again. Hell, it had happened to myself, years back. An article like that should start with: "unless you really really know what you are doing and are an adult (20+ years of coding) you should probably avoid using techniques like that in the production code."
- reality_czech 12y agoHey, that's not fair. Experts can use them for disastrous consequences as well. This is C++ we're talking about here!
- chetanahuja 12y agoHah... "novice... with some 5-10 years of experience". Actually you're not too off the mark. And in any case, with c++11, pretty much everyone who's not been following the c++0x/c++1x process assiduously, counts as a novice.
- enjoy-your-stay 12y agoI would have to agree with your comment there. Although having over 7 years experience as a c++ programmer, since I'm not using it so much now I haven't managed to keep up so much with the changes in c++11 and feel a bit noviced overnight. Still, move constructors are pretty handy so that's one change I use whenever I can.
- rapala 12y agoI'm pretty sure C++ (and any language for that matter) has more than enough quirky features to obfuscate any piece of code. No need to read this article for that. But if 20 years of experience makes lazy streams seem unfit for production, then someone has spent 10 years burying their head so deep in the sand that their feet are barely showing. Java's iterators, Python's generators, you work with them even in C. And is it not obvious that one needs to really know what they are doing if they are working as a professional developer? The example of the article was simple of course. But solving the problem of printing Pythagorean triples was not the aim of the article. The aim was to show what makes lazy streams tick, to show that they can be implemented in C++ and that an uniform interface can be provided with functor, monoid and monad. Finally, the simple problem was solved with the new tool to show the inversion of control. PS. std::vector is a stateful functor.
- throwaway7548 12y agoDon't get me wrong. I like functional approach. I am developing in functional languages as well as in C/C++. I think these techniques actually do have a place in the production level code. But, the mail point of the post was, that if you write an article like that, it should start from a warning to novices. This point of view is based on the experience of having to deal with fuckups from novice developers, who were trying to use and abuse the language to the full extends of their abilities. Including fuckups of my own. PS. std::vector is a container.
- fauigerzigerk 12y agoIn this case I think 20 years of C++ experience doesn't help much. At least it doesn't help me. This is a challenge for procedural programmers to really think through what functional primitives are all about by implementing them in a procedural language. It's not the usual template metaprogramming brain teaser.
- throwaway7548 12y agoI very much agree. I should have stated more clearly that "20 years of coding" requirement in my post should include software (and hardware development) in a variety of languages, including functional languages. Or even domain specific languages like SQL, Matlab or VHDL/Verilog.
- jeremiep 12y agoYears of experience is also hard to define. It's as precise a metric as lines of code are. I've seen people saying 10 years of experience when they're closer to have 10 times one year of experience since they continuously do the same thing over and over. I've also seen people with barely a year or two of experience already coding circles around people with 10+ years.
- deleted 12y ago[deleted]
- thinkpad20 12y ago> The enemy shall not pass. No one will ever be able to debug it. Instant job security. Isn't that just C++ in general?