Open Source J# Reborn As Ja.NET
December 23, 2008
Commercially I develop contracted software for clients based on the .NET platform, and C#. During my ‘free time’ I work on an application based on Java technologies (Java, Spring, Hibernate, and GWT). Sometimes I wish I could use one language for both my .NET and Java development. In the past this lead me to consider using J# for some of my .NET development, but somehow I never got around writing anything in J#. I finally lost all interest when Microsoft dropped J# from the .NET framework. So it was with great interest that I watched the rebirth of an open source J#, called Ja.NET.
Ja.NET is Java 1.5 Standard Edition (J2SE) that compiles MSIL for .NET. Ja.NET is derived from the Apache Harmony JVM. What this means is that all code written for Ja.NET can be compiled to .NET MSIL or Harmony Java bytecode. So far the developers have successfully built and ran JUnit, Xerces, Ant, and other OSS on .NET without any code changes to those distributions. Pretty neat!
Alt.Net South Africa
August 9, 2008
A local South African Alt.Net community was formed with a portal and e-mailing list: http://altdotnet.org.za and http://tech.groups.yahoo.com/group/altdotnet-za/ .
Alt.Net is a passionate movement that pushes the boundaries of software development by exploring beyond the mainstream and status quo, for new and better ways of building software, with a focus on the techniques, experience, principles, and patterns behind the tools.
The purpose of this site is to bring together South African developers who are following the international Alt.Net discussions. The idea is not to replace or duplicate the international community but to create a local space where we can collaborate to discuss the things that affect us in a Southern African (and African) context.
If you are passionate about getting this underway then please check it out and lets start a discussion on the mailing list and see where we can take it!
What Is Your Code Saying?
August 9, 2008
Developers often talk of “self describing code“. This term is a favorite answer when a developer’s poor use of comments comes into question. Often the answer: “I don’t need to write thorough comments, because my code is self describing.” Ignoring the commenting part of the example, lets dwell further on the “self describing code” claim. So my question is how well does your code reveal it’s purpose?
Let’s take the following example into consideration. Let’s say I need to determine whether data was binded to a control. The control has a property called Description, that will have a value after data was binded to it. So in order for me to determine whether the data binding operation completed successfully I could write the following code:
if ( string.IsNullOrEmpty( controlInstance.Description ) ) { … }
So what does this say about the purpose of the code? Does this line of code clearly tell you that I am actually checking whether the control was data binded? No. That knowledge is hidden away, deep inside my head. Anyone looking at this line of code will immediately be confused as to why I am doing this check. So now I am faced with two choices; I can either put a comment next to the statement, or encapsulate the logic in a property or method that will reveal the meaning of the operation (preferably we should do both). The latter option will make the code self describing, and reveal it’s intrinsic meaning:
/// <summary>
/// Checks if a data source was binded to the control.
/// </summary>
public bool DataBinded
{
get
{
return !string.IsNullOrEmpty( this.Description );
}
}
Our original line of code then becomes: if ( controlInstance.DataBinded ) { … }
Looking at this code, there is no confusion at what I was trying to achieve. We now also have one place where we define the rules that determine whether the control was data binded, so that if it needs to change, we only need to do it in one place.
The point is that there are a lot of things that need to be taken into consideration when writing and structuring source code, such as performance, coupling, inheritance hierarchy, abstraction, patterns and so forth. A very important one that I believe is too often neglected, or forgotten all together, is how well the source code communicates its meaning. In fact, personally I would say this aspect should be of the highest priority. I believe the team paying attention to this aspect of coding, will really reap the rewards once they have to start maintaining the product, especially as the original developers leave, and new ones join the team. Considering that the maintenance of existing software can account for over 60% of all development effort, and that 70% of the cost of software is devoted to maintenance, I believe that any technique that can help with easing this task is of great importance, especially if it’s something as simple as packaging and naming your code in a clear and concise manner!
Setting up MySQL for Python (MySQLdb) on Mac OS X
November 16, 2007
MySQL is an excellent, very popular and open source database management system. A binary installation is available for Mac OS, and the process of installing MySQL on Mac OS is also very well documented. So just head over to MySQL.com, where you will find the binary installation, together with extensive installation, and usage documentation.
To connect to MySQL from Python use MySQL for Python (MySQLdb). Get MySQLdb from http://sourceforge.net/projects/mysql-python/.
- Download MySQL from mysql.com and install the DBMS as instructed in the documentation.
- Make sure “Library/Python/2.3” does not have:
- Directory “MySQL”
- File “_mysql.pyd”
- File “_mysql_exceptions.py”
- File “_mysql_exceptions.pyc”
- Download and unpack MySQL for Python. At the time of writing this is MySQL-python-1.2.1_p2.tar.gz .
- Open Terminal and change to the directory where MySQLdb was unpacked to.
- Get rid of any previous builds that might interfere, by deleting the “build” directory if it exists.
- Edit the setup.py file, and change:
return popen(“mysql_config –%s” % what)
to
return popen(“/usr/local/mysql/bin/mysql_config –%s” % what) - Cleanup any previous install attempts:
python setup.py clean
- Build MySQLdb:
python setup.py build
Either uninstall MySQL for Python if a setup program was used to install it, otherwise manually delete them.
Viola! MySQL for Python is all setup, and ready for your Python-MySQL data access code. Enjoy!





