Damon Payne: Hand waving software architect

103db signal to noise ratio at < .03% total harmonic distortion
Solution Architect, software developer, geek
Damon Payne at Blogged
2009 Microsoft MVP - Client App Dev
2007 Microsoft MVP - Solution Architecture
 Wednesday, July 02, 2008

http://arstechnica.com/news.ars/post/20080702-intel-an-expensive-many-core-future-is-ahead-of-us.html

Expensive for who?  For software developers of course.  It seems to me that the silicon industry is trying very hard to obscure a basic fact: even if new technologies such as Software Transactional Memory become common, even if you give us 100 cores to play with, even if things like the Parallel Extensions from Microsoft are elegant and easy to use, even if Intel's compiler research turns out to be a huge help,  not all problems can benefit from parallelism.  In many cases, programmers can go against what would today be considered good practices and make copies of huge shared data structures, (at least we're not being told that we're never going to have more than 4GB of memory) in order to reduce data sharing between threads.  However, there are many problems that need shared read-write data.  Throwing massive numbers of cores at these problems will result in performance slower than single-core performance as resources are eaten up acquiring locks.  On the Windows platform, all of our GUI technologies still use a "compartment" model whereby objects are owned by a single very special thread and we are not alowed to touch them except by marshaling onto this Special message pump.  What good are these 100 core systems going to do my WPF applications? 



Wednesday, July 02, 2008 12:28:46 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Saturday, June 28, 2008


Saturday, June 28, 2008 9:19:46 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, June 26, 2008

Anyone who's read this blog long enough to see some of the larger articles can tell that I am carrying the torch for UML.  I know a lot of people who model things, but not a lot who use what I consider to be the canonical real-deal modeling language: UML.  Even when I'm whitboarding, I'm drawing actual UML constructs for classes, interfaces, packages, and components.  If you draw boxes with lines connecting them to other boxes, people will often get the idea you are trying to convey, but there's something compelling about an industry standard modeling dialect with the ability to express some more subtle semantics than "this thing somethings with this thing".  Why don't we hear that much about UML in the blogosphere?  Why is Microsoft developing its own modeling language?  To some degree I blame the round-trip engineering folks who want to keep code and models in perfect sync, and there are some idioms in CLR languages that just don't succinctly map to UML: The Terski brought up the example of delegats.  My response is and has always been that I'm not interested in modeling at the implementation level: that's what code is for.

I still keep tabs on the DSL tools team at MSFT, so it was nice to hear from Steve Cook that UML tools are going to find their way into Architecture Edition.

http://blogs.msdn.com/stevecook/archive/2008/06/25/i-ve-got-a-new-job-working-on-dsls-and-uml.aspx



Thursday, June 26, 2008 9:42:13 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, June 25, 2008

So, I am building a Silverlight 2 application related to my trip to Klipsch in Indianapolis this year, and found what seems to be to be a terrible bug in Silverlight 2 beta 2.  Multiple UIElements  cannot share event handlers.  What do I mean?  In my case, I have varous Paths inside a canvas and I'm creating hotspots.  When the mouse enters a given region, something slightly different will happen, however the exact same method is called for every single region when the mouse exits that Path.  So, suppose I have a Path called Damon, which happens to have some Damon-y things inside it and I'm going to display my name:

private void _damonPayne_MouseEnter(object sender, MouseEventArgs e)

{

AddCallout("D.R. Payne", "damonrpayne", "Hartford, WI", e);

}

When the mouse exists, I simply remove the UIElement representing the callout, which is the same for all regions on the page:

private void _damonPayne_MouseLeave(object sender, MouseEventArgs e)

{

RemoveOldCallout();

}

Now, it would seem that I could make the functionality in RemoveOldCallout a MouseEventHandler and share the same method among the various paths:

protected void RemoveOldCallout(object sender, MouseEventArgs e)

{

RemoveOldCallout();

}

Now, if I have another Path, I should be able to write code like _someOtherPath.MouseLeave += new MouseEventHandler(RemoveOldCallout);  This code, however, bombs with the following BadPropertyValue error:

 

Now, I have to write a different MouseLeave event for every single path on my page, and there's a lot of them.  I'll submit to Connect and hope this issue is fixed!



Wednesday, June 25, 2008 11:54:43 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback

I went to a Geek Dinner last night at Botanas restaurant in Milwaukee.  This was different than the Nerd Dinners that we used to have.  The Nerd Dinners boiled down to people from the User Group socializing in a more free-form fashion than is practical before/after user group presentations.  The Geek Dinner we did last night was different.  The goal here was to bring together technologists, business people/entrepenuers, and people looking to invest/veture capitalists.  The result was a very cool time, for me at least.  There were several "idea" people there with something they were trying to accomplish.  It was fun (and I hope useful for them) to bring up potential pitfalls in the ventures they are trying; I believe I may now be a tech advisor for some neat things going on in Milwaukee.  I hope this becomes a regular occurance.



Wednesday, June 25, 2008 10:57:32 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Tuesday, June 24, 2008

“The Man creates - the parasite says ‘Where’s my share?’ ” - Bioshock

In cities all over America, state and local governments are continually demanding that working, home-owning citizens shoulder an ever increasing tax burden.  These taxes come in the form of state income taxes, gasoline taxes, sales taxes, and more.  No single burden is as heavy as the property taxes levied on home owners.  These taxes are ostensibly to provide services such as waste removal, public schools, and the like.  Beneath the seemingly benign veneer of Public Service is a rotten core of income redistribution, rights violation, and political pull for sale.  The offenses are particularly grievous in the theory and practice of Not for Profit Organizations (NPOs) in America.

NPOs are able to apply for tax exempt status, which tends to be universal in nature once granted.  Revenues generated in excess of operating expenses are not taxed, sales tax is not paid, and property tax on land and buildings owned by the entity is not collected.  Given the relatively large amounts of money, we will focus on property taxes here.

The first problem with this arrangement is that there is no solid rational or moral foundation for giving favorable tax status to one type of organization over another.  The fact that many NPOs operate charitable ventures as their primary activity does not change this.  The activities undertaken by an organization are the concern of the business, their clients, and owners as long as the business is not breaking any laws or violating anyone’s individual rights.  It cannot be rationally supported that it is “in the public interest” to redistribute income from for-profit businesses to NPOs so that they can run public-funded charities.  As Ayn Rand stated in The Virtue of Selfishness:

…there is no such entity as “the public,” since the public is merely a number of individuals, any claimed or implied conflict of “the public interest” with private interests means that the interests of some men are to be sacrificed to the interests and wishes of others.

The income redistribution happening in favor of NPOs is obvious.  No taxes of any kind are paid, and yet taxpayer funded services are still consumed by these entities.  Consider the example of a church in a small town.  Does the garbage still get picked up?  Will the fire department show up if the church is on fire?  Do the police answer 911 calls from the church?  Is there running water?  Is waste water treated?  All of these things are funded by property taxes and various extra fees on service bills presented to normal citizens who lack the political pull and legal knowhow to create a special status for themselves.  If a small city of 10,000 people containing various private residences as well as churches spends $100,000 per year on waste pickup services, the citizens who pay taxes are directly paying for the NPOs.  Citizens who belong to the churches likely don’t mind, but what about everyone else?  In the same example town, should the hindu(1)  family really be subsidizing the services consumed by the evangelical christian (1) church?  Should the atheist family be subsidizing either?  Of course not, except for the threat of force, no one would choose to pay.

In a true free market society, one would be able to opt out of any service provided by the government and also no pay for it, or ideally these services (fire, waste, etc.) would be provided by competing private enterprises who had to convince me to use their service with a solid value proposition. This is not the case in any municipality I know of, and it gets worse. As in every case where the government tampers with the market and takes away freedoms, there are unintended side effects that distort the original intention of the laws that had no moral foundation to begin with. Wealthy retirees in Milwaukee with legal and financial pull are forming communities within the city (2) in order to avoid property taxes.  If a resident having a heart attack calls 911, the costs associated for this necessary and life saving service will be passed on in the form of ever-increasing property tax burdens.  Because the tax exempt status is near universal and practically unconditional, it is not restricted to the core aims of the organization.  In the same example town of 10,000 and countless other municipalities across America, religious organizations are using excess donations to purchase large tracts of land for speculation.  A private citizen doing so would be saddled with a hefty property tax bill, thereby forcing them to carefully consider the risk and reward possibly by buying land.  The market is therefore severely distorted because the rules are not the same for all participants.  It is impossible for this situation to continue, as Ayn Rand put it:

In any compromise between food and poison, it is only death that can win. In any compromise between good and evil, it is only evil that can profit.

In the ever-escalating practice of making a smaller group of people support the lives of others, only evil can win and the process cannot go on forever.  Eventually, those who produce and pay will either opt-out of participating in this civilization or die as they are unable to sustain their own lives.  Where will the parasites get their free lunch then?  In the mean time, the happiness, goals, and values of some people are sacrificed to further the happiness, goals, and values of others.  This is a morally bankrupt practice and indefensible state of affairs.

The example town of 10,000 is in fact where I live and not a theoretical example at all.  In 2008 the property taxes for a 2,500 square foot home in this country town 35 miles from Milwaukee will work out to be around $600 per month.  There are no services to opt out of and no special status that most citizens could qualify for – the sacrificers must outnumber and out produce those collecting the sacrifices as a simple matter of mathematics.  The picture for retirement is particularly bleak and puts modern American life into perspective: a retiree could responsibly save for retirement over the course of their career, pay off their home mortgage, and still be forced to pay $600/month in today’s dollars for the privilege of having property that is already rightfully theirs.  Of course, the value of their home will adjust upwards for inflation every year, the actual tax rate can go up any time for any reason, and their hard earned savings can be eroded by the fiat currency policies of the Federal Reserve at any time by any amount.

One cannot help but feel that in America in the 21st century, one does not actually own property, but rather one can lease it from the government for a non-negotiable and never ending extortion amount.

The root cause of these issues is the government’s ability to tax any group for any reason and for any amount.  Besides expanding government power far beyond protecting individual rights it creates an environment where some citizens gain a protected and elevated status and all other citizens are the losers who must pay the price for the lifestyles of others.  Citizens are free to use their time and money to support any cause they favor, in other words to work to gain and keep that which they value.  Waste removal services are free to give away services to a charitable institution favored by the ownership, and even though religious claims are not rationally supportable one must support the right of private citizens to donate to these institutions if they choose to do so.

Organizations with ideas that have merit will be able to succeed on their own, and those that do not will rightfully fail.  Stop using government force to make citizens subsidize protected organizations.

 

Footnotes

(1)    A note on grammar:  I have decided to refuse to capitalize names of religious bodies, etc.  Such habits only serve to reinforce the notion that religions are somehow special entities deserving elevated status and beyond rational criticism.  I do not share this opinion.

(2)    Please see this Milwaukee Magazine article for information on these communities: http://www.milwaukeemagazine.com/currentIssue/full_feature_story.asp?NewMessageID=11063



Tuesday, June 24, 2008 2:58:59 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Monday, June 23, 2008

Dan has an article showing some nice syntactical sugar for spawning threads.  Dan has been studying the model of CCR, currently part of Robotics Studio.  The article specifically mentions the Compact Framework, but if you are doing full-framework development I would encourage you to check out the Parallel Extensions library as well.  It was mentioned at TechEd that the CCR might be refactored to use the TPL, so it'd be worth taking a peak at.  Using System.Threading.Tasks you could write code that starts to look less like the traditional ThreadStart code and more like what Dan is doing.  Without spending more than 30 seconds on this idea:

TaskCreationOptions tco = TaskCreationOptions.Detached;

TaskManagerPolicy tmp =

new TaskManagerPolicy(1, Environment.ProcessorCount,1,0, System.Threading.ThreadPriority.AboveNormal);

TaskManager tm = new TaskManager(tmp);

Task t = Task.Create(

(a) => { Console.WriteLine("doing some work"); },

tm, tco);

If we start to see some multi-core mobile processors, it might be an interesting excercise to port a subset of PFX to the Compact Framework.



Monday, June 23, 2008 12:05:23 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, June 18, 2008

It looks like blogged.com has labled me "great".  I'll take it!

Damon Payne at Blogged



Wednesday, June 18, 2008 10:45:26 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, June 12, 2008

While looking on Reggie's blog for news on MySQL support for the Entity Framework, I enjoyed reading this article.  I continue to be amazed at the performance of the CLR.  Some people are absolutely baffled that managed code could be faster than native code, and the low-level reasons why have been blogged by people far smarter than I in the past.  Since someone just asked, A couple of the better-known reasons:

1) The managed heap rules:  If I say "object* foo = new object();" in C++, the OS looks around to find some memory it can give me.  CLR programs use a managed heap, however.  Despite the fact that calling "new()" is always expensive, the managed heap gives a huge advantage.  Instead of searching for free memory, the next chunk on the managed heap is returned immediately.  C developers writing games have used similar tricks for years, using malloc to get a big chunk of memory and managing bits of it themselves as needed.

2) JIT rules: C# is always JITified before execution.  JIT compiling turns your C# into machine code.  So what, you say, my C/C++ code is pre-compiled for the platform and doesn't pay the JIT penalty on application startup.  The advantage of the JIT is that it can be compiled each time the program is ran, and potentially take advantage of different situations and things specific not just to a processor architecture, but on each individual machine.  (I need to find a link to cite this appropriately) 

Anyway, read the article on Reggie's site, and thank him for the work he's doing.  Hey Reggie, when is that preview of Connector 5.3 come out?

.NET | C++ | O/R Mapping


Thursday, June 12, 2008 12:20:58 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |  Trackback