Which technology(s) / language(s) to write linux web application/service?

ltickett

[H]ard|Gawd
Joined
Jul 27, 2000
Messages
1,125
I am currently playing with some open source home automation software www.domotiga.nl

The software is built in Gambas2 (a graphical programming language similar to visual basic). I am considering building something similar or porting domotiga to a server based application/service.

The application would need a web front end and i will likely be developing in debian (arm). But i'm not sure if php or python are suitable for server based applications which need to be always running (collecting data etc) rather than just running when accessed.

Which technology(s) / language(s) should i look into?

I used to do a lot of Visual Basic, then VB.NET, now C# and have played with php a few years back- but don't really want this to sway the decision too much as i should be able to pickup whatever language if i decide to proceed.
 
you can use C#, but it is a microsoft language.
why must this run on a linux server and not a windows server?
 
If you want to stay with C#/.NET but on a *nix platform, you could always try Mono. From what I know it's surprisingly quite popular.
 
you can use C#, but it is a microsoft language.
why must this run on a linux server and not a windows server?

Primarily because i'm hoping to run it on a raspberry pi. But additionally i think it adds to the "open-ness".
 
If you want to stay with C#/.NET but on a *nix platform, you could always try Mono. From what I know it's surprisingly quite popular.

I'm not really fussed about staying with .NET and i'd rather not introduce complications by trying to do so. However, that being said- i will read up on Mono and if it's popular, well supported, free/open etc it might end up being the way to go.
 
I'm not really fussed about staying with .NET and i'd rather not introduce complications by trying to do so. However, that being said- i will read up on Mono and if it's popular, well supported, free/open etc it might end up being the way to go.

There are definitely good, high end alternatives, but since you already know .NET and want to stay open source, this would probably be a good fit.

I'm a Ruby guy. It's a great language for web development, especially web app type applications. Initially I learned it / used it for a cross platform software jRuby project (Java Ruby interpreter), but then began fiddling around in web development with Ruby. It was somewhat challenging for me, to learn Ruby, since all that I have worked with at that point was C++, Java, PHP and C# (all C-syntax languages). Ruby is quite different and is a bit of a steep curve. Nonetheless, I got used to the syntax so much that every time I have to work in a different programming language (I write PHP at work currently), all I see are things how Ruby could improve the project.

So, if you want to take a plunge, learn Ruby. It's super fun and powerful. You can use a pretty typical hosting setup with it, essentially running the app on Apache with an additional Apache module. Ruby has it's own HTTP servers also, but with Apache things are quite a bit more flexible (obviously). I'm not a Rails guy, my framework of choice is Sinatra. The front page actually shows how easy it is to get started...
 
Thanks- having a look into it :) I wonder if i should be taking performance/footprint into account as one of my main deciding factors...
 
I personally would not write it in .NET if your planned target is rasberry pi. While .Net is pretty nice, I think you will ultimately spend more time dealing with hassle of getting mono to work than if you just bit the bullet and wrote it in some language that is more "native" to the linux ecosystem.

As for php or python usable for a system that is "always running", they are both suitable. I have a network monitoring program I wrote in python to monitor all the workstations in my companies network for health, and it works just fine. I use django for the server, and the windows machines all have clients which gather info from smartctl, apcupsd, and some other stuff.

A web service api call to update the status of something is fundamentally no different than any other request.

Plus it's a good excuse to learn a language you are unfamiliar with, so you can get better.
 
So using something like C isn't likely to produce a much more efficient program than say ruby?

Presumably the massive drawback being that i'd have to compile?
 
Python is the 'official language' for the RPi project, so that would probably be a good choice. There are plenty of micro-frameworks (Flask and Bottle mostly, I love both) that are quite lovely to work with.

PHP is also probably a reasonable choice, as it's supported by pretty much every web server in existence.
 
For a home automation system, neither is going to peg your cpu at 100% as long as you aren't doing anything ridiculous and using bubble sorts or other hideous O(n^5) algorithms and whatnot.

The efficiency you are more likely going to want, rather than optimizing for CPU time, is for programmer time. And that is where using higher level programming languages can be vastly more advantageous.

So using something like C isn't likely to produce a much more efficient program than say ruby?

Presumably the massive drawback being that i'd have to compile?
 
Given your desired platform Python seems like the obvious choice. You know it will always be there and available on raspberry pi and likely any modern Linux distro that someone may have replaced Debian with (or if on different hardware). Plus it is perfectly capable of the task.
 
For a home automation system, neither is going to peg your cpu at 100% as long as you aren't doing anything ridiculous and using bubble sorts or other hideous O(n^5) algorithms and whatnot.

The efficiency you are more likely going to want, rather than optimizing for CPU time, is for programmer time. And that is where using higher level programming languages can be vastly more advantageous.

I think my concern is around the number of "scheduled" processes. I expect a lot of things will be happening every minute, 5minutes, 10minutes etc.

There will also "listening" processes which i don't yet have any idea how efficient they will be. I guess i will start throwing some things together and see how it all fairs!
 
I think you are worrying about a problem that might not exist. There's a video on Youtube of Quake3 running on a Raspberry Pi (1080p 4xAA ~12fps). Just think how much is going on in that game loop - so controlling a few devices should be a breeze for even the most basic computer.
 
Yeah for rendering, but there is still allot going on (listening to keyboard and mouse movements, AI, collision detection...) - so it isn't a million miles from your project
 
I think my concern is around the number of "scheduled" processes. I expect a lot of things will be happening every minute, 5minutes, 10minutes etc.

There will also "listening" processes which i don't yet have any idea how efficient they will be. I guess i will start throwing some things together and see how it all fairs!

Linux background sleeping threads use almost 0 resources, so don't worry about any hit for a 'listener'. If you are going to use python, it plays well as a background process and even has a built in web server if you want to use it for both your scheduled task and for incoming 'server' type request.

PHP while great and integrated nicely into apache is going to use a bit more resources. A small script combined with the apache process while executing could take upto 5MB. But you are not looking at an extreme level of concurrency if this is just for you and attached devices.
 
Back
Top