Tangible Software

Visual Basic and C# represent two sides of the Microsoft Visual Studio coin. Though they began with very different purposes—Visual Basic as a simpler interface to powerful computers, C# as a powerful replacement for simpler assembly language systems—they now provide nearly equal access to the Microsoft Windows platform and beyond.

Arguments persist about which language is better, but thanks to Tangible Software Solutions’ Instant C# and Instant VB conversion tools, the arguments are mostly irrelevant. Using these tools, you can convert language snippets, ASP.NET pages, or entire projects between the two languages. The resulting code is, in many cases, ready for you to compile and use at once, although you will probably want to pass through the converted source and make adjustments based on each language’s strengths and weaknesses.

Note: Tangible offers Instant C# and Instant VB as two distinct software products. Except for the order of the languages involved, they are basically the same product. I tend to convert content from Visual Basic to C#, and not as much in the other direction, so this review focuses on the Instant C# tool.

The main user interface is nothing to get excited about: one button used to browse for the source project, another for the destination folder, and one that says “Convert.” Tangible tried to gussie things up with lists that display conversion statistics from prior uses of each app. But why worry about the interface when the goal is to spend as little time within the program as possible? The real magic appears in the new .NET project that the tools generate, and you will typically use Visual Studio or your favorite code editor for that.

Despite the muted user interface, that Convert button does wonders. Conversion from input to output is fast. Some of the smaller projects I’ve converted took less than a second. My largest project, a 215,000-line desktop behemoth with 240 forms took just over four minutes. In this mobile-enabled instant society, four minutes seems like an eternity. But here’s what happened during those four minutes: Instant C# wrote a nearly functional 215,000-line C# application. That’s wild!

The resulting code is as decent as the original project: Garbage In, Garbage Out is an issue here, but it’s your issue, not Tangible’s. Consider this Visual Basic code as food for Instant C#.

    Public Class Form1
        Private Sub Button1_Click(sender As System.Object,
                e As System.EventArgs) Handles Button1.Click
            MsgBox(GenerateMessage("Barack", #8/4/1961#))
        End Sub
        Private Function GenerateMessage(ByVal firstName As String,
                ByVal birthDate As Date) As String
            ' ----- Format a nice greeting.
            Dim age As Integer
            age = Today.Year - birthDate.Year
            If (Today.Month < birthDate.Month) Or
                    (Today.Month = birthDate.Month And
                    Today.Day < birthDate.Day) Then
                age -= 1
            End If
            Return "Hello " & firstName & ", you are " &
                age & " years old."
        End Function
    End Class

The conversion generates equivalent, good-looking C# code (some lines rewrapped to fit this article’s display area).

    public partial class Form1
        internal Form1()
        private void Button1_Click(object sender,
            System.EventArgs e)
        private string GenerateMessage(string firstName,
            DateTime birthDate)
            // ----- Format a nice greeting.
            int age = 0;
            age = DateTime.Today.Year - birthDate.Year;
            if ((DateTime.Today.Month < birthDate.Month) |
                (DateTime.Today.Month == birthDate.Month &
                DateTime.Today.Day < birthDate.Day))
                age -= 1;
            return "Hello " + firstName + ", you are " +
                age.ToString() + " years old.";

It looks like C# to me. Granted, there are some interesting changes. All identifiers now include initializers, as with the “age” variable in the sample code. That’s because most initialization is optional in VB, but required in C#, and Instant C# knows this. It also favors explicit conversions, including the addition of the “ToString” method on the “age” variable when concatenating the result, again a reflection of differences between the languages. And don’t worry about the missing “Handles” clause from Button1’s Click event handler. Its match has been moved to the form’s code-behind file, exactly where Visual Studio would place it in a new C# project.

Despite the converters’ language knowledge, not everything comes across in a ready-to-compile state. Each language includes “issues” that don’t translate well to the other. For instance, there is no “On Error Resume Next” construct in C#—no unstructured error handling at all—so that statement shows up in the C# result unmodified other than the addition of an accompanying warning comment. Likewise, C#’s “unsafe” keyword doesn’t do well in the move to VB. Any code in an unsafe block is simply commented out in the new Visual Basic project.

Some aspects of the converted code may introduce subtle differences in how your code manipulates data. For example, Visual Basic’s conversion methods (CInt, CDate, and so on) forgive a multitude of data sins that aren’t even considered in C#’s System.Convert equivalents. Tangible’s tools convert these language components without any warnings on the assumption that you are a good programmer and know better than to let questionable data touch your language’s magic keywords. Still, any conversion, even a manual conversion, is going to be imperfect, and with Instant C# and Instant VB doing at least ninety percent of the work, who’s complaining?

For that final ten percent, you might want to reference the pages of the C#-Visual Basic Bilingual Dictionary, written by your humble reviewer. It provides C# equivalents for every Visual Basic keyword, and vice versa, along with caveats and warnings that you should think through after Tangible’s super software has done its work.

Each Instant… tool includes an options panel that lets you adjust some of the conversion specifics, both for things that impact the output logic and for aesthetic differences. (The options panel from Instant VB appears here.) Each program also converts project files, configuration files, and other supporting elements of your project. It does a good job at leaving things it doesn’t know how to convert untouched. For example, a typical .vbproj file contains configuration items that aren’t useful in the equivalent .csproj file. These XML elements simply come across into the new project file, just in case they are needed later.

Although I started my programming career decades ago in the C world, I’ve focused on Visual Basic for much of the last twenty years. But I find myself moving back to my C-language roots, and Tangible Software Solutions’ Instant C# is a regular part of that migration. I use the tool weekly, not only to convert some legacy code from nearly fifteen years ago, but also to save time when grabbing code snippets off of MSDN and StackOverflow.

Tangible also offers converters that move code between C++ and Java, and between those languages and the C# and VB platforms. If the C# and VB versions are an accurate gauge, then the Java and C++ variations will be fantastic. I’m proud to give the tools Five Crocodiles, my highest rating. To find out more about Tangible Software’s conversion tools and other products, visit their web site, www.tangiblesoftwaresolutions.com.

Five Crocodiles

This article was posted on October 5, 2015. Related articles: Technology, , , .

Leave a Footnote


Over the last month or so, YouTube’s attempt to curate a video experience personalized to my tastes resulted in the latest Hollywood viral videos for The Martian showing up in my and everyone else’s video queues. So when Amazon tempted me with the Andy Weir book on which the movie is based for just $1.99, the cheapskate in me jumped at the deal. Despite being placed in a fictional near future where mankind has already done the legwork to put a team of scientists on Mars, the book is about as close as you can get to a true, modern account of a smart man marooned on a stupid planet.

If you’ve seen the movie previews, then you know the setup: a mission to Mars ends in an abrupt abort due to a violent dust storm, and in the hurry and confusion to leave the planet, one crewman gets left behind. It’s like Home Alone, but with freeze-dried ice cream. The radios are all dead (of course), there’s not enough food or water to last until the next scheduled visit to the planet (naturally), and don’t get me started on the complete lack of emergency escape pods. I kept expecting Kate Winslet to show up and drop a diamond necklace out of an airlock. But the planet has one essential resource that will bring the story to a happy ending: Matt Damon—excuse me, I mean Mark Watney.

Watney is part biologist, part engineer, and full time nerd. Using the resources left at the Mars habitation site (spoiler alert), he is able to generate sufficient dihydrogen monoxide, create a makeshift communications system back to NASA, and deck out a nearby minivan with enough life support to get him to the rendezvous site more than 3,000 kilometers across the barren surface of Malacandra. Just don’t ask me to describe how he obtained the fertilizer needed to grow his own potatoes.

The book is exciting, at least if you are the type of person who enjoys instruction manuals on how to rebuild a carburetor. Consider this gripping section from about the two-thirds point through the book.

The regulator analyzes the air with spectroscopy, then separates the gasses by supercooling them. Different elements turn to liquid at different temperatures. On Earth, supercooling this much air would take ridiculous amounts of energy. But (as I’m acutely aware) this isn’t Earth. Here on Mars, supercooling is done by pumping air to a component outside the Hab. The air quickly cools to the outdoor temperature, which ranges from -150°C to 0°C. When it’s warm, additional refrigeration is used, but cold days can turn air to liquid for free.

Yes, it is that riveting. A big chunk of the text is devoted to minutiae like this. Despite being a fan of science, there were a few moments when I wanted the author to just give the condensed Ikea version of the details and get the story moving. And yet it’s a good read, with reasonable pacing, periodic action and suspense, and an enjoyable narrative voice. For you geeks out there, there’s also the technical accuracy. In a postscript to the book, the author discusses the process he went through to complete the story, which included releasing the book in serial form to a world hungry for Martian castaway stories, and incorporating feedback from real rocket scientists into the final text.

The movie release is still a few weeks away. It will be interesting to see what Hollywood does with it given its nerd-centric storyline. The book has no bloodthirsty aliens or out-of-control robots, no superheroes swooping in to save the day, and nothing approaching romance, other than a few mentions of things that might have been if geeks weren’t involved. Instead of these movie staples, the story has the protagonist moving rocks, building and rebuilding his house, driving for thousands of kilometers without much to do or see, and disco music.

If the book does have a major flaw, it appears in the form of the happy ending. From the very first page, you can tell that everything will turn out all right for Watney. The Martian is that kind of book, that is: American. Or at least modern American. This book is no Uncle Tom’s Cabin or Huckleberry Finn. Although it lauds human ingenuity, it says very little about the human condition. Perhaps that’s why the book is called The Martian instead of The Human. Challenges arise, but with a little elbow grease and some engineering skills, all will be well. It’s an American story because that is what we’ve come to expect. Our superheroes—or in this case, our ordinary heroes—will rescue us.

At some point in our history, our storytelling became one of easy solutions. From the sitcom to the Hollywood-bound novel, the challenges given to us are now those that we already know how to overcome. It’s a storyline devoid of the complexities of life, and one that does little to prepare us for the real world. In The Martian, there are no terrorists, no petty international disputes, no electoral recounts. A big part of the story involves China giving up years of research and billions of dollars to help the United States rescue its abandoned astronaut. I hope that would happen IRL, but experience tells me that some underhanded politics would need to take place to bring about that level of international cooperation. Not that I’m cynical.

Don’t get me wrong; I really enjoyed The Martian. I’m just the type of technically adept literary lightweight that is the book’s target demographic. But it is pure entertainment, to the point where I seriously fear what would happen to the human race if we ever migrated to Mars.

This article was posted on September 15, 2015. Related articles: Other Books, Technology, , .

Leave a Footnote


The recent Supreme Court decision concerning gay marriage came as a surprise to many on both sides of the debate. I myself had forgotten that such a case was still before the high court. But there it was, a five-four edict that brought with it instant societal change. The decision was a troubling one, not because of what it says about marriage or homosexual rights, but because of what it says about the childish, demanding ways of twenty-first century Americans.

Like most societies, America took the one-man, one-woman thing in marriage for granted. Some cultures are fine with polygamy, but until about fifteen years ago, I had not heard of any state-approved same-sex marriages. Yet even if history is on the side of traditional marriage, institutions, whether rightly or wrongly, do change over time. Interracial unions were frowned upon in the early decades of this nation, but demographics show that they are quickly becoming the standard for husbands and wives. That the definition of marriage would change can be shocking, but not completely unexpected. Women can vote, prohibition has come and gone, and cable TV is giving way to online methods of entertainment. Big changes happen all the time.

Such changes typically come with upheaval and conflict, with at least one side kicking and screaming the entire time. In dealing with the slavery issue, for example, America’s Founders understood that the elimination of that peculiar institution would bring with it economic, agricultural, relational, and political transformations, and perhaps even violent, bloody war. George Mason, a member of the 1787 Constitutional Convention and himself a slaveholder, warned of future trauma borne out of the slave trade and the push to eliminate it: “Providence punishes national sins by national calamities.” The association between wholesale change and societal disruption was no surprise to those who had just come through a decisive, even revolutionary, war with England.

But today’s society changers no longer speak of trauma. The current generation suffers from the delusion that massive societal change is by default trouble-free. “Fundamentally transforming the United States of America” is now declared at the highest levels as a right, and one that should not raise a single disagreeing eyebrow. An era of relative peace, financial comfort, and happy endings has dulled us to the reality that life is complex, and change is hard. Instead, when things we don’t like threaten to unnerve us, we impose solutions that maintain inner peace at the expense of reason.

Conflict avoidance stunts the intellect, preventing us from grappling with life’s most difficult challenges. This risk-averse stance is a major reason for the nation’s large financial debt; throwing borrowed money at a problem is less jarring than battling over no-win divisive issues. The Supreme Court’s action on gay marriage took away the need for Americans on either side of the issue to think deeply about the why of marriage equality, or to think at all. The saddest aspect of this is that many Americans find the elimination of intellectual rigor to be an overall benefit.

Those who supported the court’s decision do not believe in the core tenants of representative democracy and its need for an educated electorate. Instead, they support a representative dictatorship, an environment where difficult political and societal concerns always have one, simple, unchanging solution, and that solution is mandated by national leaders. Anyone who doubts the wisdom of a declaration is branded a bigot, or worse, stupid. It’s the reason that the White House was able to express its agreement with the high court decision so comfortably with a lighted neener-neener display of rainbow colors.

Gay marriage is a contentious issue, as it should be. It’s new, untried, challenging, and a little shocking for a large swath of the American public. That doesn’t automatically mean that it’s wrong. But it does mean that its introduction will—and should—come with some level of angst and turmoil. That arguments arise as to its validity should come as no surprise. But arguments are not harmful. Debating worldviews is healthy, and historically American. Fiat declarations that cheat us out of the growth and maturity that comes of conflict are not.

[Image Credits: The White House]

This article was posted on July 6, 2015. Related articles: Commentary, , , .

Footnotes for “Why Instant Societal Change Sucks”

  1. Millions of Americans were acutely aware that marriage equality was before the Supreme Court and have been waiting for some time for the acknowledgement that they, like other Americans, deserve the right to marry the person they love whenever and wherever they wish. Yes, this change should be met with rational thought. I am not sure that angst and turmoil are necessary.

  2. I don’t believe that angst and turmoil are necessary either. I’m not fretting that much over the particulars of the decision. But there does seem to be a level of gloating by some over the decision that wasn’t just a “We’re so excited because we won” response, but instead a “We won, and everyone who opposed us is an idiot and deserves to be ridiculed” response.

    My core concern was not with the case itself, but with the process of introducing societal change in America. The 50 states were well on their way to making gay marriage the law of the land. Many of them, like the Supreme Court, did so through fiat decision, but others did so properly through the legislative process. While there was ebb and flow on the issue, I think that over time, all states would have legalized gay marriage anyway, and in a way that was less dictatorial.

  3. I agree that there is gloating. It has been all over the media and it may seem as though I am part of it myself, though that is not my intention. For those who have religious beliefs that are in direct conflict with this decision, I am sorry and I am trying to understand how troubling this might be. The worst thing we can do is condemn those who we perceive as rigid and then turn around and do the same ourselves. I try to remind myself of this when I begin to think I have the only answer.

    Marriage equality is an issue about which I feel strongly. Those of us who are very close to gay individuals know the struggles they already face. My reaction to this decision and, perhaps, that of some of those who appear to be gloating, is joy. It is joy for those I love. In my mind, these are fine, highly moral individuals who deserve respect and freedom.

  4. The fifty states may have been on their way to making marriage equality the law, but I don’t believe this was guaranteed. What about states that might not have agreed? Should couples living in those states have to give up on the idea of marriage? Should they have to move to another state?

  5. Not guaranteed, but likely. On all big issues, all states have eventually come to agreement, either through natural societal change, federal legislation, civil war (in one case), or constitutional amendment. Long ago, the answer to “should they have to move to another state” would have been, “Of course.” The 14th Amendment (especially its equal protection clause) and the judicial extensions that came from it changed that viewpoint, not just for social issues like marriage, but on business and political issues as well. Such is the nature of national politics.

    I think that federal regulations, in large part, made the gay marriage issue much more contentious than it needed to be. Thanks to HIPAA, IRS regulations about who can share income, child adoption rules, and other similar privacy and relational mandates, marriage equality became a need, not just to be happy, but to deal with so much red tape.

  6. My view about this issue is simplistic, I know. Still, I am firm in my belief.

  7. Tim, you should have done a book report on S. Coontz, “Marriage, a History: How Love Conquered Marriage” (Penguin 2005). I don’t know whether Justice Kennedy is on GoodReads, but evidently he did.

Leave a Footnote


C#-Visual Basic Bilingual Dictionary

My latest book, the C#-Visual Basic Bilingual Dictionary, is now available for you to enjoy! This reference work documents all features of the C# and Visual Basic programming languages, and provides example source code showing how to use each feature in the other language. It’s like a French-English bilingual dictionary, but for .NET developers!

You can purchase the book today from Amazon.com and other online retailers. The text is available in a handsome 448-page paperback edition, or in equally handsome EPUB and MOBI ebook formats. To get a full list of stores, visit my new publishing web site, Owani Press. Or, enjoy this description from the book’s back cover.

Built on Microsoft’s powerful .NET Framework, C# and Visual Basic are complete equals in terms of coding power and application development possibilities. In today’s multi-platform environment, an understanding of both languages is a job requirement. The C#-Visual Basic Bilingual Dictionary unifies the languages by providing clear, functional equivalents for all syntax and grammar differences.

  • Complete coverage of all language keywords. Nearly 900 dictionary-like entries cover every Visual Basic and C# keyword and grammar feature, including VB’s “My” namespace.
  • Examples in both languages. Hundreds of code samples in both C# and Visual Basic make translations between the languages clear and easy to understand.
  • Full support for Roslyn. Each chapter covers the latest language features from Visual Studio 2015 and Microsoft’s “Roslyn” compiler.

Whether you work on a team that uses both languages, or just need to understand a technical article written in that “other” language, the C#-Visual Basic Bilingual Dictionary is an essential resource for developers crafting Microsoft software solutions.

To jump to the Amazon.com page for the book right now, click here.

This article was posted on May 31, 2015. Related articles: Other Books, Technology, , , , .

Leave a Footnote


Top NBC news anchor Brian Williams lied in public, and now he has to spend the next six months in solitary news confinement. If his lies were an exercise in self-aggrandizement, as seems to be the buzz, then it’s hard to feel sorry for his plight.

Despite his troubles, Mr. Williams’ actions don’t really have much of an impact on how I experience the nightly news. His alleged lies were about his own actions on the sides of news stories. His false claim that Iraqi baddies shot at his helicopter didn’t alter the reality that War Is Hell, or change the fact that good soldiers are shot down with depressing frequency. An inaccurate quip on his arrival at the felling of the Berlin Wall puts him in a bad light, but it has no impact on the victory over tyranny that the Wall’s destruction meant to those behind the Iron Curtain.

Williams’ fibs are bad news for news, but there is a worse trend in modern reporting, one where a reporter’s lies stem not from self-interest, but from a clear break with reality. Consider one report from the 2014 election a few months back. In the online article, “GOP takeover: Republicans surge to Senate control,” AP reporters David Espo and Robert Furlow tried to explain the surprising electoral outcome that saw strong Republican victories across the nation. In a bit of predictable spin, the reporters opined that “a majority of those [voters responding to exit polls] supported several positions associated with Democrats or Obama rather than Republicans—saying immigrants in the country illegally should be able to work, backing U.S. military involvement against Islamic State fighters, and agreeing that climate change is a serious problem.” (Emphasis added.)

I get the parts about climate change and illegal aliens. Democratic officials frequently offer up these two issues as key planks in their legislative agenda. But “backing U.S. military involvement against Islamic State fighters”? That can’t be right. The current Democratic president ran for office in part on his promise to rid Iraq of its pesky American military presence. He has changed his tune a bit with the rise of ISIS. But even in his recent request to Congress concerning his plan for battling ISIS, President Obama went out of his way to state that his formal military request did not represent a return to troops on the ground. Military might in Iraq is not typically associated with the Democratic Party; it’s viewed as a Republican thing, and has been at least since Bush’s infamous “Mission Accomplished” message back in 2003.

The AP entrusted these two reporters with communicating one of the most important news stories of election week, and they blew it. The authors of the article were either woefully ignorant of party views on foreign affairs in this country over the past decade, or willfully deceptive in communicating the state of those same views. In either case, it does much more damage to news reporting than any of Brian Williams’ verbal escapades. Even if the AP story was an innocent mistake, it went unchallenged and uncorrected by that news organization, and their web site still includes the errant content.

The problem is not just with these reporters. It’s with readers who will pass by the statement with nary a thought as to its veracity. The polarization of this age has produced a generation of weak-willed news consumers who demand reporting that confirms their prejudices. Republicans (or Democrats, depending on one’s political bent) are evil, and news stories must confirm that. Obama (or Bush) is a hack and a sell-out, and any story that deviates from that narrative is verboten. There is a modern insistence that all the trouble in the world be personally trouble-free, that reporting not ruffle the feathers of news consumers lest they should have to react and turn the channel or click away from the web site.

And so military action in Iraq becomes a Democratic hallmark, because it jives with the sensibilities of a reporter or an audience who know in their hearts that this president, and only this president, has always had the right response to Islamic aggression. The facts are irrelevant; this is news! This isn’t a case of political disagreement. It’s a situation where disagreement doesn’t exist because a political viewpoint is deemed the only that that can ever be classified as real. Not just true or right, but real.

Poor Brian Williams. Despite his flaws, he seemed genuinely interested in being the best talking head in the industry. This charge might mean the end of his career, but probably not. In a world that values perceived reality above facts, Williams might be the new poster child for news reporting.

[Image Credits: NBC News]

This article was posted on February 16, 2015. Related articles: Commentary, , .

Leave a Footnote