The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Embedding ASP.NET, PHP or Ruby in app?

I have an app which has a tiny, built-in HTTP server for serving reports.  Right now the reports are static HTML (generated on a schedule).  I'd like to make them more dynamic, which means I should integrated a web scripting engine rather than building one from scratch.

The ASP.NET pipeline can be loaded into any process, but it seems really heavy.  I'm wondering if anyone has done something like this with PHP, Ruby, or something else?  How easy is it to make those frameworks call back into my app to fetch data for display?
Doug
Thursday, April 24, 2008
 
 
I honestly don't think that creating your own "scripting engine" in this case is that unreasonable. You don't really need a scripting engine per se. You really just need to be able to generate well formed HTML which isn't that hard at all. People have been doing it for many years. That's the one and only beauty to HTML.  :)

I would personally consider creating a simple set of classes that are capable of outputing report data as simple HTML formatted tables unless you really expect to need a bunch of JavaScript. HTML is just text. If you are using static HTML now then creating similar HTML on the fly should be a snap.
dood mcdoogle
Thursday, April 24, 2008
 
 
Also, is there a reason why this functionality needs to be embedded directly into your app? How about exposing the data in your app through web services and then having a separate web app that calls them that is hosted in IIS or some other external web server? It seems like it would be a much more scalable option.
dood mcdoogle
Thursday, April 24, 2008
 
 
I've actually already done what you suggest dood -- I have classes that produce HTML, and it's beautiful HTML at that -- which took a LONG time to get right in all browsers :(

But I want to be able to generate it on the fly, pass in some variables, etc.  That means my HTTP server needs to receive a request and rather than just serving a file, it needs to read the URL, pass variables to a 'page', and have the 'page' do something dynamic.  I could (and to some extent have) hard-code 'page' objects in C++, but I'd prefer to make the system more flexible with a scripting layer.

IIS is a possible solution, but I'm trying to keep my dependencies as low as possible.  That means less support issues, fewer system requirements, one less cord tying me to Microsoft, etc.  So I've ruled out IIS.

At the moment I'm leaning towards handling PHP pages, although I still need to look into whether it's OK to bundle PHP with my app, and find out what it means technically for PHP script to be able to access the internals of my app.
Doug
Friday, April 25, 2008
 
 
If your webserver has a CGI interface, you wouldn't need to embed the scripting engine. In that case, PHP or Ruby or whichever you please, would be equally suitable.

If you're looking to embed the scripting-engine directly in your application, you could take a look at Lua, which is known for being very easy to embed/integrate with C/C++ code.
Troels Knak-Nielsen Send private email
Friday, April 25, 2008
 
 
Why don't you try using XSLT over an XML datasource to genrate your HTML. It will seem like the perfect usecase for me.
AZ
Friday, April 25, 2008
 
 
If you understand COM, it is easy to write a ASP web server parsing ASP scripts. You can start with this article:

http://www.codeproject.com/KB/IP/aspwebserver1.aspx
Glitch
Friday, April 25, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz