Alex Hoffman

Perspective on development, management and technology




    IASA Member

April 2003 - Posts

What is a Script?

Cory Smith, implies in a comment to my line feed post, that a compiled language (VB.NET) and scripting are mutually exclusive.

"I'm not sure what you mean by "scripting" product... VB.NET is compiled to the exact same framework in the exact same way as C#. Don't make statements like this about something that you have even expressed yourself that you don't know about. It's just different, not any better or worse than C#."

If you ask any number of developers exactly what scripting is,your likely to receive a plethora of answers rather than any consensus on what actually constitutes a "script". A lot of the answers will describe attributes of scripting. Amongst them...

  • Script languages are "simple languages".
  • Scripts are interpreted rather than compiled.
  • Script languages are "lightweight".
  • Scripting allows "typeless" programming.
  • Script languages are associated with a particular application or task.

While all these may or may not be correct, the problem is that most articles and books do not offer a definition. The reader is left in the same state as one of those three monkeys describing an elephant.

So let me propose one...

"A script is program code whose method or unit of re-use and distribution is text."

As such, any of the .NET languages can be used as a script language.

Posted Tuesday, April 29, 2003 11:17 PM by Alex Hoffman | 3 comment(s)

Retrieving Embedded Resources in VS

Embedding resources in my assembly and thenretrievingthemis somewhat easier than the convoluted method I have been using to date.

Now I find that I can in VS, simply add an existingresource (say an XSLT document) to a project, and set the "Build Action" property for the file to "Embedded Resource".

I can then easily retrieve the resource programatically as follows:-

Stream s = myAssembly.GetManifestResourceStream(resourceName);

Perfect - ready to instantiate an XmlTextReader with the stream.

The only non-intuitive thing is the resource name. It should be named for retrieval as the projects default namespace plus, if the file has been added at the root level of your project - the name of the file. If loaded into a folder off the the root project folder, the file name should be prepended with that folder name.

For example a project might have a default namespaceof Alintex.Script. Ifone placed a document named psf.xslt into the root folder of the project,one would specify the resource name as Alintex.Script.psf.xslt. If I placed the psf.xslt document into a folder named "Resources" off the project root, then I would specify the resource name as Alintex.Script.Resources.psf.xslt

Posted Monday, April 28, 2003 1:37 AM by Alex Hoffman | with no comments

Line Feeds in VB

Sometimes it's the simple things that stump you. I'm converting somecode from C# to VB. What followed was a bit ofhead scratchingover what appeared to be the most trivial of tasks.

Take the following line and convert it to VB...



System.Console.WriteLine("Hello" & vbCrLf & "World")

or does it?

The VB code on my system produces "HelloWorld" rather than the two words on separate lines as expected.

Being a VB newbie, I have found the reason why to be twofold. Firstly, vbCrLf is not intrinsic to the language but rather defined as with other VB constants in the Microsoft.VisualBasic assembly. VS automagically imports the namespaces without telling anyone - the rest of us aren't so lucky. And secondly, because I am using a "scripting" product, explicit type checking is turned off by default - so vbCrLf is interpreted as an object rather than a constant.

The two combine to annoyingly require that users be instructed that they must explicitly import the Microsoft.VisualBasic namespace/s or take great care in the absence of explicit type checking.

Update: see here for another perspective on this issue...

Posted Sunday, April 27, 2003 6:58 PM by Alex Hoffman | 10 comment(s)

Confusing Web Services?

Discussing service oriented architectures with a number of developers recently, made me realize that there is real confusion about how an ASP.NET XML Web Service should be implemented architecturally.

Many appeared to think that somehow business logic should be implemented in the Web Service, which would be serviced by the data tier, with one or more presentation layers consuming the service.

Why think this?

The answer is that that's what most articles and examples tend to show. Most show business logic being performed in a service method. Admittedly, it is often shown that way in order to show how to consume an XML Web Service, but does soat the cost of the bigger picture.

Surely examples should more correctly show a Web Service acting as an interface to business logic. Business logic that is serviced by the data tier and ifapplicable, enterprise services. Business logic which is generally represented directly through a presentation layer.

Posted Saturday, April 12, 2003 2:17 AM by Alex Hoffman | 7 comment(s)

A Wiki Weblog

SnipSnap is an interesting amalgamation of a wiki with a weblog written in Java.

Combining the free structure of a wiki, with the threaded discussion structure of a newsgroup or web based forum, together with a linear weblog continues to intrigue me.

Posted Friday, April 11, 2003 10:12 PM by Alex Hoffman | 1 comment(s)

Adam Bosworth on SOA
John Udell recounts a great talk given by Adam Bosworth of BEA at the CTO Forum on Service Oriented Architectures.

Posted Thursday, April 3, 2003 10:18 PM by Alex Hoffman | with no comments

More Posts