Wednesday, March 25, 2015

The case for business


Let's now make the case for how Excess can help businesses. Software companies, particularly the large ones, seldom need GREAT code. What they mostly need is consistent code: their main problem turnover. One senior developer leaves and whole products get shaken to their foundation. If no one understand that dude's code the poor old manager can see months of refactoring coming a mile away. And these things cost many-many-monies.

So, the large company yearns for uniformity. They build thick handbooks (like, 400 pages long) of coding standards, best practices and all kind of minutiae. Problem is, not only those are difficult to learn, they are difficult to enforce. So here comes countless hours of either code reviews or praying. And they pay by the hour.

It is safe to say companies would be delighted if a computer wrote most of their code. Coincidentally that's what excess do, write less code and let the compiler take care of boiler plate. Lets see a user case of a product that has gained some notoriety: aspboilerplate.net

The premise is simple: you will get code generated for you already embedding the best practices. It is a great idea, and I personally used it to create metaprogramming.ninja, It has some drawbacks, tho: It only helps while creating your project, you are expected to follow guidelines from there on. So lets take that to the next level. For the sake of argument lets assume you want to standardize your data access with ORM entities and repositories supporting unit of work and all that jazz:

entity Product
{
     int ID;
     string Name;
     decimal Price;
}

repository Products
{
      IEnumerable<Product> GetAllProducts();
}

By now you have got to know Excess can EASILY generate the boilerplate to make this happen, including units of work and whatever else you need. So we'll talk about subtler points: Let's assume your best practices include not littering your data entities with methods. Excess can report errors when that happens! No need to code-review for that particular item!! In other words, Excess will help your company to add its own best practices to the compiler. Now programmers can come and go, and data access will be standardized, or it wouldn't compile.

Lets analyze another terrible occurrence for business: technology has evolved! Do you know how expensive a system-wide porting can be? Depending on the size of the code base and how old the former technology was it could take from 6 months to many years. Then you are paying your devs for basically nothing.

Lets say that if Excess can generate boiler plate for one technology it could easily do it for another, no? So, want to switch from EntityFramework to Hybernate? Change the underlying data compiler and you are good to go, no changes in the actual application code. Monies people, money!

One last point, we have discussed here a common data extension, however, for some business operating in a well defined domain the savings could be much greater. A criticism could be made as developers must learn a different dialect of the language. But, would that be any different than learning heavy "best practice" handbooks?


Thursday, March 19, 2015

Getting real useful (Dudeism edition)


Here's the scenario: you are a programmer, you know, like everybody else. You are writing your project or your task at work and you are generally happy about the state of things. And then you need some statistical work. Now, like most dudes/dudettes, you forgot the courses you took at school. Because, I mean, cmon...

HOWEVER, what you lack in respect for educational institutions you make up for with your general knowledge of the tools available. You know there is a programming language named R for exactly that type of work, with a bunch of ready to use examples and the such. Unfortunately, being the knowledgeable individual you are you know that you either write your whole thing in R or none of it.

So, you put your head down and head for stackoverflow to find a list of available libraries, most of which will be poorly documented and start the long, tedious process of learning the thing. Like you were some kind of nerd, you know? Like you were going to go for a phd in statistics or something.

And then, all of a sudden, things don't look so peachy anymore and you are one bummed out dude/dudette. All you wanted to do was:

private void calculateTheStuff(data)
{
    var result = R()
    {
         //do the amazing in R...
    }

    return result;
}

My calling in life is, as widely known, to help the dudes of the world being generally happy about the state of things. So, basically, this sample code is now possible. And by "basically" I mean, no, you cannot write full R yet. But there IS a nascent implementation of it here, It does the basic vector configuration and concatenation. It is the prettiest thing ever but needs some dudes to help out.

Now, if you are a manager reading this and wondering why would you care about those dudes. Think that studies have clearly linked the bummed-out index of your dudes to major loss in productivity, missed deadlines and the such. You know, the kind of stuff that gets you fired, so, for crying out loud...

HELP YOUR DUDES.  

Wednesday, March 18, 2015

We've got grammars


It's been a couple of weeks, release time! Our new feature is custom grammars, or the ability for users to embed their languages (or existing ones) in their favorite language. The implications of this feature are clear: domain specific languages can now be a seamlessly integrated into mainstream languages.

Much  have been written about DSLs, with the consensus been:

a) These languages are incredibly useful.
b) These languages are incredibly hard to be made useful.

Just think for a second the amount of work it would take to write one such language and make it mainstream. Now compare that mental image to this:





Now, I know this programming language stuff is hard, so I apologize. It should actually take more than 2 minutes to create an useful extension like this one. However, clocking in at 125 lines of code, I assume an afternoon is enough, Not bad for something you wouldn't have otherwise.

What about the grammars, tho? Well, the grammars used are strictly ANTLR grammars. For the uninitiated, antlr would be the de facto standard for grammar writing. In fact, we do not even process the grammar themselves, letting their compiler generate the basic c# infrastructure. This makes the whole thing very tested and solid. Thanks, @antlrguy.

What we do, after the grammar is processed, is to augment the generated code so it calls your transform functions. As seen in the video, we can generate these functions automatically for you. All you have to do is provide the right transformations.

These transformations are in essence the same as traditional Roslyn transformations. Only the starting point is not a SyntaxNode, but a node derived from the grammar in question. In  this particular example the pairs [name, value] are transformed into a c# anonymous object. Straightforward stuff.