Mar
8
2011
Mar
8
2011
Mar
6
2011
At the nofluffjuststuff conference this weekend, and I loved it. Some particular highlights that I enjoyed were guava, a discussion on apprenticeship in the 21st century, gradle, and man oh man I loved sonar.
The food was good; people from the last 3 companies that I had worked with were at the conference, so it was a bit of a blast from the past. Infact I am blogging to you direct from the conference now!
Some of the talks were so exciting, that I went home last night and fired up a instance of sonar right off the bat and took a spin on guava. It was everything that I expected, so I would recommend checking out some of the tech listed here.
If you want to know how good your code is, and want all of the statistics assembled in a nice consumable interface sonar is great for stuff like that.
If you want a nice util library, that simplifies many of the functions that you would be doing in java. Guava is perfect for things like that, and there is a good chance you can reduce your code size by 25%.
If you are looking for a complete end-to-end package for managing software, dependencies, etc. Gradle is starting to appear like a interesting alternative for such a thing.
Long story short nofluff was a blast, I would recommend checking it out if you ever get a opportunity. I had learned a ton about new tools moving into the nebulous void of software development which can make our lives a little less chaotic. In the same sense though I am happy that the conference is coming to a end.. Have work on monday :-S… … .
Feb
14
2011
Just a upcoming notice, I will be attending several conferences in the next 30 days. Some of them are business related, some are tech related but here is the the events I know for sure I will be at.
Possibly: TC’s “Network Your Heart Out” Event @Thom Pham’s Wondrous Azian Kitchen
Thankx, Matt
Feb
8
2011
Sorry for anyone that was trying to access the site, but we were down for a while. No, there were not any major issues we simply just switched the blog off of a managed server I was paying for (mochahost) to our new set of quad core servers. These are the same servers that are running FindTechs right now. So long story short I had to do lots of investigation on how to correctly migrate the blog. Part of the problem is that the current wordpress migration tools do not carry over the images, themes, etc.
That was unacceptable since I wanted a true copy, so after some research I settled on a plugin that would correctly make the copy, and migrated. Even after the migration though there were still problems regarding the BIND mappings, and making sure the virtual host was set up correctly
. We are all good now though, and back online! Yaay. Welcome back to anyone checking things out.
~matt
Feb
7
2011
The findtechs.com redesign is underway to be more commercially friendly. While the current design was technically nice, it was not commercially viable for communicating with the people who we need to communicate with. So as a result the site main page has been re-designed so far, I will also be re-doing the rest of the pages. The backend for findtechs is done, so it is simply a matter of migrating the current javascript to the new look and updating a few things.
We should be ready to go after that point, the site deadline wise is way past is point, and some core features were dropped, but one way or another we will get a release out there so we can start doing business already! One of the nice things is that the code is all custom, and the platform was designed around some very nice core concepts (scaling, open architecture, SOA oriented, very low technical debt). So I am excited to get it out there, and get cracking on things.
Hopefully in a couple weeks I can report that Webactive is in business!
~matt
Feb
4
2011
I went to the sumpernet! meetup last night, and it rocked! I was able to meet business professionals and aspiring professionals (like myself), talk about issues, and how to succeed in business and marketing. I would highly recommend it to anyone looking to get into entrepreneurship. I learned tons about how people work, and get work done.
Jul
13
2010
So it is 2010… … I know it has been a while since posting, but back when I had done the first post on object-first javascript in 2009 I thought that it could possibly change the way javascript would be coded. Since then I have discovered a few things about it. I can also say that I still prefer this way of structuring javascript code more then any other, yet I feel like I have not shared this discovery very well with the world. So in the interests of delivering a clear message about what this could mean for programmers I will be creating a full tutorial on the subject at ofjs.org.
Nov
11
2009
Well I am for sure digging deep into the webservice java world lately (I may even tip up a few examples and post them here). For those of you who do not know what mule is, I would describe it as a composite webservice based environment that is meant to ease the development of integration systems (albet with lots of XML). Really it isn’t that hard to work with, and in many cases kinda fun. You will probably see more postings on it in the future from me, but for now I just decided to take a quick break and give you guys a update on the latest and greatest tech I get to play with.
~matt
Nov
10
2009
So you have been asked to create some sort of callback history, or maybe trace how you have got to a certain point and be able to “roll back” previous states of your application. I have recently discovered a very interesting use for closure callbacks that enables just the thing. Most people would freak out, but really this is just a design pattern based on linked objects in traditional languages (only more easy!).
So lets get on with the example.
var PresidentTracer = new (function(){
var presidenttracer = this;
var presidentCurrent;
var presidentCallback;
var presidentCallforward;
presidenttracer.addPresident = function(presidentName){
var current = presidentCurrent;
var callback = presidentCallback;
presidentCurrent = presidentName;
//callback history
presidentCallback = function(){
presidentCurrent = current;
presidentCallback = callback;
};
};
presidenttracer.nextPresident = function(){
var current = presidentCurrent;
var callback = presidentCallback;
var callforward = presidentCallforward;
if(presidentCallforward!=null){
presidentCallforward();
presidentCallback = function(){
presidentCurrent = current;
presidentCallback = callback;
presidentCallforward = callforward;
}
}
};
presidenttracer.previousPresident = function(){
var current = presidentCurrent;
var callback = presidentCallback;
var callforward = presidentCallforward;
if(presidentCallback!=null){
presidentCallback();
presidentCallforward = function(){
presidentCurrent = current;
presidentCallback = callback;
presidentCallforward = callforward;
}
}
};
presidenttracer.currentPresident = function(){
return presidentCurrent;
};
})();
This is basically linked lists through closures… It can get even more interesting then this though, we could if we wanted to pass in a closure to get executed on each president switch as follows.
var PresidentTracer = new (function(){
var presidenttracer = this;
var presidentCurrent;
var presidentCallback;
var presidentCallforward;
var switchCall;
presidenttracer.addPresident = function(presidentName, callOnSwitch){
var current = presidentCurrent;
var callback = presidentCallback;
var switcher = switchCall;
presidentCurrent = presidentName;
switchCall = callOnSwitch;
callOnSwitch();
//callback history
presidentCallback = function(){
switchCall = switcher;
presidentCurrent = current;
presidentCallback = callback;
};
};
presidenttracer.nextPresident = function(){
var current = presidentCurrent;
var callback = presidentCallback;
var callforward = presidentCallforward;
var switcher = switchCall;
if(presidentCallforward!=null){
presidentCallforward();
switchCall();
presidentCallback = function(){
presidentCurrent = current;
presidentCallback = callback;
presidentCallforward = callforward;
switchCall = switcher;
};
}
};
presidenttracer.previousPresident = function(){
var current = presidentCurrent;
var callback = presidentCallback;
var callforward = presidentCallforward;
var switcher = switchCall;
if(presidentCallback!=null){
presidentCallback();
switchCall();
presidentCallforward = function(){
presidentCurrent = current;
presidentCallback = callback;
presidentCallforward = callforward;
switchCall = switcher;
};
}
};
presidenttracer.currentPresident = function(){
return presidentCurrent;
};
})();
so lets test it out!!!
PresidentTracer.addPresident('fruit',function(){alert('zoop');})
PresidentTracer.addPresident('whoAmI',function(){
alert(PresidentTracer.currentPresident());
});
PresidentTracer.addPresident('neto',function(){alert('dynamic callbacks');})
PresidentTracer.currentPresident();
PresidentTracer.previousPresident();
PresidentTracer.nextPresident();
PresidentTracer.nextPresident();
PresidentTracer.previousPresident();
PresidentTracer.previousPresident();
Oct
30
2009
Over the past few years I have worked on several javascript projects, many of which use and require a class paradigm of some sort (Open API’s). So to say the least, this is an experience which is irritating for new people and is still irritating for experienced programmers. The complexity of the problem is due mostly to the fact that there are 3-4 ways to do some things in the language (this is one of them), and none of the ways to do it really is right in any traditional sense of the word.
So for the JOY of throwing another wrench in the basket, I bring you yet ANOTHER way of doing namespaces in javascript programming, but don’t worry this should be a very pleasant experience.
First let me start off with how the problem began,
Now being a programmer who is mandated to use jquery, he was a fish out of water. Since jquery is not a library that lends its self well to a multi-level namespace matt was forced to come up with a new method for programming namespaced API’s, regardless.. Should matt really have to rely on a library to define a namespace in javascript?? NO.
Thus I introduce to you, classical javascript OOP with namespaces. Which I would affectionately like to call “Javascript with Classes”.
Properties of javascript class programming.
Finally, this method of javascript programming isn’t really all that special. To be honest it was looking me right in the face for the longest time, but it wasn’t until now that I get why it is important. I would say that probably the nicest thing about this method is that it unifies namespaces and classical javascript OOP, I can throw out structuring classes in object literals all together, there are also several other advantages including much cleaner code.
So enough talk, lets cut to the chase:
(The red highlighted code is the winner, when looking at simplicity)
Object Literal Way:
HelloWorld = {
stuff:function(){
//stuff
}
};
Classes Way:
HelloWorld = new (function(){
//stuff
})();
Classical Way:
function HelloWorld(){
//stuff
}
Object Literal Way:
Notice: Whoa, where did function come from? Melding of 2 different concepts here. No concept of closures, you will see later how this can get extremely complicated, and even unsafe.
HelloWorld = {
"Animals":{
"Bunnie":function(){},
"Fish":function(){},
"Bear":function(){}
}
}
Javascript Class Way:
Notice: things stay consistent. The anonymous singletons are the namespaces, functions are the objects. Think about how closures come into play with this method.
HelloWorld = new (function(){
var hw = this;
hw.Animals = new (function(){
var animal = this;
animal.Bunnie = function(){};
animal.Fish = function(){};
animal.Bear = function(){};
})();
})();
Classical Way:
Notice:You can see where classical starts to break down with namespaces, you need to declare every level of the object. Highly irritating, if you have several levels. Everything is declared out of scope, so you will see later how closures factor into things. Also, unless you want your user to be able to instantiate HelloWorld on the fly, this is not a standard namespace. This is not really even correct in many ways..
HelloWorld = function(){}
HelloWorld.Animals = function(){};
HelloWorld.Animals.Bunnie = function(){};
HelloWorld.Animals.Fish = function(){};
HelloWorld.Animals.Bear = function(){};
Object Literal Way:
Notice: Humm, notice how we had to type in the full object path here, this is one of the downfalls of object literals, in the fact that scope is not retained in the literal. This becomes highly irritating if you at all try to create any sort of complexed javascript object model.
HelloWorld = {
Animals:{
Bunnie:function(){alert('Bunny');},
Fish:function(){alert('Fish');},
Bear:function(){
alert('A Bear Has A');
HelloWorld.Animals.Fish();
}
}
}
Javascript Class Way:
Notice: Humm, this is nice, notice the fact that since everything is in a closure, we are able to retain scope. We don’t have to work down the heirarchy, just use the closes parent object to reference sub-objects. If you do lots of api calls which is what about 30% of code is, this can greatly enhance how clean code is.
HelloWorld = new (function(){
var hw = this;
hw.Animals = new (function(){
var animal = this;
animal.Bunnie = function(){alert('Bunny');};
animal.Fish = function(){alert('Fish');};
animal.Bear = function(){
alert('A Bear Has A');
animal.Fish();
};
})();
})();
Classical Way:
Notice:Really, classical is getting worse here, and we have the same problem that the object literal has, as the fact that there is no retention of scope.
HelloWorld = function(){}
HelloWorld.Animals = function(){};
HelloWorld.Animals.Bunnie = function(){alert('Bunnie');};
HelloWorld.Animals.Fish = function(){alert('Fish');};
HelloWorld.Animals.Bear = function(){
alert('A Bear Has A');
HelloWorld.Animals.Fish();
};
Object Literal Way:
Its not possible to do it.
Javascript Class Way:
Due to the fact that sub classes are defined in the parent class scope is inherent, and privates become easy to achieve. Privates only exist in the confines of a { and }, so a parent object could never access a child private.
HelloWorld = new (function(){
var hw = this;
var privateHello = 'Hello World';
hw.Animals = new (function(){
var animal = this;
animal.Bunnie = function(){alert('Bunny');};
animal.Fish = function(){alert('Fish');};
animal.Bear = function(){
alert('A Bear Has A');
animal.Fish();
alert(privateHello);
};
})();
})();
Classical Way:
You can define a private variable in the HelloWorld Object, but due to scope issues you can’t share it with any other object.. *sigh*.
HelloWorld = function(){var privateHello = 'Hello World';}
HelloWorld.Animals = function(){};
HelloWorld.Animals.Bunnie = function(){alert('Bunnie');};
HelloWorld.Animals.Fish = function(){alert('Fish');};
HelloWorld.Animals.Bear = function(){
alert('A Bear Has A');
HelloWorld.Animals.Fish();
};
Hummm whenever we start to do anything complexed, a clear winner is beginning to emerge here. Lets continue, and try some other common programming practices. How about we try out constructors. … More on this a bit later.. getting late…