C for Beginners?

I recently responded to someone's blog comment that said that BASIC is not a good language for beginning programmers. He suggested instead that beginners learn C. I responded that C is a fine language for many purposes (like operating system development), but that it contains too many difficulties that are not fundamentally related to learning programming. Here's a cool page that I found using StumbleUpon http://www.stumbleupon.com that illustrates my point effectively. ;-)

http://www.andromeda.com/people/ddyer/topten.html

BASIC's culture of diversity

One of the really interesting things about BASIC is that there are probably more dialects than any other programming language. Perhaps this is because BASIC really is the people's language. Sure, there are different versions of C (a few), Cobol (why?), Forth, etc. but people just love to create their own version of BASIC for whatever reason.

I guess that since BASIC was born into a world where it was shoehorned into many, many different computers it became part of the BASIC culture that it is okay to have many broadly different implementations. Every early home computer had it's own BASIC.

Now I've heard it said that this is a weakness of BASIC, and many people complain that there is no commercially viable standard BASIC. I'm not sure why this is a problem. The standard (by committee) is very old and limited. Since the world is constantly changing, I think it's a good thing that BASIC hasn't settled down into a rut. BASIC is still a place where people feel free to explore and innovate.

The world is big enough to accomodate variety.

Liberty BASIC gets some attention

Although Liberty BASIC isn't mentioned by name, the Liberty BASIC site gets a mention and a link by Jim Kelly here:

thenxtstep.blogspot.com/2006/10/learning-basic.html

Right away some debate about the suitability of BASIC arose in the reader comments. My how things never change. ;-)

Telengard and learning to program

Many years ago a close friend and I loved to play Telengard on his Commodore 64. This was a classic Dungeons and Dragons styled game. It was very well done and lots of fun. It seems to me though that was most fun about it was that it was written in BASIC. With very little effort we managed to break into the running game and customize it.

In fact recently I mentioned the game to him. He seemed to enjoy remembering most that we were able to hack the game. I was an experienced BASIC programmer at that time and it didn't impress me as much. I simply enjoyed playing the game.

I think what this makes clear to me is that programming novices like my friend really enjoy the process of learning by monkeying with a running system. You can just break into a program, examine or change a variable, add/change code and resume execution. I wonder how many beginners do not go on to become competent programmers without access to this kind of interactive system.

This is something that interpreted BASIC is excellent at. More systems need to be like this.

[JBoss] Logging JBoss CMP SQL

JBossIn many occassions developers tend to get errors when calling the CMP finders. The best method to fix such issues is to view the generated SQL queries, as it's easy to understand the error in terms of general SQL rather than looking at the EJB-QLs.

With the help of log4j, CMP generated SQLs can be logged into a file as follows.

1. Goto the conf folder inside your server instance.
2. Open the log4j.xml file and add the following two entries to it.

<appender name="CMP" class="org.jboss.logging.appender.RollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="/log/cmpSQL.log"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="800KB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.xml.XMLLayout"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>

<category name="org.jboss.ejb.plugins.cmp">
<priority value="DEBUG" />
<appender-ref ref="CMP"/>
</category>

With the above given entries, a file named cmpSQL.log will be created inside the log folder. SQLs send to the server will be logged into this file. If required, name and place of the log file can be changed by changing the value in File param.
<param name="File" value="/log/cmpSQL.log"/>


Check out this stream