SOA or JBOWS?
It’s stunningly surprising how, sometimes, someone describes something which mirrors some of our past experiences. This “Just a Bunch of Web Services” post accurately describes my experience in one of my previous projects. It also accurately describes what the (software) vendors gain, by trying to popularize some technology (like SOA) on the basis of how easy their tools (IDEs) make it to produce, only at the expense of businesses that fall into the trap.
I saw the first implementation of (Asp.Net) web services as merely a wrapper over traditional Ado.Net data access layer
I’ve also seen an approach (in a typical big financial enterprise) where every communication has to happen through web services ???
One might not even realize the simplicity of RESTful web services until one has to climb the steep learning curve of technologies like WCF, where implementing a service is damn easy but everything else (configuration etc.) is a forgettable story. And though I am not sure, but my conclusion is that WCF must’ve been used more in remoting (TCP / IP endpoint in WCF) scenarios than the web (HTTP endpoint in WCF) based scenarios. Of course, YEMV (your experience might vary). So have you seen this JBOWS architecture?
Open source programming languages
Till date, I’ve worked on programming languages which were not open source and were a property of some company (Microsoft, in my case – VB 6 and C#). However these days I’ve heard a lot that how important it is for a programming language to be open sourced. If you think deeply, you too might realize that there are a few advantages which cannot be had in a closed source language, e.g. -
1) How many languages can boast of being backward incompatible? Python 3 is one of them.
2) One could start using a newer version of the language whenever one felt comfortable. The choice of which version of the language to use, would not be tied to the use of a particular (newer) version of the IDE. Yes, I am talking of C# and Visual Studio. [ I understand MS wants to make money, and decision makers who, many times are non-techies, are never in a hurry to upgrade to the newer version of the IDE and therefore the language, forcing us poor developers to write delegates even though lambdas are available
Most people would've switched to a newer compiler if the older IDE could support it. ]
3) One could vote for what features to be included. Yes, the decision might still rest with some committee of core developers of the language, but one would’ve had some say. Amazingly, I don’t understand why Java 7 won’t have closures.
So choose your language (and the platform) wisely, else you might have to code in C# 2.0 in the days of C# 4.0 (i.e. keep using VS 2005 in 2010)
Tools vs. techniques
You might have read in the Alt.Net circles that the tools (like IoC, ORM etc.) aren’t as important as the techniques (SRP, separation of concerns, persistence ignorance etc.). To be frank, those guys (Ayende, Jeremy Miller etc.) are trying to save themselves from stupid arguments like “so you mean to say, if someone doesn’t use IoC, ORM etc. he’s a bad programmer”?
The fact of the matter is that it’s highly unlikely to find someone who is aware of the techniques, but haven’t used (or at least heard of) the tools. The reason is that there’s a symbiotic relationship between the tools and the techniques – sometimes the techniques lead you to the tools and sometimes the tools lead you to the techniques
e.g. I became aware of persistence ignorance after reading the Hibernate book; I became aware of the term separation of concerns after encountering Castle Monorail and Windsor and reading about IoC.
So if you’ve never used an IoC container or an ORM tool, you won’t realize what you are missing until you give them a try. Not only you’ll learn the techniques, you’ll learn something more than plain Ado.Net or plain old singletons
Lisp vs. Haskell
I was thinking Lisp might be the best language yet, but this article, has left me wondering. Still, I have to keep myself at learning Lisp and eventually Clojure
Work
Work is something you do,
not some place you go.
Teleworking = Performance not presence.
An Intel advertisement
[seen in a DC metro train]
The founder visa
I wish and pray, this becomes a reality soon. Btw, if you haven’t read Paul Graham’s other essays, do check them out, he’s an absolute genius and I can’t do anything but agree to what he has to say, most of the times.
The deterioration of education
It seems this phenomena is not limited just to India, but to some other advanced countries as well. This is not to suggest that the standard of all the colleges has deteriorated, but very few of them are exceptions. Have a look at this article by Dr. Mark Tarver or the very famous The Perils of Java schools by Joel Spolsky, if you don’t believe me.
If we talk about India, the paradox is that if there are not enough colleges offering advanced courses like engineering or management, so many good guys will be devoid of a degree. On the other hand, the mushrooming of private colleges has given rise to dilution in quality of those degrees. So even though a student might have an engineering or a management degree, he might not necessarily, get a lucrative job, or sometimes even a mediocre job. Most of the times, people from such colleges end up being underpaid and doing jobs which might not even require those degrees – a term which is called underemployment.
But since, underemployment is better than unemployment, I believe, the governments let this continue, because it is in their favor too. The colleges are definitely the biggest beneficiaries, because without providing quality education or campus placements, they can charge hefty fees from the students – “debt and degree inflation”
as per Dr. Tarver.
The only way to avoid this vicious cycle is well, the time tested way – study hard in the school, so that you are able to get into one of the good colleges. Well, some rules don’t change ever
Theory and Practice
This is a very nice article which emphasizes the importance of formal learning as well as hardening that learning in the field i.e. becoming a street fighter. It clearly states that the combination of the two will surpass either. Go read it.
Local variables are no longer local
Let us consider this code -
public class MathUtil {
public static Func<int> MakeIncrementer() {
int n = 0;
Func<int> incr = () => ++n;
return incr;
}
}
Given the above code, what do you think should be the output of the below program -
public class Program {
static void Main(string[] args) {
Func incr = MathUtil.MakeIncrementer();
Func incr1 = MathUtil.MakeIncrementer();
Console.WriteLine(incr());
Console.WriteLine(incr());
Console.WriteLine(incr());
Console.WriteLine(incr1());
Console.WriteLine(incr1());
Console.WriteLine(incr1());
}
}
Well, if your answer is -
1 2 3 1 2 3
then great, you already know what closures are and don’t need to read any further.
For those of you who don’t – Closures are a block of code with bindings to the environment they come from. Please read this post from Martin Fowler for more details. Also read an excellent article on Functional Programming by Slava. What does bindings and environment mean? In our case, the incr() function, inside the MakeIncrementer function has access (is bound) to the variable n, which is outside the scope (i.e. the environemnt) of the incr() function body.
The most important observations are -
1) That local variables are no longer limited to simple scope rules and have an undefined lifetime.
2) The obvious conclusion is that they’re no longer stored on the stack – they must be stored on the heap instead.
Slava writes this in his article – “Closures bring functional and OO worlds closer together. Every time you create a class that holds some state and pass it to somewhere else, think of closures. A closure is just an object that creates “member variables” on the fly by grabbing them from the scope, so you don’t have to!“
And as my friend, Raj mentioned that Java had the notion of inner classes since long back, and they have similar characteristics, I believe closures (implemented with functions) are much less overhead, at least the syntactical part.
Do you still think that local variables are local and stored on the stack
First baby steps towards DSL nirvana
I am sure, you must have come across this term, DSL – Domain Specific Language, if you read blogs from some well known industry experts. Well, I read this term long back, and got interested in it, and even bought the MEAP version of Ayende’s excellent book (and the only available, at the time, in the market on the subject) on Writing DSLs in Boo.
Obviously, I tried to write a DSL after reading the book. Maybe, I didn’t read it thoroughly, or for some other reason, but I couldn’t write one. And then I read this quote by Richard Feynman – “What I cannot create, I do not understand.” Obviously I was thoroughly disappointed, and felt bad and what not, but somehow I couldn’t perform the DSL magic.
Then I came across this excellent article on Lisp and it’s melleability for doing magic (read bending the language at will) and I was convinced about the power of the language. Then somehow, I came across Clojure and started learning it only because it’s a Lisp variant for JVM. And, then suddenly, one day, after spending not a very substantial time with it, the light bulb did glow for me
So, a few of the basic characteristics which make a language suitable for DSL development are -
1) The language should have a very minimal syntax; yes, no semi-colons, no curly braces
[ I mean, these are noise ]
2) There should be some way by which the language supports lazy evaluation
Enough rambling and time for some code. Look at the following C# code -
public string [] GetPathsOfAllFiles(string folderName, string extension)
{
return Directory.GetFiles(folderName, String.Format("*.{0}", extension));
}
And now look at this code (please try to imagine the context behind this code; I’ll post more on this later) -
(defmacro source-files-of-type [file-filter from folder] (list 'GetPathsOfAllFiles folder file-filter))
And yes, the above is valid code, which will run on .Net
by way of Clojure’s port on CLR. So instead of -
SomeClassOrObject.GetPathsOfAllFiles("C:\\abc", "*.txt);
one can write -
(source-files-of-type "*.txt" from "C:\\abc")
Do you notice a difference in the readability? And as I mentioned before, I’ve started learning Clojure a mere three months back. Sweet
I’ll be posting more on this once I am done with a first full implementation of a DSL, so until then, take care.