News for hackers. Stuff that matters.
Re:Ask HN: Ridiculous Coding Practices by companies you have... by stcredzero on Thursday June 04, 2009 @04:33PM (#642154)
Point 2 is a bad idea. SQL stored procedures are not a good way to implement business logic. Of course, people who hold the opinion that OO is a bad idea would think it's a great way -- it's pretty much the opposite of OO.

We do it that way so the business logic exists and is enforced in one place...Only the most trivial applications can afford to put all their business logic in the middle tier.

There are much better ways of enforcing business logic and controlling it all in one place, which would be compatible with configuration management/source control and much more convenient for most programming teams.

(Namely: just publish the business logic as a library and have standards that dictate its use. These can be enforced using automated scripts and a little process. You are also not restricted to the middle tier, though I'd still say it's a good idea.)

Re:Ask HN: Ridiculous Coding Practices by companies you have... by gaius on Friday June 05, 2009 @03:30AM (#642857)
just publish the business logic as a library and have standards that dictate its use

LOL!! Why not put the business processes in the standards too, then you won't need any code!

The point is, no-one running any apps against your database has a choice but to respect the business processes if it's all implemented in stored procs. You are protected from malice, from incompetence, from simple human error, and your auditors and regulators and shareholders are happy. Maybe no-one cares if it's only a website.

Also I am hilariously amused that you don't think stored procedures can live in version control like any other source code.

Re:Ask HN: Ridiculous Coding Practices by companies you have... by asb on Thursday June 04, 2009 @06:39PM (#642381)
Stored procedures don't seem like a bad approach to me. You can provide versioning support by doing something much like Rails migrations. Providing access to the database through stored procedures basically is publishing business logic as a library. I'll admit pl/pgsql looks a little funky, but it doesn't seem too bad.

I'll note I'm not talking from experience here, I'm just speculating and hoping for somebody with more practical experience in the matter (or better insight) to enlighten me.

Re:Ask HN: Ridiculous Coding Practices by companies you have... by stcredzero on Thursday June 04, 2009 @06:50PM (#642396)
If it is "basically...publishing business logic as a library" then why incur the expense of using such a scheme? Just publish the darn library and put it on a read-only shared directory. Why give up the use of purpose built version control and programming tools? Why give up the modularity and increased productivity that a high level language can give you?

Most of the time, it's because the organization thinks in terms of SQL and relational tables. There are better ways to do business logic.

Re:Ask HN: Ridiculous Coding Practices by companies you have... by arghnoname on Friday June 05, 2009 @10:02AM (#643189)
As a language, it's pretty painful to use and you run into those limitations pretty quickly. You also put more processing in the database, which isn't great for scalability. It is nice being able to test changes via the sql prompt though. A library + console app might be a good compromise.