<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5413914568802340215</id><updated>2011-07-30T21:06:18.140-07:00</updated><category term='C++'/><category term='Threading'/><category term='TBB'/><category term='Threading-Building Blocks'/><category term='ATL'/><category term='Multi-Core'/><category term='COM sucks'/><category term='Open source'/><category term='Microsoft'/><category term='Tasks'/><category term='STL'/><category term='COM'/><category term='Intel'/><category term='Processes'/><category term='OpenMP'/><title type='text'>The C++ Purist</title><subtitle type='html'>The blog of a C++ purist who strives to do things the right way.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-4835012060705031341</id><published>2009-11-15T20:30:00.001-08:00</published><updated>2009-11-15T20:30:58.918-08:00</updated><title type='text'>New Site</title><content type='html'>My new site can be found here: &lt;a href="http://www.softwarepurist.com"/&gt;http://www.softwarepurist.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All new blog posts will be at this location.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-4835012060705031341?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/4835012060705031341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=4835012060705031341' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/4835012060705031341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/4835012060705031341'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2009/11/new-site.html' title='New Site'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-2426202945593916808</id><published>2009-11-10T11:40:00.000-08:00</published><updated>2009-11-10T11:44:01.667-08:00</updated><title type='text'>Software Testing Follow-Up</title><content type='html'>As a follow-up to some of the software testing types I posted in an earlier blog, I came across this, which is a great description of various different types of software testing:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bugsniffer.blogspot.com/2007/11/software-testing-types.html"&gt;http://bugsniffer.blogspot.com/2007/11/software-testing-types.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-2426202945593916808?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/2426202945593916808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=2426202945593916808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/2426202945593916808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/2426202945593916808'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2009/11/software-testing-follow-up.html' title='Software Testing Follow-Up'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-4057575253842481838</id><published>2009-11-01T17:14:00.000-08:00</published><updated>2009-11-01T17:32:38.666-08:00</updated><title type='text'>Timers During Daylight Savings Time</title><content type='html'>With Daylight Savings Time just passing early this morning, it occurred me that timers could have a subtle bug.  This occurred to me today because I was running some overnight tests last night.  While the tests exhibited no issues with the extra hour, I can foresee scenarios where it could have.&lt;br /&gt;&lt;br /&gt;For instance, let's say you have a C++ class that looks something like this (Pseudo-code):&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;class Timer : public Thread&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;    virtual void run()&lt;br /&gt;    {&lt;br /&gt;           while (running)&lt;br /&gt;           {&lt;br /&gt;                get current time&lt;br /&gt;                while (current time &amp;lt; time value at top of timer queue)&lt;br /&gt;                {&lt;br /&gt;                      pop&lt;br /&gt;                      notify timer listener&lt;br /&gt;                }&lt;br /&gt;                wait for top of timer queue to expire&lt;br /&gt;           }&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code is relatively flawless, except, what if the current time drops back an hour?  This can occur, depending on how you retrieve your time.  Now, in the worst case, all of the timers in your system won't trigger for an extra hour.  This basically means your code is mostly nonfunctional for an hour after Daylight Savings Time occurs.  In an application, you can just restart the application and the problem vanishes.  On server code, this can be a bigger issue at this peculiar time.&lt;br /&gt;&lt;br /&gt;Here's one solution I thought of to correct this potential problem:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;class Timer : public Thread&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;    virtual void run()&lt;br /&gt;    {&lt;br /&gt;           while (running)&lt;br /&gt;           {&lt;br /&gt;                get current time&lt;br /&gt;                if (current time &amp;lt; last known time)&lt;br /&gt;                {&lt;br /&gt;                       create temporary queue&lt;br /&gt;                       pop each element of queue, subtract difference, push to new queue&lt;br /&gt;                       pop each element off temporary queue, push back to original queue&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                while (current time &amp;lt; time value at top of timer queue)&lt;br /&gt;                {&lt;br /&gt;                      pop&lt;br /&gt;                      notify timer listener&lt;br /&gt;                 }&lt;br /&gt;                set last known time equal to current time&lt;br /&gt;                wait for top of timer queue to expire&lt;br /&gt;            }&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you do this, you basically have this level of correction code to handle this peculiar scenario.  The solution is that every timer is adjusted to handle the problem. Of course, this isn't a perfect solution, but it's one way I can think to mitigate the issue.  I may write a test later to see if this solution is good enough or if there are better ones.  I suspect many well-known timer libraries handle this already, but in C++, you can sometimes justify rolling your own depending on your needs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-4057575253842481838?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/4057575253842481838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=4057575253842481838' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/4057575253842481838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/4057575253842481838'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2009/11/timers-during-daylight-savings-time.html' title='Timers During Daylight Savings Time'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-1189352418082245313</id><published>2009-11-01T08:34:00.000-08:00</published><updated>2009-11-01T10:11:46.845-08:00</updated><title type='text'>Software Testing</title><content type='html'>So, it's been a long while since I've made a blog post.  I decided to revive the blog this weekend.  I was thinking a good topic would be to talk about a few different types of tests a software developer can do and what each provide.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Unit Tests&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The purpose of unit tests is to test the functionality of a generally lower-level software module.  External dependencies are stubbed out and mocked, so that you can test components in isolation.  Checks are very granular and the test will generally give a pass/fail result, which makes it easily automatable.  In my experience, there is often some confusion as to what a unit test can and cannot do well.  For example, you might write a unit test that tests a class called String.  It might find that you have two issues with this class that you fix.  However, this won't necessarily have a noticeable effect on your product.  Unit tests are to make the developer's life easier, because they take really difficult-to-fix bugs that wouldn't be found until later stages and make them into generally easy-to-fix bugs at earlier stages.  This flows in with a process known as risk mitigation.&lt;br /&gt;&lt;br /&gt;However, they don't necessarily make the development cycle take less time.  When unit testing is done elaborately, including using a process like Test-Driven Development and automating these tests when making a build, they can be extremely beneficial.  But, where time may be saved is often the deployment and QA teams, not necessarily the developers.  Companies have to be willing to pay the extra cost for these tests in the name of higher quality, a smoother process, and to ease refactoring.  Finally, unit tests are typically terrible at testing any non-deterministic process, especially when threads are involved.  It is also generally difficult to test GUI functionality.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Integration Tests&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;I find these generally less useful, because this is the middle ground, as has enough overlap with unit tests and broader tests that they sometimes can be excluded.  Still, in some scenarios they are quite useful.  Just like in unit tests, integration tests tend to be automated, but this is not always the case.  Where integration tests differ is that you generally don't stub out interfaces, unless it's an interface that is totally superfluous to the test or would prevent the test from running in an automated way.  An example of a integration test is it might run the core engine of your application along with another component of the application, such as a logic module.  The integration test would start by running a database query to reset the database to a known state, send login requests for 100 users, and verify that the 100 users logged in.  It would then check the database and make sure the 100 records were properly set into the database.  Then it would clean up the database.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load Testing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I find that these are the tests I write towards the end of the cycle.  You generally can get away without these if you're making a standalone application, but it is essential for a server application that expects a high user load.  The load testing script, often written in a language simpler than your application, such as Python, will simply simulate a bunch of users repeatedly trying to simulate a variety of scenarios during the test.  They often all try to simulate the same scenario, but sometimes they try to stimulate different areas of the system at the same time.  Verification at this stage is generally minimal, because in most situations, the users can interfere with each other, creating false failures.  What you are trying to verify here is longevity test to prove that the server can withstand a constant barrage for n hours with m users.  Failure on this test will often be discovered manually when you come in to check it the next morning, and will be something of the nature of a crash, deadlock, excessive memory growth, performance degredation, etc... Smaller issues, such as 1 out of 1000 users not having their record stored in the database are unlikely to be discovered.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;While this isn't all of the types of tests a developer will use, I find these to be the most frequent in my travels.  One thing to keep in mind is setting expectations at the appropriate level.  Developer-level tests are extremely valuable in making the developer's life easier and making life easier for your coworkers.   The thing I want to keep emphasizing is that they don't necessarily save time and money, though.   I give this caution, even though I'm a huge fan of software-level testing.  You write tests for quality, period.  Some hidden benefits are that they also provide additional "documentation", example usage and generally make refactoring easier, because if you have to fit your code into a test, it's more difficult to take shortcuts.&lt;br /&gt;&lt;br /&gt;Overall, I have worked at both companies where quality was held highly and others where it wasn't the most important factor in the success of a product.  You have to decide for yourself what's most appropriate for what you're doing.  One thing that's important is setting expectations correctly.  Sometimes management will think that if you write a test, the software will be bug-free.  There isn't a single piece of non-trivial software that is bug-free, anywhere in the world.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-1189352418082245313?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/1189352418082245313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=1189352418082245313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/1189352418082245313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/1189352418082245313'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2009/11/software-testing.html' title='Software Testing'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-7938530950332953686</id><published>2008-07-11T05:43:00.000-07:00</published><updated>2009-11-24T21:40:05.317-08:00</updated><title type='text'>Ada-like Range Validations</title><content type='html'>This post has been migrated to my new blog.  Check it out here: &lt;a href="http://www.softwarepurist.com/blog/index.php/ada-like-range-validations/"&gt;Ada-Like Range Validations&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-7938530950332953686?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/7938530950332953686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=7938530950332953686' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/7938530950332953686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/7938530950332953686'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2008/07/ada-like-range-validations.html' title='Ada-like Range Validations'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-3855387356777699773</id><published>2008-02-11T23:36:00.001-08:00</published><updated>2008-02-11T23:57:17.358-08:00</updated><title type='text'>What Is Up With Google Search?</title><content type='html'>I am getting seriously annoyed with Google search.  When I first made this blog, for the first few weeks I varied between #1, #3 and #5 in Google's search if I searched for a term such as "C++ purist".  Then, for no obvious reason, I completely dropped off the search.  This includes if I googled the exact URL on this site.  Nothing.  That lasted for weeks upon weeks.  Then, my blog miraculously returned and was consistently #3 or #5 in search.  Now, when I check this week, it is again gone from search completely, and search terms which can make it arise seem random.  For example, "The C++ Purist" only has three hits, none of them mine.  However, ["The C++ Purist" Rydinare] (minus the []) will bring my blog up directly.&lt;br /&gt;&lt;br /&gt;I can't tell if this is a serious flaw in Google's search algorithm or this is simply Google having some very obscure rules about search.  Nonetheless, it's clear to me that a search for "C++ purist" and a search for "The C++ Purist" should have me in the list.&lt;br /&gt;&lt;br /&gt;Anyway, for your entertainment, here's a few other interesting links I came across when searching for "C++ purist":&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cboard.cprogramming.com/archive/index.php/t-81345.html"&gt;"I think moderation is a necessity also for those trying to protect it.It's basically this that I'm advocating actually. The hatred of C++/CLI comes from religious ferver of the C++ purist. Not to mention inborn hatred of microsoft"&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ists.pwr.wroc.pl/%7Ekrzysiek/mfc.htm"&gt;"Any C++ purist who looks at a message map has an immediate question: Why didn't Microsoft use virtual functions instead? Virtual functions are the standard C++ way to handle what mesage maps are doing in MFC, so the use of rather bizarre macros like DECLARE_MESSAGE_MAP and BEGIN_MESSAGE_MAP seems like a hack."&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lists.qgis.org/pipermail/qgis-developer/2006-March/000015.html"&gt;&lt;br /&gt;"&gt;&gt;OK, in this case it's more a matter of taste.&lt;br /&gt;&gt;&gt;Simply, I'd choose Boost as I'm STL/C++ purist.&lt;br /&gt;&gt;&gt;&lt;br /&gt;&gt;&gt;But I don't agree that Boost would make code inconsistent.&lt;br /&gt;&gt;&gt;If you think so, why don't you replace all STL's containers&lt;br /&gt;&gt;&gt;with QVector and QList?"&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.circlemud.org/%7Ejelson/560/1998-august/day2/tsld004.htm"&gt;"This is a good example of where a C++ purist will always use &lt;&lt;&gt;&gt;, but a pragmatist will just use printf()"&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hmm, interesting how the term "C++ purist" is thrown around.  As a C++ purist, I agree with the purist views in the links I checked out.  Except for the hatred of Microsoft comment.  Nobody really hates Microsoft, they hate the fact that Microsoft always chooses to go its own way, instead of sharing to the benefit of everyone.  If they shared, they would allow themselves to become the "standard" across the industry, instead of forcing others to come up with a different implementation.  When they make improvements over what's generally out there, they should share, instead of boxing it in Windows.  Furthermore, Microsoft has encouraged a lot of bad programming practices over the years, which were against some of the better judgment of the more "purist" community.  Those are the reasons why purists are disenchanted with Microsoft.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-3855387356777699773?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/3855387356777699773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=3855387356777699773' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/3855387356777699773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/3855387356777699773'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2008/02/what-is-up-with-google-search.html' title='What Is Up With Google Search?'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-3980498202902528856</id><published>2008-01-12T09:46:00.001-08:00</published><updated>2009-11-20T04:20:56.037-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenMP'/><category scheme='http://www.blogger.com/atom/ns#' term='Tasks'/><category scheme='http://www.blogger.com/atom/ns#' term='Multi-Core'/><category scheme='http://www.blogger.com/atom/ns#' term='Open source'/><category scheme='http://www.blogger.com/atom/ns#' term='Threading-Building Blocks'/><category scheme='http://www.blogger.com/atom/ns#' term='TBB'/><category scheme='http://www.blogger.com/atom/ns#' term='Processes'/><category scheme='http://www.blogger.com/atom/ns#' term='Intel'/><title type='text'>OpenMP, Threading-Building Blocks, Others?</title><content type='html'>This post has been migrated to my new blog.  Please check it out here: &lt;a href="http://www.softwarepurist.com/blog/index.php/openmp-threading-building-blocks-others/"&gt;http://www.softwarepurist.com/blog/index.php/openmp-threading-building-blocks-others/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-3980498202902528856?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/3980498202902528856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=3980498202902528856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/3980498202902528856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/3980498202902528856'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2008/01/openmp-threading-building-blocks-others.html' title='OpenMP, Threading-Building Blocks, Others?'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-6362871525984100330</id><published>2007-12-15T19:02:00.000-08:00</published><updated>2007-12-15T19:07:12.832-08:00</updated><title type='text'>Best Practices</title><content type='html'>I do mostly C++ and stick to the portable side. So while you can go to non-portable things like Microsoft APIs or .Net, I avoid those. I'll give a runthrough of my opinion as to things that should be in modern C++ applications of reasonable size.&lt;br /&gt;&lt;br /&gt;When programming C++, there's books by Scott Meyers, Herb Sutter and Andrei Alexandruscu which teach you many of the best practices in the language. As far as I'm concerned, it's no longer acceptable to simply have a working program. You have to make it flexible, code for reusability and use best practices. It does show in aspects of the end product. Use of the Boost library is also very helpful for a C++ program nowadays, as it fills in many of the holes that the standard has not gotten to. Knowledge of good object-oriented techniques as well as good template metaprogramming skills make code much more maintainable when done correctly.&lt;br /&gt;&lt;br /&gt;Gang of Four Design Patterns is still not known by 9 out of 10 developers. That's insane to me. The book has been out over 10 years. Generally the very good programmers make use of design patterns. Head First Design Patterns is great to learn it. I see the Gang of Four book as more of a reference. I consider the grasp patterns just as important. These are described in one of Craig Larman's books.&lt;br /&gt;&lt;br /&gt;Use of UML for modeling and describing behavior. Most developers on my team don't know UML. Another insane thing. UML is a great tool for describing a system and designing it out. Especially sequence diagrams. If there's one thing that should be used more, it's sequence diagrams.&lt;br /&gt;&lt;br /&gt;Test-Driven Development is great for making more flexible code and actually having tests for individual pieces of a system. What I like is in order to write the test you have to decouple things. There's a few books on this which are great.&lt;br /&gt;&lt;br /&gt;Refactoring techniques are another area not understood by many software developers. Moreso you have to understand what you eventually want the code to look like, and I think most developers see mush, see that it works and then are happy. Refactoring techniques and TDD play in very nicely together, because if you have the initial test, you can make "safer" refactorings, and keep running quick tests each time you make changes.&lt;br /&gt;&lt;br /&gt;Separation of GUI and logic has always been a great idea. You never know if someday you might run the GUI separately or want to swap out the GUI entirely and not change other code. That's the basis of all good object-oriented design, minimizing impact to the entire system, localizing impact to specific areas. Finally, as far as separation of logic, separating it further into a scripting engine with external scripts, gives a nice mix of flexibility and speed. You can then write scripts which control specific parts of a system without rewriting the engine and waiting for recompilation all day long. Furthermore, non-developers can write scripts too. Huge advantage to a development team.&lt;br /&gt;&lt;br /&gt;Some of these have been known as good practices for many years. They're even more publicized today as good practices. Why there is so much resistance to known good practices is beyond me. Those are my feelings anyway. There's certainly other good practices that I haven't mentioned here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-6362871525984100330?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/6362871525984100330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=6362871525984100330' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/6362871525984100330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/6362871525984100330'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2007/12/best-practices.html' title='Best Practices'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-7249756705806608584</id><published>2007-12-14T19:22:00.000-08:00</published><updated>2007-12-14T19:52:08.553-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='COM sucks'/><category scheme='http://www.blogger.com/atom/ns#' term='COM'/><category scheme='http://www.blogger.com/atom/ns#' term='ATL'/><category scheme='http://www.blogger.com/atom/ns#' term='STL'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Why COM Is So Dreadful and Outdated</title><content type='html'>I have two coworkers that absolutely love COM.  Let's face facts; COM was designed to solve a specific type of problem and it not capable of solving others.  COM is also very outdated at this point.&lt;br /&gt;&lt;br /&gt;Let's go through the details:&lt;br /&gt;&lt;br /&gt;COM was designed to work around a few things: First that C++ does not have a standard ABI (C does).  The advantage here is that DLLs will be compatible between debug builds, release builds, and builds from different compilers, even different programming languages.  Microsoft developed a whole library of components based on this (we'll can get into how truly bad MS's APis are some other time).&lt;br /&gt;&lt;br /&gt;Now, the negatives:&lt;br /&gt;&lt;br /&gt;1) Registration.  Evil, evil, evil, evil.  You mean to tell me that you can dynamically change the behavior of my app from right under my nose?  This is worse than your regular DLL hell because registration ensures that there is only one "registered" copy per system.  Finally with the advent of registration from COM, MS has realized how bad this "hell" is.  Nonetheless, it absolutely causes havok.  Consider a developer working on multiple builds on the same system.  You can't run both builds at once because of this restriction!  You can't even build one and have one run at the same time because you can have them conflict.  This is an insane requirement.  It is the #1 reason why COM is so terrible.  Remember, global is bad.  Every time you make some global, remember this rule.  Anything that is global is bad.  When you make something global, you're saying it's universally applicable.  Everything is universally applicable until the day we discover that it isn't.  That is the same day that we are screwed.&lt;br /&gt;&lt;br /&gt;2) Hack of the C++ type system; incompatibility with the rest of C++.  This is an unforgiveable requirement of COM.  How can you make something in C++ that is incompatible with the rest of the language?  They hacked their own version of virtual tables, force internal casting all over the place, simulates exception handling, thus preventing actual C++ exception handling, and is incompatible with many features of C++.  Yes, you can use these features internally if they don't leak out of implementation.  Wonderful.  The fact that I can't pass an STL string through a COM interface makes it unsalvageable for C++.  I could live with these restrictions, but only purely on the boundary between language, not within the same language.&lt;br /&gt;&lt;br /&gt;3) Casting hell and cosmic hierarchies.  Barf.  I know at some point, Java, COM, etc... all though that having all classes derive from a single point was a great idea (let's not even get into IDispatch), but it encourages bad programming.  In COM it's directly encouraged.  To cast to/from IDispatch/IUnknown to get around bad design is poor.  It's common practice in COM.  Yet, ideally in object-oriented programming, you make use of design patterns to avoid such cases where casting in necessary.  In COM based programming, people think that they are following good design since there's always a base interface.  Wrong.&lt;br /&gt;&lt;br /&gt;4) Factory abuse.  COM factories are an abomination.  The factory pattern was never meant to be used this way; COM's version isn't the factory pattern.  It's not the abstract factory pattern either.  These patterns were used to make object creation generic, not to hop around the type system and use IDs to check the registry, pick which DLL to load, load it, call a method, get returned an object, do internal casts to make it the type it should be, and then return it.  Abuse.  This is the kind of thing that should get you arrested by the C++ police.&lt;br /&gt;&lt;br /&gt;5) The anti-refactoring.  COM code is excessively difficult to refactor.  This is exacerbated by the never-change-an-interface mantra.  When you release third party SDks, you have to take care in changing interfaces.  Nonetheless, it does happen.  Some changes are breaking; they have to be.  Breaking changes are sometimes required to progress an API.  Otherwise you may be stuck with an underpowered, incomplete API.  That is a poor solution to the risk of breaking code.&lt;br /&gt;&lt;br /&gt;6) The idea that you can bring an app to a new system, run it with a newer COM object and it still works.  A) Wrong.  B) Wrong.  C) Wrong.  This doesn't always happen in practice.  This is a benefit of keeping clean interfaces; COM wasn't required to do this.  However, you NEVER want to toss new code into an existing code without retesting the entire thing.  Thinking you can do this is niave at best, and moreoften, harmful.  What's worse, because the actual changes are more insulted, instead of crashing (which is admittely nasty), you instead get a subtle bug and things appear to work... until they don't.&lt;br /&gt;&lt;br /&gt;6) Difficult to write; difficult to read.  COM objects are excessively difficult to write.  I easily find that the overhead of setting up a COM object in addition to the registration woes is rough.  Furthermore, having to convert my types into COM-friendly types back and forth is extra unnecessary effort.  Writing them is annoying enough.  As a developer, I hate writing COM.  This is second only to how much I hate reading COM code.  Ugly.  What happened to clean modular code?  All of this extra work, marshalling types back and forth, just to pass the COM layer.  All of this extra work to catch every exception possible, to translate it into an error code, only to later translate it back into a _com_error.&lt;br /&gt;&lt;br /&gt;There are so many reasons why COM is bad.  It's just a bad technology.  XPCOM has its own issues, as you can read here: &lt;a href="http://www.bengoodger.com/2006/08/com_in_mozilla.html"&gt;COM in Mozilla&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-7249756705806608584?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/7249756705806608584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=7249756705806608584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/7249756705806608584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/7249756705806608584'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2007/12/why-com-is-so-dreadful-and-outdated.html' title='Why COM Is So Dreadful and Outdated'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5413914568802340215.post-939225563380704703</id><published>2007-12-14T19:15:00.000-08:00</published><updated>2009-10-31T22:28:05.920-07:00</updated><title type='text'>Development Thoughts</title><content type='html'>Hey guys.&lt;br /&gt;&lt;br /&gt;One thing I was thinking about today is that quality of the code is very undervalued in software.  The code has to be maintained by developers on a daily basis.  It can make things more difficult if some developers write code that make it tougher for others to work with.&lt;br /&gt;&lt;br /&gt;My mentality to try to follow a set of established rules, and attempting to create code that is both readable (self-documenting) and modular.  A clear separation of GUI and logic adds more flexibility between those layers.  Writing tests and trying to following a process such as TDD can help turn difficult-to-find issues later into easy-to-fix issues now.  Choosing the best tools for the job and avoiding the "golden hammer", while using known "best practices" I find extremely beneficial.  I try to help things get organized so things that have been hinderances don't continue to be so. I also try to help increase communication as much as possible, share information.&lt;br /&gt;&lt;br /&gt;There's some irony in this, because I've run into some very poorly written code before.  One example off the top of my head is that I ran into this monster function that had 1000 lines of code.  After tracking down the exception that was occurring based on an error log, I was astonished to find out that there were about 998 lines between that try and catch.&lt;br /&gt;&lt;br /&gt;Development has a lot of dynamics; well-written code is a pleasure to work with.  Poorly written code takes twice as long, and management doesn't always understand why since it "worked" before.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5413914568802340215-939225563380704703?l=rydinare.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rydinare.blogspot.com/feeds/939225563380704703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5413914568802340215&amp;postID=939225563380704703' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/939225563380704703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5413914568802340215/posts/default/939225563380704703'/><link rel='alternate' type='text/html' href='http://rydinare.blogspot.com/2007/12/anyone-else-work-on-somewhat.html' title='Development Thoughts'/><author><name>Rydinare</name><uri>http://www.blogger.com/profile/02389004863697792706</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
