Recommend me a web stack

  • Thread starter Deleted member 43669
  • Start date
Status
Not open for further replies.
D

Deleted member 43669

Guest
Hi all,

I'm thinking about a side project. It will be a webapp, with data stored on Postgres. I'd like a sophisticated (AJAXy) frontend, and accesible with mobile devices (with a scaled-down simplified interface).

I've always done webapps in Java (servlets + Spring + JDBC) or PHP for throwaway projects, but I'd like to learn something new:

  • 0$ cost (for development and deployment)
  • Raw SQL-friendly. I'd like to define the schema in SQL and reverse engineer if needed
  • Supports progressive enhancement (I like jQuery a lot)
  • Integration with diverse user auth (FB Connect, OpenID, whatever)
  • Google Maps support?
  • Realtime "push" in mobile devices (and the desktop)

Any suggestions?
 
D

Deleted member 43669

Guest
BlackHex":6nut7slf said:
Really? With VS.net Express it comes in at 0 cost.... Sure you don't get all the templates and olivine but nor do you need them.

Windows Licenses, both for development and deployment. My current web host goes from 40€ to 63€ if I need to run Windows. Plus I do all my stuff at home on Linux, and only have 2 OEM XP Licenses (one is for a machine that's gone and another for my current laptop, which boots to Linux).
 
I would check out:
Sinatra (Ruby Framework)
jQuery Mobile
and maybe Sencha

I work with Ruby a lot (Rails and Sinatra) and lately I've been wanting to build a small Sinatra back end that exposes a REST interface to a Sencha app. Most of the Ruby frameworks are built on Rack these days and there's a growing number of Rack plugins for all kinds of things.

Sencha definitely doesn't qualify as progressive enhancement though as it's entirely created with JavaScript so maybe sticking with jQuery is more what you're looking for. jQuery Mobile just released a new alpha but it seems pretty impressive. I've used jQuery Touch in the past and it was ok.
 

BlackHex

Ars Tribunus Angusticlavius
9,638
Subscriptor++
koala":35op3v16 said:
BlackHex":35op3v16 said:
Really? With VS.net Express it comes in at 0 cost.... Sure you don't get all the templates and olivine but nor do you need them.

Windows Licenses, both for development and deployment. My current web host goes from 40€ to 63€ if I need to run Windows. Plus I do all my stuff at home on Linux, and only have 2 OEM XP Licenses (one is for a machine that's gone and another for my current laptop, which boots to Linux).

Fair enough... but you didn't specify Linux/LAMP in your original post, I assumed windows since Java & PHP can both be done on Windows (I do).

I'll bow out now since I have little idea what's possible on Linux nowadays.
 

Malyk

Ars Tribunus Angusticlavius
8,558
Subscriptor
I'd go with a ruby stack.

I'd go with rails personally for a web app. Your raw-sql requirement is odd and will force you to go outside the "rails way" a bit, but it's doable.

If you don't want rails then sinatra is awesome (it just lacks some nice helpers rails has) and there is a web-stack built on it called Padrino (http://www.padrinorb.com/)

If you use rails, the Devise authentication gem has connectors for facebook, twitter, etc. built in. You might have to roll your own if you go with sinatra/padrino.

There is probably a gmaps gem plugin somewhere.

jQuery is what everyone (basically) uses.

deploy to Heroku. It's free for and has a postgres db that's free up to a certain db size.

If you use ruby you'll also be able to write apps with Rhomobile's Rhodes framework (http://rhomobile.com/products/rhodes/) which lets you write a mobile app once and compile it to all the major smartphone OSes. I haven't used it, but I've seen it in action and it's pretty nice.

Mike
 

Alamout

Ars Legatus Legionis
27,285
I've been messing around with Django recently, which satisfies your $0 requirement. It isn't designed to have you write raw SQL, but I believe you can if you really want to.

The downside are that it's Python (which you didn't mention knowing, but is awesome) and that it takes some work to make the front-end fancy. There's a lot of just-works stuff for the back-end, which is awesome, but making the public-facing pages do what you want takes more effort.
 
D

Deleted member 43669

Guest
OK, I should have clarified my raw SQL requirement.

  • I want to start from an SQL schema, not define models and get DDL out of them
  • I might want to move logic to stored procedures on the db
  • I'll probably run quite a lot of aggregate queries, platform specific SQL, etc. from page views
  • I'll run queries using parameterized queries, of course
 
Malyk":3begczem said:
I'd go with a ruby stack.

I'd go with rails personally for a web app. Your raw-sql requirement is odd and will force you to go outside the "rails way" a bit, but it's doable.

If you don't want rails then sinatra is awesome (it just lacks some nice helpers rails has) and there is a web-stack built on it called Padrino (http://www.padrinorb.com/)

If you use rails, the Devise authentication gem has connectors for facebook, twitter, etc. built in. You might have to roll your own if you go with sinatra/padrino.

There is probably a gmaps gem plugin somewhere.

jQuery is what everyone (basically) uses.

deploy to Heroku. It's free for and has a postgres db that's free up to a certain db size.

If you use ruby you'll also be able to write apps with Rhomobile's Rhodes framework (http://rhomobile.com/products/rhodes/) which lets you write a mobile app once and compile it to all the major smartphone OSes. I haven't used it, but I've seen it in action and it's pretty nice.

Mike

I just wanted to chime back in and basically say ++ to this.

Devise is just awesome and takes care of a lot for you.
Heroku removed almost all my IT headaches (stuff I'm glad I had to learn and am now glad I don't have to worry about), I love it. They're also built on AWS which means access to S3 and other AWS stuff is fast and free (MongoHQ for another).

Devise is rack based so it may work with Sinatra but I kinda think it's hooks are specific to the Rails stack. The base of Devise is Warden though which definitely works with Sinatra.

There are a lot more gems out there to help you do things on Rails, but if you're doing this just for kicks, it's a ton of fun to build stuff on Rack and Sinatra. It's super lean and easy to get your head around (at least for me). It might be more straight forward with running raw sql queries too but I've never done that.

About Rhodes: I was at a conference last year where someone was pitching Rhodes and a few people in the audience ripped into them about having to have a commercial license to put stuff in the app store. Checking out their site, it doesn't look like that's true so maybe something has changed with that.
 

Malyk

Ars Tribunus Angusticlavius
8,558
Subscriptor
About Rhodes: I was at a conference last year where someone was pitching Rhodes and a few people in the audience ripped into them about having to have a commercial license to put stuff in the app store. Checking out their site, it doesn't look like that's true so maybe something has changed with that.

With version 2 of Rhodes (or whatever their last major release was...i'm too lazy to look) they moved to the MIT license for the basic framework. You can buy 2 different tiers of support if you want them plus the RhoSync thing they have costs money (but is unnecessary for basic syncing).

want to start from an SQL schema, not define models and get DDL out of them

With Rails at least this is basically how you go about it. Yes, by default it expects you to have a model named after a table in the db, but you don't have to do it that way. It sure makes things easier/quicker though. With migrations you can write your schema in something close to sql that I find very pleasant to use.

I might want to move logic to stored procedures on the db

I've never understood why people would do this. Maybe 10 years ago when computers weren't as powerful and the DB server was the biggest machine in your cluster, but why would you do this now? Stored procedures are hard to maintain, in a different language then the rest of your app, etc. It's just a huge pain to deal with when you can write code in a nice high-level language and keep it along side all of your other code.

I'll probably run quite a lot of aggregate queries, platform specific SQL, etc. from page views

First off, you shouldn't be touching the DB from a page view. I assume you don't actually mean from the view template itself, but I wanted to make sure.

What do you mean by platform specific sql? I thought you wanted to run on postgresql.

Again, with rails or sinatra (activerecord/datamapper/sequel) you can do this. There's nothing stopping you from writing your own SQL.

Mike
 
D

Deleted member 43669

Guest
Malyk":12o885rf said:
With Rails at least this is basically how you go about it. Yes, by default it expects you to have a model named after a table in the db, but you don't have to do it that way. It sure makes things easier/quicker though. With migrations you can write your schema in something close to sql that I find very pleasant to use.

I can live with that, although ideally I'd like to be able to reverse-engineer existing schemas (or do it manually).

I've never understood why people would do this. Maybe 10 years ago when computers weren't as powerful and the DB server was the biggest machine in your cluster, but why would you do this now? Stored procedures are hard to maintain, in a different language then the rest of your app, etc. It's just a huge pain to deal with when you can write code in a nice high-level language and keep it along side all of your other code.

First off, you shouldn't be touching the DB from a page view. I assume you don't actually mean from the view template itself, but I wanted to make sure.

What do you mean by platform specific sql? I thought you wanted to run on postgresql.

Again, with rails or sinatra (activerecord/datamapper/sequel) you can do this. There's nothing stopping you from writing your own SQL.

I'll probably be using quite a lot of Postgres-specific funcionality; with... recursive, geometric operators, etc. which are probably not going to be directly accessible via ORMs. Also, complex update statements normally do not map well to ORMs (i.e. try doing update my_table set value = value + 2 where type = 3 on your ORM), so while having a ORM will be nice in some aspects (CRUDdy stuff, etc.), I'll have a need of overriding it frequently, and web views will probably need to pull data via complex aggregate queries...

I might not end up using SPs, but I'm considering them for the following reasons:

  • I *might* have to access the data from different platforms (say, suppose I implement the web frontend using RoR, but I decide to use a Java frontend to expose RMI web-services to J2ME clients), putting my data interface directly on the database has its advantages.
  • I might want to hide away the Postgres specific code behind SPs, so that if I need to change things behind the scenes, I do not have to touch frontend code (i.e. schema structure modifications, datatype changes, etc.)
  • Some data operations are better expressed in SQL, esp. some batch data updates I might need to execute regularly, etc.
 
Malyk":ain9nxr2 said:
I've never understood why people would do this. Maybe 10 years ago when computers weren't as powerful and the DB server was the biggest machine in your cluster, but why would you do this now? Stored procedures are hard to maintain, in a different language then the rest of your app, etc. It's just a huge pain to deal with when you can write code in a nice high-level language and keep it along side all of your other code.
  • SQL is a higher-level language than Ruby/Java/Python. It is a domain-specific language for querying and updating relvars.
  • The database server has access to indexes and the physical storage layer. If the logic in question (for example, validating whether an operation can be performed) largely involves the state of the database, it will always be significantly faster (10x-100x) to compute that logic on the database and return the result, rather than return the raw data and allow the client to compute the logic. Network and IO latency are the issue, not relative system performances.
  • Stored procedures are easier to maintain, not harder to maintain. The same logic can be applied to all data updates and queries, regardless of their source. If you depend on applications to implement this logic, you have to implement it for each application.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
all of what you say is true aliftedlorax.

But the fact is that the PL basis of most (all?) stored procedures have:
  • lousy string handling
  • exceptionally poor collections apis
  • syntax based on infrequently used base languages
  • little to no portability across RDMS systems

That they allow easy embedding of (proper, validated) sql is a great boon, but the PL part of PL/SQL and the T part of Transact SQL are pretty awful IMO.

More recent versions of the big RDMS have started to offer the ability to use more modern languages for this part (.Net for MS SQL Server, java for Oracle etc) but I was under the impression that this had not gained a great deal of traction.

That said there is still good reason to put such logic into the database layer. It's just a shame that layer is often so unpleasant.
 

Xavin

Ars Legatus Legionis
30,828
Subscriptor++
The SP/No-SP argument is bitter and both sides have good points. For the majority of applications performance-wise it's not going to matter at all. I would go at it like all optimizations, do it simpler first (ORM stuff in this case), and add in specific SPs if you need them. Every ORM I have seen makes it easy to call an SP if you need to.

I *might* have to access the data from different platforms (say, suppose I implement the web frontend using RoR, but I decide to use a Java frontend to expose RMI web-services to J2ME clients), putting my data interface directly on the database has its advantages.
I might want to hide away the Postgres specific code behind SPs, so that if I need to change things behind the scenes, I do not have to touch frontend code (i.e. schema structure modifications, datatype changes, etc.)
That sounds like a lot of premature optimization. Focus on getting your application working one way, as simply as possible, then deal with making it generic later if that's actually something that is needed. Chances are you will end up re-writing all of the original code anyway if it gets big, so don't get bogged down in making a portable API driven application until you need one.
 
Xavin":1as98hqf said:
That sounds like a lot of premature optimization. Focus on getting your application working one way, as simply as possible, then deal with making it generic later if that's actually something that is needed. Chances are you will end up re-writing all of the original code anyway if it gets big, so don't get bogged down in making a portable API driven application until you need one.
One counter-argument to this is that there are always at least two applications that access a shared data store:
  • The application as seen and used by end users.
  • One or more reporting and/or analysis tools as seen and used by the application owners.

For some systems there is also an administration or help-desk application/mode. So it's almost always the case that one will need the access-path independence given by informed use of a relational database. (Object-relational mapping is not an informed use; it is the first great blunder.)
 

Xavin

Ars Legatus Legionis
30,828
Subscriptor++
One counter-argument to this is that there are always at least two applications that access a shared data store:

* The application as seen and used by end users.
* One or more reporting and/or analysis tools as seen and used by the application owners.
You are almost always going to be able to use the same business layer for multiple client applications. That most definitely doesn't need to be at the database level, in cfact, I have never seen it done that way unless a DBA was designing the system.

Say what you will about ORM, but in every case I have used it, it kept me from writing a whole bunch of boilerplate code (that could have been buggy), and let me get the project done faster and be easier to maintain. That works for me.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
(Object-relational mapping is not an informed use; it is the first great blunder.)

I fail to see how using it in for only reads and inserts rather than updates makes it wrong.
At that point the instances become values, not variables and all is well with the type theory again.

Obviously language support for said immutability would be nice, and plenty of ORM's go to great lengths to make updates work, which can be a bit of a pain. but none the less in this mode they save vast amounts of boiler plate and I see no 'theological' issues with it at all.

There's quite a lot to be said for trying to design many of the CRUD systems to be CR only (or at least CRD).

For those occasions when you really do need to do an update I think dropping back down to the 'proper' SQL based data layer is okay. The important thing is to accept that your in memory instances may be out of step with your database unless you are in a transaction. ORMs make it very easy to hang on to cached state and use it outside of a transaction (which is fine so long as you understand the implications)
 

Malyk

Ars Tribunus Angusticlavius
8,558
Subscriptor
The other thing I'd mention is that it seems the commercial web world (twitter, twilio, foursquare, etc...all large volume, high-performance apps) is moving to an API based model. That is, everything is done through an api which removes the "different apps use the db" issue in that the api is the only thing talking to the db and every other app talks to the api.

Now, that doesn't mean that they don't have admin apps that directly access the db layer...i have no idea, but their public facing sites use their API.

Another nail in the coffin for writing SPs in the db.

I should say I see no problem with SPs for certain tasks (bulk reporting, large data manipulation, etc.), but as a communication arbiter with the database? I don't see the need.

Mike
 

karmakaze

Ars Tribunus Militum
1,700
Subscriptor
If free as in "I don't have to spend a dime from start to finish" is really important to you, Google App Engine is the way to go, I've deployed a couple apps on GAE, one with ~100 active users, and haven't come within 5% of my free quota limit. So until you pass a really big userbase, you won't pay a dime (and even then, you set a max quota of what you're willing to pay a day). That said, it's strictly a noSQL environment(*), so if that's a hard requirement then it's a no go.

*Yes, SQL support is coming to AppEngine for Business sometime soon, but that negates my previous point since it costs money.
 
Xavin":1reld5vb said:
As I said before, IME only DBAs want to use SPs as a business layer. Have you ever tried to debug an SP? It's like going back in time two decades.

And how would you describe performance tuning the calls your ORM is making?
I've had cases in the past (in SQL Server 2005) where I had to use index hinting to get a sproc to do what I intended it to do; do ORMs handle this gracefully? I imagine that there are other odd corners of the sproc world that it doesn't handle well.
That said, I don't really miss getting that hands-on with the database.
 
D

Deleted member 43669

Guest
karmakaze":mbe4gdkr said:
If free as in "I don't have to spend a dime from start to finish" is really important to you, Google App Engine is the way to go, I've deployed a couple apps on GAE, one with ~100 active users, and haven't come within 5% of my free quota limit. So until you pass a really big userbase, you won't pay a dime (and even then, you set a max quota of what you're willing to pay a day). That said, it's strictly a noSQL environment(*), so if that's a hard requirement then it's a no go.

*Yes, SQL support is coming to AppEngine for Business sometime soon, but that negates my previous point since it costs money.

GAE is interesting, but not for this particular project. I'm willing to pay hosting and I don't really like being locked-in to GAE.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
do ORMs handle this gracefully? I imagine that there are other odd corners of the sproc world that it doesn't handle well.

If your join is sufficiently complex it likely shouldn't be in an ORM in the first place.
Write it as a view, then bind the ORM to the view.

That this then becomes read only should be viewed as a benefit. No one should be trying to manipulate that level of complexity outside of the DB.

Using an ORM for dynamically created joins is about the only case you want may hit this situation, but then you have exactly the same issue doing that with an sproc (except the use of dynamic sql is often horrible in these layers) so I have no trouble with the idea of using them there. If you're doing dynamic joins where there are a large number of possibley correct joins your database is fundamentally either not very structured for legit reasons (the model it represents isn't) or you're being overly slack in your representation. The solution in the latter case is obvious, in the former you're tool may not be the right one for the job, even if it is the best of a bad lot and you must adapt accordingly.
 
Status
Not open for further replies.