Saturday, November 15, 2014

The Useless Language


I have made sufficiently clear that the xs language is not the main feature of this project. It is, however, very dear to my heart and as such I will make the case for it, yet again. The philosophical foundations here state that programming should be simple and that could be achieved by having the right tools for every particular task. The industry seems to believe the exact contrary: one tool (read Java, C#) should handle all tasks and that tool has to be oh-so-serious and handled only by the most delicate of minds.

Which takes us to prototyping, where my humble belief is that it (prototyping) represents at least 60% of all software development. Rapid prototyping makes everyone on the team better, allow management to interact with the product at early stages and developers to easily identify use cases that might have caused painful refactoring later on. This seems to be the trend the industry is moving towards to, or it should, anyway.

The problem here is that "rapid" and "serious" tend to be mutually exclusive. Rapid prototyping should be dirty (sometimes right-down-nasty) in order to be effective. Why would you force your developers to spend copious amounts of energy writing "correct" code for a feature that might just be dropped or significantly changed? And make no mistake, I am talking about the enemy here, the dark lord of over-design. Developers tend to get creative and stubborn and before you know it the code is made of many over-complicated design patterns that don't play nice with other developer's patterns. There are meetings, passionate arguments, hurt feelings and lost of productivity. Before you know it a couple months have gone by and a big refactoring is in order.  And nobody is happy.

So, xs is meant to be quick and dirty and beautiful, OK?  But at the same time is good old typed C#, so the choice is yours. Keep in mind that we fully intend to translate xs code to other languages, so you could do your prototyping no matter the language where you intend to do your production work. So, here is what this useless programming language allows:


  1. Structural leeway:  We will include default usings for you and do our best to guess the ones you need based on your code. We will use convention over configuration whenever possible, for instance: if you just write some code it will be assumed to be the "main" function, or if you just write some methods the assumption will be that it represents the "application" object. No namespace will mean default namespace, things like that.
  2. Javascript feel: We will allow the user the illusion of javascript, geared towards simplicity. Write some functions, pass them to methods, etc. Incidentally, we plan to use the keyword function to declare types, to spare the programmer the ugly Func c# type. Write arrays in js form because, who needs all those new constructs? var arr = [1, 2, 3, 5]; Declare untyped parameters, see if we can infer them.  
  3. Events: We will allow the syntax: on event() { ... }  because sometimes you don't want to add delegates, you would rather just do something when someone clicks that button.
  4. typedef:  Because C++ lives in our hearts, you silly young people. Also, because I usually feel like breaking stuff when I have to write multiple times the same Dictionary<SomeLongType, SomeEvenLongerTypeMaybeAFunc>
  5. Inferrable types: We plan some language types that allow the compiler to select the implementation type. Because sometimes you are not sure if you want to use a List or an IEnumerable or a MyType[]. This types would look something like: array<MyType> or map<int, MyType>. Because the C++ standard library lives in our hearts and Dictionary is such a long word.
Some disclaimers:

  1. Some of these are already implemented and testable, please check the samples in our online compiler. Some others not so much, stay tuned.
  2. I might add a few more of this, I will even add your suggestions if you let me know. You might want to implement some.
  3. None of these are guaranteed to work, so you may get some errors from time to time and will be forced to be more explicit, we tried, tho.
  4. I did not include features that are considered useful to the Excess platform such as DSL and external data.

So, there it is, xs. Be quick, dirty and happy.


No comments:

Post a Comment