I am designing a project geared towards business and is built in C language. The design of the various interface screens are currently in XML/CSS. The target platform is a PC running linux or windows. To compile the software, I first run a source-to-source compiler which converts the XML/CSS into C code, and then compiles that to the final product. This source-to-source compiler was also designed by me and written in C.

I am looking for a scripting language which could be embedded into the source-to-source compiler that allows for the following things:

- Code that is easy to read and write, even many years in the future, that can be picked up by anyone and modified to change business policies which in many cases would involve changes to the way the interface works.

- Easily embeddable into existing C code, allowing structures and functions to be directly accessible from the scripting language.

- Fast and relatively light weight, especially for our linux installations.

- Ultra Stable. The software can not afford downtime whatsoever.

- Can stand the test of time, to be around for decades. In other words, this language should be backed by some kind of standard. It should also not require frequent updates to bug fixes as that is not an easy option.

- When we hire new programmers, we would recommend that they know this scripting language prior to starting, so it should be relatively well known.

I am posting this question in a Python forum because this was one of my first choices. While I have no experience in Python, I do know that it is a well documented, popular, and embeddable scripting language used for extensions, scripting and automation of software. What I don't know if this is the best language for the job. My primary concern is building complex business logic using this language.

Another consideration is using Lua, which I understand is simpler syntactically and geared towards being embeddable in C. But I don't know if it has any real advantage over Python for my implementation, and I believe Python is far better positioned as far as documentation, support, and training is concerned.

A final consideration is to use COBOL, a language built for business logic and still one of the most widely used programming languages in the world. While its not a scripting language in the same way Python or Lua is, its time-tested stability and popularity could be to my advantage, but I am not sure how I would go about embedding it to my compiler. Also, if Python can compete with the buisness logic programming of COBOL, I believe it would be advantageous to stick with something mainstream.

With that said, I am eager to get your take on this subject. I understand you might be partial to Python but so am I. I just need some intelligent feedback to solidify my decision.

Recommended Answers

All 3 Replies

Hi, I think the style of programming for reading that Python philosophy encourages agrees with interests of your business logic. I do not know exactly what are your requirements, source to source translation you have ready, otherwise you could have tried to adapt pypy JIT environment for your application. Usually in Python circles XML is looked more as part of problem as solution, and simpler representations like reST are encouraged. There exist fair amount of tools however fair amount of tools for XML, if you are forced to use it.

You would not be first to use Python in business either: http://linux.downloadatoz.com/paythyme/, however this package is Linux-centric.

http://en.wikipedia.org/wiki/ERP5 looks also interesting. For commercial product I would check http://www.resolversystems.com/ (free for open source though).

Could you give maybe 'imaginary script concept' pseudo code for what kind of work you have in mind exactly for Python?

P.S. Seen you in C forum, welcome to my home ground!

Hello pyTony! Just to be clear, the software is not a web application, or web anything for that matter. Its an internal localised proprietary software system using a proprietary graphical interface system optimised for PC terminals, much of which are 100% dedicated to that application. The XML and CSS are custom made to work only in this interface engine.

I understand that "pypy JIT" is an alternative to "CPython", either of which could accomplish integrating my existing code with a high level scripting language. If I had to choose, I'd rather pre-compile the scripting language into the binary prior to distribution since it matches our internal security policy requirements. If I had to implement a JIT compiler, the code would have to still be built into the binary library, which is rather inefficient.

The "Representational State Transfer" model you referred to (reST) is incompatible with my system as it isn't a client/server model. Portability is not an issue because the we are targeting specific managed hardware, so all the advantages of reST end up being unnecessary overhead for our system.

Your suggestion of using the built-in XML integration functions in python are interesting, but also somewhat incompatible with the philosophy of the software. In our system XML events can contain script code in much the same way as HTML does with javascript, except with much closer integration. Your link explains importing/exporting XML rather than integrating with it in the way I described. I would rather that whatever scripting language we choose plays a supporting role rather than a primary role, so the XML system should be the dominant object defining language.

I am certain other businesses use Python, but that in itself does not mean that it is best suited for business logic, in much the way that weather modelling software can be written in C, but would be better written in Fortran which targets that kind of application best.

The "ERP5" system is intriguing to me, but I don't see how it applies to my project because it is built with Zope which is a web application server. Some implementation suggestions on ERP5 would be useful.

You asked for some "pseudo code", which is not a bad suggestion. Here is an example:


That pseudo code is not meant to illustrate any particular logic, in fact its quite random, but it does illustrate the complex style of logic I need to incorporate. My need for a readable language is not about control as much as it is satisfying complex conditions. Some logic in these scripts are highly recursive, requiring that the script revisit conditions that changed depending on changes of status during logic interpretation.

Thank you for taking the time to help and providing such a very intelligent post.

This makes your job for Python more logic than business I think, something like knowledge base (http://pyke.sourceforge.net/examples.html). Why code, not some kind of decision tree built from relationships?

When would Python be in action, when defining the C result from XML or it would get called from C-code produced from XML. XML would be just carrier of the code and not visible in any way to Python side, maybe?

Looks like the result of Python code would be organizing the GUI and configuring the program according relevance of informations to worker and need to know, am I correct?
I hope the 1000 recursion depth limit (adjustable until 2000 in Windows standard installation) does not disturb your recursive rules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.