Best libraries for a Boost workshop
Hi, I'm going to be teaching a four hours workshop about getting started with Boost, and I'm wondering which libraries would be the most representative and interesting to show. I was thinking about doing a quick review of the boost libraries that were accepted for the C++ Technical Report 1, quickly saying what each is about, and showing one example. That would be the first part of the workshop. For the second part, I'm making a selection of the most interesting libraries. I'd thoroughly explain each of them, showing several examples and maybe giving some time for the students to fiddle with their computers and the libraries. And here's where I need your help. So far, the libraries I'm sure I'm going to teach are: smart pointers, lexical_cast, bind and function, ref, hash and unordered containers. I'd also add strings algorithms, maybe regex and/or tokenizer. I'm not sure about «program options». Anyway, what's your advice? What are the 12~15 boost libraries you find essential? Thanks in advance. -- José Tomás Tocino García
[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
Hi, I'm going to be teaching a four hours workshop about getting started with Boost, and I'm wondering which libraries would be the most representative and interesting to show.
I would strongly recommend you cover Boost.Test. You could lead them through the Prime Factors Kata as I do in this series of posts: http://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-te... http://legalizeadulthood.wordpress.com/2009/07/05/c-unit-tests-with-boost-te... http://legalizeadulthood.wordpress.com/2009/07/05/c-unit-tests-with-boost-te... For whatever reason, C++ code is often the code base most lacking in unit tests. I think its really important to make sure that C++ programmers know how to write basic unit tests. -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/ Legalize Adulthood! http://legalizeadulthood.wordpress.com
José Tomás Tocino García wrote:
So far, the libraries I'm sure I'm going to teach are: smart pointers, lexical_cast, bind and function, ref, hash and unordered containers. I'd also add strings algorithms, maybe regex and/or tokenizer. I'm not sure about «program options».
You've covered my top choices in the above. But you might consider presenting Phoenix with/instead of bind. The creation of lazy functors is hugely useful -- my code is full of bind() calls -- and the use of operator overloading in lambda and Phoenix is mind-blowingly cool when you first encounter it. For "interesting," consider also Spirit Qi. The ability to write a parser in (a close approximation of) BNF inline in your C++ source definitely stretched my sense of what's possible with the language.
2010/6/22 Nat Goodspeed
For "interesting," consider also Spirit Qi. The ability to write a parser in (a close approximation of) BNF inline in your C++ source definitely stretched my sense of what's possible with the language.
I think that's a good idea. Most students are completely fed up with flex & bison, so such an alternative to write parsers would be really appreciated. -- José Tomás Tocino García
On Tuesday, June 22, 2010 3:42 PM, José Tomás Tocino García wrote:
Hi, I'm going to be teaching a four hours workshop about getting started with Boost, and I'm wondering which libraries would be the most representative and interesting to show.
My top pick would have to be multi-index. It's just so _useful_ once you wrap your brain around it. Another good one to mention is numeric_cast. It shouldn't need much time as it's really simple, but its error checking has actually helped me catch some really embarrassing errors that would have been nearly impossible to find otherwise.
I'd put a vote in for Boost::any. Another very simple, incredibly useful library. Serialization would be good too, but it might be a bit big for an intro course. Depends how exprienced your audience is. Damien On 22/06/2010 3:02 PM, Andrew Holden wrote:
On Tuesday, June 22, 2010 3:42 PM, José Tomás Tocino García wrote:
Hi, I'm going to be teaching a four hours workshop about getting started with Boost, and I'm wondering which libraries would be the most representative and interesting to show.
My top pick would have to be multi-index. It's just so _useful_ once you wrap your brain around it.
Another good one to mention is numeric_cast. It shouldn't need much time as it's really simple, but its error checking has actually helped me catch some really embarrassing errors that would have been nearly impossible to find otherwise. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If I was being introduced to boost for the first time, I would
appreciated seeing the following topics presented:
shared_ptr and other smart pointers
tuples
bind and lambda (just a little subset of what is possible)
enable_if (and overview of SFINAE)
function
multi_index (some simple subset of it)
variant and any (and their differences)
ref (with a couple of examples where it is useful)
type_traits (just so to show that something like this exists)
possibly a little bit of regex
possibly a little of threads
I think that these form a basis for other libraries, and once they
understand them, they would be able to go and explore other boost
libraries on their own.
Good luck.
On Tue, Jun 22, 2010 at 5:23 PM, Bronek Kozicki
On 22/06/2010 20:41, José Tomás Tocino García wrote:
So far, the libraries I'm sure I'm going to teach are: smart pointers, lexical_cast, bind and function, ref, hash and unordered containers.
program options are quite useful, I would also add optional.
B. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I would definitely like to see threads mentioned. Portable multithreading is just so hard to come by these days :( Bind and the cool-ness of its currying might not be appreciated nearly as much by some. Have those attending dabbled in functional programming, or is it all "OOP or bust!" ? And shared_ptr is really useful, but it seems more fit for a C++0x workshop... On 06/22/10 17:50, Mike P wrote:
If I was being introduced to boost for the first time, I would appreciated seeing the following topics presented:
shared_ptr and other smart pointers tuples bind and lambda (just a little subset of what is possible) enable_if (and overview of SFINAE) function multi_index (some simple subset of it) variant and any (and their differences) ref (with a couple of examples where it is useful) type_traits (just so to show that something like this exists)
possibly a little bit of regex possibly a little of threads
I think that these form a basis for other libraries, and once they understand them, they would be able to go and explore other boost libraries on their own.
Good luck.
On Tue, Jun 22, 2010 at 5:23 PM, Bronek Kozicki
wrote: On 22/06/2010 20:41, José Tomás Tocino García wrote:
So far, the libraries I'm sure I'm going to teach are: smart pointers, lexical_cast, bind and function, ref, hash and unordered containers.
program options are quite useful, I would also add optional.
B. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Regards, -Clark
shared_ptr and other smart pointers tuples bind and lambda (just a little subset of what is possible) enable_if (and overview of SFINAE) function multi_index (some simple subset of it) variant and any (and their differences) ref (with a couple of examples where it is useful) type_traits (just so to show that something like this exists)
possibly a little bit of regex possibly a little of threads
Really nice list, thank you. About boost::ref, I'm struggling to find an example that isn't related to boost::bind. Any suggestion? Thanks. -- José Tomás Tocino García
On Tuesday, June 22, 2010 6:19 PM José Tomás Tocino García wrote:
Really nice list, thank you. About boost::ref, I'm struggling to find an example that isn't related to boost::bind. Any suggestion?
I recently needed it with boost::make_shared when my object's constructor took a parameter by reference.
Really nice list, thank you. About boost::ref, I'm struggling to find an example that isn't related to boost::bind. Any suggestion?
That's one of those things in the back of the toolbox that you're glad you have when you need it. Don't waste a huge amount of time trying to explain what it might do, as it will be "the answer" once they come across the need for it on their own. Just say that several such "good to have" tools are available. --John TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
On Tue, Jun 22, 2010 at 10:50 PM, Mike P
If I was being introduced to boost for the first time, I would appreciated seeing the following topics presented:
shared_ptr and other smart pointers tuples bind and lambda (just a little subset of what is possible) enable_if (and overview of SFINAE) function multi_index (some simple subset of it) variant and any (and their differences) ref (with a couple of examples where it is useful) type_traits (just so to show that something like this exists)
possibly a little bit of regex possibly a little of threads
That's a very good list, and pretty much the selection I'd make too. All of those mentioned here are the 'utility' libraries of Boost, which is the Boost I make most use of, but I guess there are also more application specific libraries like Asio. There's also the very small, but essential, things like Boost::swap, noncopyable, etc., which have the benefit of being able to be covered quickly. The new Range library might also be worth some attention, as much as anything for its ability to leverage a higher level of abstraction of ranges. - Rob.
Robert Jones wrote:
The new Range library might also be worth some attention, as much as anything for its ability to leverage a higher level of abstraction of ranges.
Excellent suggestion! I should have mentioned Range myself. I consider that abstraction far more intuitive and facile than the loose pairs of iterators favored by classic STL. While we're at it, Boost.Assign eliminates yet another small but common "you can't do that in C++" irritation.
I would throw in filesystem, date_time, asio, thread and other cross-platform features of boost
I was thinking about doing a quick review of the boost libraries that were accepted for the C++ Technical Report 1, quickly saying what each is about, and showing one example. That would be the first part of the workshop.
Look at the ones nominated for TR2, or otherwise influential in Standards development, or emulations of new C++ standards: Threads, asio, filesystem, Any, lexical conversions. --John TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
José Tomás Tocino García wrote:
Anyway, what's your advice? What are the 12~15 boost libraries you find essential?
I think meta-programming is quite important and emblematic of Boost, and Boost has a lot of it (MPL, Fusion, enable_if, type_traits, to some point Proto). Note type traits are part of TR1 as well. It might be, however, that this is too advanced for an introduction to Boost libraries.
participants (12)
-
Andrew Holden
-
Bronek Kozicki
-
Clark Gaebel
-
Damien
-
John Dlugosz
-
José Tomás Tocino García
-
legalize+jeeves@mail.xmission.com
-
Mathias Gaunard
-
Mike P
-
Nat Goodspeed
-
Reynolds, John
-
Robert Jones