Using a Domain Specific Language in AS3

Introduction

I’m very interested in creating flexible code in AS3 which reflects best practice in other Programming Languages, and primarily follows the topics covered in the Pragmatic Programmer.

One chapter deals with Domain Languages, which seems a good approach to make more adaptable, robust, readable and testable code. In envisage creating a text file in an easy to read format which can change the behaviour of my Flash app in runtime.

Links

First Step – Using a simple text file

I created a simple AS3 Class which reads a text file and returns values. The text file is formed in the following way:

	value1=100
	value2=foo
	


Whilst the AS3 Class can be called in the following way:

	var foo:String = Scriptparser.getData("foo");
	

Further action

This post is much of a ‘stub’ for my only personal use, to add to as I continue with this project. From Martin Fowlers article, it seems I need an External DSL which uses a Semantic Model.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s