Yes you read it right!!! It’s HealthyCode.
Our company is launching a monthly magazine called HealthyCode targeting the developer community.
The magazine will have articles on programming and development by popular writers, bloggers and passionate developers and programmers.
Have an eye on this space for more information about it.
I woke up today morning with a mail alert from my tablet. Opened it only to see a newsletter from Spring source about the arrival of Spring Framework 4.0 next month.
My Spring 3.0 book cover page flashed my mind and when I thought about the 500 odd pages in the book, I went back to sleep again. 
Functional fever is driving me crazy. I have been trying to write/convert every piece of code to a functional style. For the last couple of weeks, I have been writing tons of code in Scala using pattern matching. In a flight some time back, when I was looking at some C code of calculating the largest number in a given array recursively, I started jotting down Scala equivalent of the same using Pattern Matching. And here’s what I scribbled.
def findMax(lst:List[Int]):Int = {
lst match{
case x::Nil => x
case x::tail => {
if(x < tail(0))
findMax(tail)
else
findMax(x::tail.tail)
}
}
}
println(findMax(List(1111,23,4,5,74,6,578,8,9)))
After the flight, came home and showed the code to my Java developer friend, who looked at it and said it flew over his head. I felt extremely happy about it!!!
;). I also told him that there’s lot of code like that in my Git repo, only to make him run away.
I was discussing OpenAjax Hub which is an implementation of the publisher-subscriber pattern last week with my client. In the process, decided to quickly hand-toss my own implementation of the pattern.
Here’s an example where there’is a textbox and a button. When the user enters a value in the textbox and hits the button, the value is published to a list of subscribers. The subscribers are pre-registered with the button.
<html>
<head>
<script>
var Bus = function(){
var subscribers = [];
this.publish = function(eventName,arg){
var handlers = subscribers[eventName];
for(var i=0;i<handlers.length;i++){
handlers[i](arg);
}
}
this.subscribe = function(eventName,handler){
if(!subscribers[eventName])
subscribers[eventName] = [];
subscribers[eventName].push(handler);
}
};
var messageBus = new Bus();
function init(){
messageBus.subscribe("btnclick",handler1);
messageBus.subscribe("btnclick",handler2);
}
function doSomething(){
messageBus.publish("btnclick",document.getElementById("nametext").value);
}
function handler1(arg){
document.getElementById("spn1").innerHTML = "<b>" + arg + "</b>";
}
function handler2(arg){
document.getElementById("spn2").innerHTML = "<i>" + arg + "</i>";
}
</script>
</head>
<body onload="init();">
Name <input type="text" id="nametext"><input type="button" value="Do" onclick="doSomething()"><br/>
<span id="spn1"></span><br/>
<span id="spn2"></span><br/>
</body>
</html>
The code has a Bus class with publish/subscribe methods. The subscribe() method adds the handler functions to a collection and publish() method invokes the handlers.
I found some time last week to play with Sencha Architect 3. Two things that immediately caught my attention are Theming and IntelliSense.
Gone are those days when you had to work with Sencha Cmd to create custom themes, create SCSS files and change the CSS vars by referring to the API documentation. Against every component that you create, there’s a table that contains a list of CSS vars that can be changed right away in Sencha Architect 3. It makes life easier for customizing themes.
The Intellisense support while writing our code is a welcome addition and makes it easier to key-in.
I’m beginning to like this IDE.