Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Exploring Active Record

ScuttleMonkey posted more than 8 years ago | from the language-midlife-crisis dept.

266

An anonymous reader writes "Everyone knows that no programming language is a perfect fit for every job. This article launches a 'new series by Bruce Tate that looks at ways other languages solve major problems and what those solutions mean to Java developers. He first explores Active Record, the persistence engine behind Ruby on Rails.'"

cancel ×

266 comments

Sorry! There are no comments related to the filter you selected.

In a comparison, Ruby suffers for one big reason (4, Insightful)

CRCulver (715279) | more than 8 years ago | (#14873133)

By looking at Active Record Java developers can be happy and thankful they have a language taking good advantage of Unicode, unlike Ruby which treats users of non-ASCII alphabets (the overwhelming majority of people on Earth) as second-class citizens thanks to poor Unicode support.

Re:In a comparison, Ruby suffers for one big reaso (4, Interesting)

syntaxglitch (889367) | more than 8 years ago | (#14873167)

Kind of ironic, really, given that Ruby actually comes from a country that uses a non-ASCII alphabet... well, not really an alphabet at all, actually.

Re:In a comparison, Ruby suffers for one big reaso (1)

John Pliskin (769478) | more than 8 years ago | (#14873194)

Canada?

$

Re:In a comparison, Ruby suffers for one big reaso (0)

Anonymous Coward | more than 8 years ago | (#14873273)

eh?

Re:In a comparison, Ruby suffers for one big reaso (1)

Trejkaz (615352) | more than 8 years ago | (#14873758)

Maybe it's okay with things like EUC-JP and SHIFT-JIS but not okay with Unicode... who knows, I've put off reading that part of the book for ages.

Re:In a comparison, Ruby suffers for one big reaso (1)

syntaxglitch (889367) | more than 8 years ago | (#14873786)

I'm pretty sure it does in fact use one of those sort of schemes, which have been in common use in Japan for much longer than Unicode has existed. I'm not certain though, as my grasp of Japanese is far too tenuous to worry about being able to type it. :)

Re:In a comparison, Ruby suffers for one big reaso (1)

Fweeky (41046) | more than 8 years ago | (#14873540)

The current engine's something like a decade old, so it's hardly surprising. Ruby 2 is supposed to greatly improve support for Unicode, along with just about everything else.

Re:In a comparison, Ruby suffers for one big reaso (1)

Trejkaz (615352) | more than 8 years ago | (#14873765)

Java though, treats people who want to use UTF-32 as second-class citizens. It's perverse too... we were all taught in University that Java supported Unicode, and then it was only in the real world where we discovered that it didn't support things like surrogate pairs. And don't try to tell me that 16 bits is enough bits to store every character you'll ever want to display or print.

Re:In a comparison, Ruby suffers for one big reaso (2, Informative)

LarsWestergren (9033) | more than 8 years ago | (#14873923)

Java though, treats people who want to use UTF-32 as second-class citizens.

Java has support for Unicode 4 since Java 5 [sun.com] , released september 2004.

Re:In a comparison, Ruby suffers for one big reaso (2, Interesting)

Sircus (16869) | more than 8 years ago | (#14873826)

I've recently been writing a project with Rails, using MySQL as the backend. Supporting UTF-8 has been no problem at all. UCS-2 support may well be lacking, but it's certainly not like you can't support people with non-ASCII alphabets.

Re:In a comparison, Ruby suffers for one big reaso (4, Interesting)

kahei (466208) | more than 8 years ago | (#14874185)


Yes, Ruby and it's author have an interesting attitude to string representation in general and Unicode in particular. It's partly what inspired me to write this:

Psychology of Unicode in Japan [jbrowse.com]

It's really been a very interesting struggle between people's psychological and I.T. needs -- a struggle that's pretty well over now, but has left behind things like Ruby's way of doing things.

Anyone else Railed-out? (4, Interesting)

lifeisgreat (947143) | more than 8 years ago | (#14873135)

Has anyone else played with Rails and been turned off?

I've volunteered to create a recipe-wiki-site-thing for a friend, and coming from a background in C and SQL there was just too steep a curve to map a procedural train of thought and pre-planned SQL onto the Rails way of doing things. I already created the database schema, wrote all the SQL to get the information I want, have a lot of HTML written for the general template, and was looking at abandoning much of it for controllers, models, automagic foreign key relationships, automagic methods popping out of thin air.. I wanted more control I guess.

So I've done most of the site in PHP instead. Direct, to the point, fast enough (though I'm thinking about a rewrite in C for a pure CGI/FastCGI binary), a minimum of automagic hand-holding - just start each page with sanity checking, authorization, the SQL the page needs and nothing more, and then format the output. No wondering how many hundred methods have been created that I don't know about, what happens when a record is deleted/updated (I'll let the database handle null/ignore/cascade thankyou) or whatever else Rails is doing behind my back.

I'm a C guy - I don't like things being done that I don't explicitly ask for. I want init() functions. I want implicit declarations. Heck I don't even like C++ for fogging-over-functionality with inheritance, virtual functions and overloading.

Ranting aside, I can see how Rails would mesh with a lot of people. But it's definitely not for me, and I guess (hope) a few other nutjobs around here.

Re:Anyone else Railed-out? (0)

MLopat (848735) | more than 8 years ago | (#14873156)

Well said. Its exactly these kind of programming models that lead to bloated and largely unmainatainable code. In my experience, these technologies are well suited to quick and dirty projects and the programmers that assume them. You can turn a working product out pretty quickly, but extending the functionality and debugging become anything but trivial tasks.

Guess that makes me a fellow nutjob.

Re:Anyone else Railed-out? (3, Insightful)

I Like Pudding (323363) | more than 8 years ago | (#14873203)

What sort of programming models? Frameworks? How in God's name does a framework reduce maintainability as compared to some C programmer's PHP spaghetti code?

Re:Anyone else Railed-out? (3, Insightful)

ziplux (261840) | more than 8 years ago | (#14873216)

Um...sorry, I have to disagree. Using a well-known framework makes a project anything but unmainatainable. Let's say a project is written with a framework, and the original developers no longer supports it, or he leaves your company, or whatever. At the very least there are many people out there with a basic understanding of the framework, and thus a basic understanding of the code. You can hire a Rails consultant and be fairly confident that he will be able to pick up where the old developer(s) left off. Try doing that with some custom framework (or, even worse with no framework at all). I know from personal exerience that it is very difficult to pick up a new framework; it can take weeks, and even after that it's not totally intuitive.

Furthermore, Rails promotes good coding and design habits. While you may not agree with Model-View-Controller (not sure why, but that's a personal choice I guess), at least Rails imposes some design pattern on the developer. Without this, an inexperienced developer will be able to write completely unmaintainable code.

Re:Anyone else Railed-out? (2, Insightful)

eyeye (653962) | more than 8 years ago | (#14873185)


So I've done most of the site in PHP instead... just start each page with sanity checking, authorization, the SQL the page needs

TBH It just sounds like you don't know what you are doing.

Re:Anyone else Railed-out? (1)

syntaxglitch (889367) | more than 8 years ago | (#14873187)

You must've really HATED ActiveRecord's pluralization thing. Heh.

Re:Anyone else Railed-out? (1)

I Like Pudding (323363) | more than 8 years ago | (#14873189)

Here is your problem: you don't hate Rails. What you hate are frameworks, architecture, and anything even remotely meta. PHP is perfect for you: just roll your own framework and persistance layer every goddamn time and make all the web devs cry. That you are even considering rewriting this in C speaks volumes.

Re:Anyone else Railed-out? (1)

lifeisgreat (947143) | more than 8 years ago | (#14873339)

What caliber web-devs are we talking about, where any sane persistence technique in a database-backed environment, or god-forbid a SQL query here and there, requires more than a trivial amount of time to comprehend? This isn't exactly challenging stuff as far as programming goes. It still amazes me just how much code people write for web apps these days. Most of my app's size and dev-time have gone to HTML templates, most of the mental effort went into the database and associated triggers/functions, and practically all the scripts do is make SQL queries presentable.

Re:Anyone else Railed-out? (1)

heinousjay (683506) | more than 8 years ago | (#14874548)

Well, sure, if all you do is treat the app like a window to a database, I guess you aren't really writing anything. Feel free to use whatever outdated technique you like.

The thing is, a lot of us out here in this field are writing actual applications that do a lot more than just select giant recordsets and format them. We need more than a hero coder who wants to do everything his way, because we aren't dealing with tiny little form-and-report one-offs that any monkey could write.

You, of course, don't have to believe this. Your argument already shows your propensity for thinking your use case is the only real one. Just ignore us, we'll be on our way forward while you sit in one place.

Re:Anyone else Railed-out? (1)

ziplux (261840) | more than 8 years ago | (#14873191)

lifeisgreat wrote: I already created the database schema, wrote all the SQL to get the information I want, have a lot of HTML written for the general template, and was looking at abandoning much of it for controllers, models, automagic foreign key relationships, automagic methods popping out of thin air.. I wanted more control I guess.

It sounds like you come from a background where you mix business logic, business objects, and presentation into the same file. I suggest that you take a step back and re-examine your design choices. Controllers, modules, and views aren't exclusive to Rails; you'll find them wherever a goood, sane, well-designed code lives. If your original system was designed with MVC in mind, moving it to Rails should have been easy.
lifeisgreat wrote: just start each page with sanity checking, authorization, the SQL the page needs and nothing more

What if you forget a single function call at the beginning of one of those pages? Do you suddenly allow objects to be populated with rogue data? Rails has things like filters that make sure certain methods get executed before all actions in a given controller.

Re:Anyone else Railed-out? (3, Insightful)

lifeisgreat (947143) | more than 8 years ago | (#14873245)

It sounds like you come from a background where you mix business logic, business objects, and presentation into the same file. I suggest that you take a step back and re-examine your design choices. Controllers, modules, and views aren't exclusive to Rails; you'll find them wherever a goood, sane, well-designed code lives.

A background of incompetence? Funnily enough when I picked up PHP, your disaster scenario was what most people seem to do without thinking about it. In my case, the MVC components are, respectively, PostgreSQL, HTML templates and PHP.

If your original system was designed with MVC in mind, moving it to Rails should have been easy.

I think you'll find that most Rails developers hold that it's much easier, cleaner and safer to start a project with Rails in hand, rather than graft Rails onto a pre-existing database.

What if you forget a single function call at the beginning of one of those pages? Do you suddenly allow objects to be populated with rogue data? Rails has things like filters that make sure certain methods get executed before all actions in a given controller.

Error checking and testing suites aren't impossible for a C developer to comprehend, you know.

Re:Anyone else Railed-out? (2, Insightful)

ziplux (261840) | more than 8 years ago | (#14873308)

In my case, the MVC components are, respectively, PostgreSQL, HTML templates and PHP.


If you wanted to, you could turn your HTML templates into RHTML (Ruby HTML). If you PHP really was just acting as a controller, it should be easy to re-write that in Rails, as it uses the same design pattern. As far as custom SQL, it's easy to keep that in Rails (although it's not really the "Rails way"); you can execute arbitrary SQL statements just like in PHP.

Ultimately, I think we all code in what we're comfortable with. To many programmers, Rails fits their mind well because of the MVC pattern used, and in general the way Rails handles everything.

However, I still think custom frameworks are the root of all evil for anything but the smallest projects. Do you, a single developer, really have the guts to say that your framework is better than something that has been developed by a core team of 15 over about 2 years? Do you really think that your framework is that great, that you're willing to have to train someone else to use it, when you could just leverage the work of the community? Creating a custom framework is, in all but the most obscure cases, a supreme act of selfishness.

Next think you know...you'll be rewriting everying. You, the uber code, know best! Heck, we can write it all in C! Just rewrite all the good stuff that you take for granted in PHP. Why use PHP's session handling when you can roll your own? Oh, right, there's a whole slew of security issues there and you're likely to fuck up some small detail and open up some nasty hole where one user can get to another's session. Etc, ad nauseam.

Re:Anyone else Railed-out? (1)

lifeisgreat (947143) | more than 8 years ago | (#14873390)

Ultimately, I think we all code in what we're comfortable with. To many programmers, Rails fits their mind well because of the MVC pattern used, and in general the way Rails handles everything.

A friend of mine is self-employed creating web pages for local businesses. I pointed him towards Rails (how he hadn't heard of it I'll never know) and he couldn't be happier. Also, since I've pretty much abandoned it as a platform I won't be who he calls for support! =)

However, I still think custom frameworks are the root of all evil for anything but the smallest projects. Do you, a single developer, really have the guts to say that your framework is better than something that has been developed by a core team of 15 over about 2 years? Do you really think that your framework is that great, that you're willing to have to train someone else to use it, when you could just leverage the work of the community? Creating a custom framework is, in all but the most obscure cases, a supreme act of selfishness.

Horses for courses. Should I start my site with an enterprise java framework just in case it needs to scale to 2,000,000 concurrent users? What if 90% of the visitors will be speaking a language that $framework has terrible support for? What if my framework is so popular it gets much more attention from hackers creating automated attacks?

Look I'm not against frameworks, it's just that when I design a project I go into it with specific goals, and more often than not the available free frameworks to support it (be it a web page, video codec or cd image converter) either are slow, bloated, buggy or just suck to use.

Next think you know...you'll be rewriting everying. You, the uber code, know best! Heck, we can write it all in C! Just rewrite all the good stuff that you take for granted in PHP. Why use PHP's session handling when you can roll your own? Oh, right, there's a whole slew of security issues there and you're likely to fuck up some small detail and open up some nasty hole where one user can get to another's session. Etc, ad nauseam.

PHP's session handling isn't exactly a bastion of coding glory to hold up. Look I appreciate your point, it's just that there are way more crappy frameworks out there than good ones. Not that I'm saying Rails is crappy, it's just not there for me and my personal coding style. Other crappy frameworks of note include wxWidgets, SDL, Allegro, MFC, GTK, DirectShow.. well you get the idea. Crappy code is often subjective, but ultimately rolling one's own framework is a cost-benefit equation that'll come out differently for everyone. Once you involve multiple people in a coding exercise, that equation begins to quickly swing in favor of a pre-existing solution, often regardless of how crappy it happens to be.

Re:Anyone else Railed-out? (2, Funny)

LuminaireX (949185) | more than 8 years ago | (#14873304)

What if you forget a single function call at the beginning of one of those pages? If its like any other programming error, I go back and fix it

Re:Anyone else Railed-out? (0)

Anonymous Coward | more than 8 years ago | (#14873195)

If you make a simple recipe-wiki-site-thing in C I will personally come to your house and shoot you :-)

Why not make it in x86-assembler while you're at it. Hell, make your own web-server running on a custom made OS.

A site like that is perfect for dynamic languages like PHP,Ruby,Python etc.

Re:Anyone else Railed-out? (1)

lifeisgreat (947143) | more than 8 years ago | (#14873251)

He wants it ready to explode into a hugely popular money-making machine, so I'm at least planning for the possibility.

And if you've designed your site engine and presentation well, there's an astonishingly small difference between PHP querying a database and formatting a HTML template with the output, and C querying a database and formatting a HTML template with the output. Apart from speed of course.

Re:Anyone else Railed-out? (3, Insightful)

soundofthemoon (623369) | more than 8 years ago | (#14873213)

If you don't like it, don't use it. Like every other tool/framework/system ever developed, Rails will work for some and not for others. I've found Rails to be extremely productive and maintainable, but I'm an OOP die-hard and the approach is easy for me to grok.

One thing I like about ActiveRecord is that it is database agnostic. If I need to, I can move my app from MySQL to Postgres to Oracle with very little effort. The other thing I like is that it provides a clean separation between data storage and business logic. Database programmers seem to hate that approach because it shifts the center of gravity away from the database and toward the web app. This is great for maintainability of application code, but I don't know how well it works for sharing data among multiple apps. I don't know if anyone has gotten ActiveRecord models to support the same level of integration as you can get with multiple apps running off of one database - I think there needs to be more work done to enable that, but I expect to see that work done fairly soon.

The other cool thing about ActiveRecord is the use of metaprogramming, as discussed in the FA. I don't think we'll ever see a Java persistence layer that is as functional and easy to use as ActiveRecord, because the kind of metaprogramming tricks that Ruby enables are so much harder to do in Java.

Re:Anyone else Railed-out? (2, Insightful)

lifeisgreat (947143) | more than 8 years ago | (#14873292)

One thing I like about ActiveRecord is that it is database agnostic. If I need to, I can move my app from MySQL to Postgres to Oracle with very little effort.

That's all well and good, for a subset of database functionality. ActiveRecord reminds me of wxWidgets - smoke and mirrors, bloat and lowest common denominator functionality. But don't get me wrong, for a great many jobs it's adequate and there for the taking.

The other thing I like is that it provides a clean separation between data storage and business logic.

That's really just a matter of the intelligence/discipline of the developer. Inexperience can mitigate the benefits of any technology, and believe me I've seen code to prove it.

Re:Anyone else Railed-out? (4, Insightful)

shmlco (594907) | more than 8 years ago | (#14873660)

"Inexperience can mitigate the benefits of any technology..."

Inexperience and ignorance. And it sounds as if it applies to you and to this situation. I don't see how you can rant against "bloated" technologies you never bothered to learn. Without that knowledge, you don't understand everything that's happening behind the scenes and, since that scares you, you stick with the subset of the developmentatl universe you do know, no matter how appropriate, or inappropriate, it may be to the problem at hand.

I strongly suspect that once you've moved on to other victims, the next developer the guy hires will take one look at your carefully-crafted optimum solution, shudder, and then rewrite the whole thing.

Re:Anyone else Railed-out? (1)

MemoryDragon (544441) | more than 8 years ago | (#14874387)

Well the JPA simplifies to a big degree the mapping instead of having a class and a xml descriptor describing every field you normally have @Entity public class Table { @Id Integer id; .... so things have become easier, but there are certain limitations of course

you have the java inherent setters and getters, which blow up your code (although the usually are generated, no one normally codes them by hand

something like a query over a method is not possible you still have to go over the persistence api

the apis persist, lock, save, update hell was carried over straight from hibernate, but persist and merge ease things to a certain degree, thank god.

In the end rails has caused a lot of momentum im the java world, there are several interesting projects going on, Seam, Trains, FacesFreeway, they all try to follow the rails approach of trying to simplyfy as much as possible. And thank god Struts is out of the game in all these approaches due to the fact that scaffolding needs a component tree!

Re:Anyone else Railed-out? (2, Informative)

Dante Shamest (813622) | more than 8 years ago | (#14873239)

I want init() functions.

90% of the time, when you call an init() function, you're going to call a free() function too. Let C++ do the grunt work for you. Use the RAII pattern [hackcraft.net] .

Put your init() code in the constructor and your free() code in the destructor. That way you won't forget to call free().

Heck I don't even like C++ for fogging-over-functionality with inheritance, virtual functions and overloading.

You don't have to use those C++ features if you don't want to. You can program in C-style in C++ if you wish. virtual and inheritance are optional. These days templates do most of what inheritance and virtual functions can do. And I don't understand why you would dislike overloading. Aren't you tired of thinking up names for functions that do the same thing, but just take different number of arguments?

Re:Anyone else Railed-out? (1)

k2r (255754) | more than 8 years ago | (#14873326)

> sanity checking, authorization, the SQL the page needs and nothing more,

Don't repeat yourself:
http://c2.com/cgi/wiki?DontRepeatYourself [c2.com]

k2r

Re:Anyone else Railed-out? (1)

slashbart (316113) | more than 8 years ago | (#14873378)

Yep, I did

I was very enthusiastic at first, but after a few days that went away. The render_partial stuff can lead to very hard to track bugs, where you're not sure what object you're in. I've had one bug where I literally put a debug statement on every line of a partial template function in order to find out what went wrong. It turned out that I'd forgotten two (), and was now instantiating a variable instead off accessing the setter function. Which leads me to a problem I have with Ruby: the fact that function calls do not need (). Syntactically this is confusing.
Ok, I was a Ruby newbie, but I'm a very experienced programmer, using currently C, C++, Tcl, Python, Java, PHP, Awk, and some others.
This automagic stuff of Rails might seem nice, but i'd hate to use it on a larger project; the lack of visibility of which functions exist will lead to major problems.

Bart

Re:Anyone else Railed-out? (1, Informative)

Anonymous Coward | more than 8 years ago | (#14873845)

I'm not a Rails expert, but Ruby is one of the few languages that has a built-in complete line-by-line trace mode.

ruby -rtracer myprogram.rb

See here [cozmixng.org] for instructions.

This prints a complete line-by-line trace of the execution of your program. You can use this to work out exactly what paths were taken by the code (I can imagine it would be very big for rails, but grep is your friend :)

Re:Anyone else Railed-out? (4, Insightful)

JulesLt (909417) | more than 8 years ago | (#14873438)

Which bit is causing you the problem - Ruby or Rails? My understanding is that Rails is simply providing, well, Rails to give you a rapid framework for your Ruby app - provides you with a web page that's a 'default form' along with the related MVC code. It's similar to other frameworks that provide default pages from ORM mapped classes in other languages, but I thought it was Ruby, rather than Rails, that was getting people excited.

I'm an 'SQL' guy myself and I'm not convinced by ORM tools - or at least the way they're being hyped as a solution for having to understand the DB (Newsflash : SQL is supposed to be an abstract query language so that the developer doesn't need to understand the DB - and look how that worked - answer : Mostly it does, but when it goes wrong you're dealing with a black box). I also think that the view of many Java (and Ruby) developers that a DB provides 'persistence' is wrong. It's a failure to understand relational theory - which at least, unlike most object modelling techniques, has a firm mathematical foundation. It's also a failure to use the tools provided to you (and when Bruce Tate complains about Java productivity, this tendency of Java developers might be part of the problem - it's 'not invented here' syndrome).

You could have used Ruby rather than PHP (a comparison I'd like to see) and I also think that there is much to be said for the MVC structure compared to shoving everything into each page.

It feels a bit clunky in the current paradigm (pages generated on the server and refreshed to the client, client events sent to server) but it works very well as a design, and I can see it becoming more important again as browser apps support more dynamic features - getting back more towards a client-server architecture with the model on the server, view on the client. (Or more likely a local model for performance and some form of background syncing).
 

Re:Anyone else Railed-out? (1)

LarsWestergren (9033) | more than 8 years ago | (#14873487)

Has anyone else played with Rails and been turned off?

I've seen one or two... here [slashdot.org] for instance. I've yet to try it myself, but I'm looking forward to it... when things have calmed down a bit on my current project. I've been a bit turned off by the constant one-sided evangelizing by some of the enthusiasts though.

Re:Anyone else Railed-out? (0)

Anonymous Coward | more than 8 years ago | (#14873757)

I'm turned off by the fact that development in Rails is like a gimpy version of development in Lisp. I am, however, glad that people are starting to figure shit out almost half a century later.

Now, maybe, we can start making some progress :).

Re:Anyone else Railed-out? (1)

LarsWestergren (9033) | more than 8 years ago | (#14874079)

I'm turned off by the fact that development in Rails is like a gimpy version of development in Lisp. I

Hehe... yes, speaking of fanatic evangelists, no one has even gotten close to beat the Lisp people. I don't know, maybe it is a FANTASTIC language. it is just... all this smug superiority pisses me off. :-)

Re:Anyone else Railed-out? (4, Insightful)

ubernostrum (219442) | more than 8 years ago | (#14873661)

I've volunteered to create a recipe-wiki-site-thing for a friend, and coming from a background in C and SQL there was just too steep a curve to map a procedural train of thought and pre-planned SQL onto the Rails way of doing things. I already created the database schema, wrote all the SQL to get the information I want, have a lot of HTML written for the general template, and was looking at abandoning much of it for controllers, models, automagic foreign key relationships, automagic methods popping out of thin air.. I wanted more control I guess.

So... you basically wrote the application (minus the controller), and then started thinking about using a different platform? Is it any surprise that you didn't want to switch over to Rails (disclaimer: I'm not a Rails guy. In fact, I work for the competition [djangoproject.com] )?

So I've done most of the site in PHP instead. Direct, to the point, fast enough (though I'm thinking about a rewrite in C for a pure CGI/FastCGI binary), a minimum of automagic hand-holding - just start each page with sanity checking, authorization, the SQL the page needs and nothing more, and then format the output. No wondering how many hundred methods have been created that I don't know about, what happens when a record is deleted/updated (I'll let the database handle null/ignore/cascade thankyou) or whatever else Rails is doing behind my back.

OK. It's not like somebody's holding a gun to your head and saying you have to use a framework. Personally, I see a lot of use cases where a framework makes development a lot simpler and easier to manage, because so much of the tedious overhead of web-app development has already been done for you. Think of the framework in terms of an operating system you're programming for: rather than writing all your own device drivers, routines for drawing stuff on the screen, accepting keyboard/mouse input, etc., you've let someone else solve those problems and you're just using the provided APIs to hook up the logic that's unique to your application. And with a framework, rather than write database drivers, routines for accepting and routing input, etc., you've let someone else solve those problems and you're just using the provided APIs to hook up the logic that's unique to your application. Using a web framework is no different, really, than using any other shared library.

As for all the cruft you complain about, when was the last time you used every single bit of functionality provided by a shared library you linked a C application against? Or is it only bad to draw in automagical functions you won't use when the application isn't being compiled? ;)

Re:Anyone else Railed-out? (2, Insightful)

oldCoder (172195) | more than 8 years ago | (#14873863)

Rails is still suffering growing pains. After that is over, it will have the problems of maturity. Rails has a lot of good ideas, and leveraging Ruby is one of them. But Rails is not well documented. It's almost as if the Rails devlopers have never seen really professional documentation and are happy to just look at the Rails source for information. For example, the API docs don't have a search box.

I think Ruby and Rails are about the right ideas for our current and near future environment -- cheap cpu's, tight schedules, evolving web standards, clueless users, heterogeneous client hardware (browsers and pda's) and ever faster networks.

And, by the way, the current Ruby implementation is not quite as mature as the current Perl or even Java implementations. This will change. The sweet spot for using Rails isn't today, it's the next 5 years or so. So now would be a good time to get the experience.

Not to knock PHP, it lets just anybody put together a dynamic web site without having to know too much. It's a straightforward system ideal for power users who don't want to be computer scientists but who need to build out their ideas. I have a neighbor who's expertise is in marketing and home products who is building his own product line with PHP. Ruby would be beyond him. Who knows, he might just strike it rich with PHP.

Re:Anyone else Railed-out? (1)

yokem_55 (575428) | more than 8 years ago | (#14874175)

As for rails documentation, the freely available stuff is widely disbursed, and disorganized. The real thing is the Agile Web Development with Rails book by Dave Thomas and DHH, of which the pdf version can be purchased for ~$22USD. The book is excellent, and provides a fairly comprehensive overview of rails development, but I can't help but wonder if the utter lack of comprehensive, good, free, docs isn't the result of the sales push for this book. Granted, this is an open source project--go set up a docs wiki and go nuts.

Re:Anyone else Railed-out? (1)

vhogemann (797994) | more than 8 years ago | (#14873992)

So, you like to re-invent the weel.

Thats ok, sometimes I like to thinker too and understand how things work at the core level, but when you do that you waste too many time doing things that already has been made, and thats not cool when youre working serious project.

Rails is about speed, is about getting your job done in less time, with less effort.

Wrong Mentality (4, Interesting)

MLopat (848735) | more than 8 years ago | (#14873137)

People, and usually not developers, are still caught up in the idea of a programming language instead of the concept of applying an API or SDK to a task. My favorite example of this is the often held C++, C#, Visual Basic debate -- everyone has their syntax preference, but at the end of the day its the paradigm you apply that matters and not the language.

A politician giving an address in German instead of French is not more effective as his points will still remain the same. The language isn't the tool, the intention is the tool.

Re:Wrong Mentality (1)

shutdown -p now (807394) | more than 8 years ago | (#14873207)

You are right to an extent, but ignoring the language issue entirely is also not a good idea. While syntactical differences are hardly important, semantics of the language can change a lot of things for the better (or worse), and strongly shape the 'paradigm' (compare e.g. JSP to SISCweb).

And yes, language is a tool, actually. So is an SDK or a framework. So choose your tools wisely.

Re:Wrong Mentality (0)

Anonymous Coward | more than 8 years ago | (#14873280)

Bullshit. The problem is languages that restrict you so far as not to be able to solve a problem elegantly. Thus comparing C++ to C# and Visual Basic just shows how moronic your point is.

Re:Wrong Mentality (0, Flamebait)

ceeam (39911) | more than 8 years ago | (#14873340)

The language is the tool, sorry. Delphi is more powerful (tool) than VB. Python is more powerful (tool) than Java, etc. No matter what PHBs think.

Re:Wrong Mentality (0)

Anonymous Coward | more than 8 years ago | (#14873353)

why the hell was this modded interesting?

language matters a great deal (4, Insightful)

idlake (850372) | more than 8 years ago | (#14873370)

everyone has their syntax preference, but at the end of the day its the paradigm you apply that matters and not the language.

The differences between C++, C#, and VisualBasic are far deeper than syntactic. C#, for example, guarantees fault isolation, while C++ does not. C# has full reflection, while C++ does not. Programmer productivity in different languages can be orders of magnitude different.

Of course, most working programmers have the same superficial view of programming languages as you do and will make the same glib and ill-informed analogies to natural languages that you did. That's why people keep choosing C and C++, believing the differences to other languages to be merely syntactic, and then producing code that crashes, silently mangles data, and has gaping security holes.

Fortunately, the herd mentality is driving even people who don't know what they are doing away from C/C++. Even your own company bills itself as a .NET development house. You may not understand why C# is better for you than C++, your productivity may not increase, but the fact that you have switched means that your software will ultimately still cause fewer problems.

Re:language matters a great deal (2, Insightful)

NitsujTPU (19263) | more than 8 years ago | (#14873400)

Ask developers at Microsoft if they developed Vista in 100% C# before taking that perspective young man, you might be surprised at the response that you get.

Re:language matters a great deal (3, Interesting)

idlake (850372) | more than 8 years ago | (#14873993)

Ask developers at Microsoft if they developed Vista in 100% C# before taking that perspective young man, you might be surprised at the response that you get.

Thank you for illustrating my point.

Microsoft has, in fact, hired many of the top language designers of the world because they think languages matter.

Microsoft has been pushing hard for a move to managed runtimes.

And Microsoft's severe problems with their previous C/C++ efforts are the reason for that.

So, lots of people at Microsoft have come to the conclusion that languages matter a great deal, and that's why they are investing probably hundreds of millions of dollars in that.

Re:Wrong Mentality (1)

NitsujTPU (19263) | more than 8 years ago | (#14873385)

That debate only really seems at all applicable in Windows, however, I should point out that those languages are very different animals. C++ is not only syntactically different, and semantically different, but its capabilities are actually different. C++ has no garbage collector, C# does, for instance, unless you're talking about managed C++, and things of that nature.

See... it's not JUST language, though it doesn't play as major a role as people like to think.

rails (1)

prockcore (543967) | more than 8 years ago | (#14873141)

I like rails, but the poor apache integration sucks.

But ActiveRecord is awesome. Most of us build databases that work like objects already.. so an object oriented interface to your database is very easy to use and maintain.

Re:rails (3, Funny)

syntaxglitch (889367) | more than 8 years ago | (#14873172)

Meanwhile, people who actually understand the value of and principles underlying relational databases grit their teeth and fight the urge to beat people with blunt objects.

Not me, though. I never "got" relational database theory and am quite content to give people nightmares with my naive object-biased approach. :)

Re:rails (1)

ziplux (261840) | more than 8 years ago | (#14873224)

the poor apache integration sucks.


Can you elaborate on this? What is so poor about using FastCGI? It works really well on my server. Just because it's different than standard Perl or PHP CGI does not make it "poor" integration.

Re:rails (1)

chrysalis (50680) | more than 8 years ago | (#14873271)

Well, Apache integration doesn't suck, you just have to spawn Ruby through the FastCGI interface. And it's definitely worth it, even for PHP, using FastCGI is really not a bad idea.

RoR also perfectly works with Lighttpd and unless you absolutely have to use Apache, you should have a look at it. Its lightweight, modular and speedy. Since I migrated from Apache, I never looked back.

Uhhh.... (4, Funny)

wbren (682133) | more than 8 years ago | (#14873175)

Everyone knows that no programming language is a perfect fit for every job.

I program in raw machine code. It's a perfect fit for every job, every time!

Re:Uhhh.... (2, Insightful)

wanorris (473323) | more than 8 years ago | (#14873198)


I program in raw machine code. It's a perfect fit for every job, every time!


How's client-side web page scripting working out for you?

Re:Uhhh.... (5, Funny)

Ziviyr (95582) | more than 8 years ago | (#14873302)

I guess the answer for that is "works great on IE!"

Re:Uhhh.... (1)

MindKata (957167) | more than 8 years ago | (#14873232)

"I program in raw machine code. It's a perfect fit for every job, every time!"

And how is that "Hello World" Operating System coming along ;)

Re:Uhhh.... (2, Funny)

A beautiful mind (821714) | more than 8 years ago | (#14873281)

Bah, that's nothing! The first rule of starting a programming project:

Get five tons of sand and then...

Until.. (0)

Anonymous Coward | more than 8 years ago | (#14873282)

You want to port it to the embedded 6502 in your special elite gizmo device.

Still looking for an IDE (3, Funny)

bogaboga (793279) | more than 8 years ago | (#14873186)

I am still looking for a Ruby IDE on either Linux or Windows. May be I am looking for what does not esist, but my sense of an IDE is something like Access/VB for Microsoft's Jet Database Engine.

Here, we simply drag and drop then program the logic behind all those widgets we've dragged onto the form. I also looked for something in relation to Python but could not find anything! I taught VB myself using this method. Current IDEs I have looked at make things confusing. Am I looking for what does not exist? Hope not!

Re:Still looking for an IDE (3, Informative)

lifeisgreat (947143) | more than 8 years ago | (#14873219)

Try RadRails [radrails.org] - it's the best Rails-specific IDE I found during my brief searching. I noticed a few bugs, but at least it's still being developed.

Re:Still looking for an IDE (4, Funny)

k2r (255754) | more than 8 years ago | (#14873314)

> Here, we simply drag and drop then program the logic behind all those widgets
> I taught VB myself using this method.
> Current IDEs I have looked at make things confusing.

Nothing personal but: This explains much of the VB code I had the misfortune to see in my life.

k2r

Re:Still looking for an IDE (1, Insightful)

Anonymous Coward | more than 8 years ago | (#14873356)

If you've got the time, you might want to try to learn how to really code instead of looking for a better crutch...

Re:Still looking for an IDE (1)

killjoe (766577) | more than 8 years ago | (#14873366)

What you have done leads to unmaintable code. Since the greatest part of the software development lifecycle is the debugging, maintaining, and refactoring part using VB actually is a drain on the productivity of your team when you measure the entire lifecycle of your application.

Sure it only takes a day to slap controls in a form and bind some controls to a SQL statement but good luck trying to find a bug or refactor when you decide to change a field name.

OK... how SHOULD it be done then? (1)

meringuoid (568297) | more than 8 years ago | (#14874546)

I do a lot of quick-hack Access / VBA stuff at work. Usually I start by designing the tables, relationships, queries, reports etc, and then put together a GUI afterwards. I prefer to keep as much code as possible in separate modules rather than in the form itself - mainly because I forget the stuff's there otherwise, and you wind up with fossil code left behind from long-since deleted controls - but the grandparent sounds like he's doing similar things.

Apart from its inherent inadequacies compared to 'real' databases, what's the big disaster area about Access? What do people do horribly wrong, and what's the wonderfully better approach?

Now, more buzzword-friendly? (0, Flamebait)

Animats (122034) | more than 8 years ago | (#14873193)

"Active Record", I gather, is some kind of database wrapper. That's useful, but it's not a breakthrough. I've done similar things in Perl; one of them drives Downside's [downside.com] financial statement extractor. Admittedly, object-oriented Perl 5 is textually clunky, but adequate.

This "let's use all-new terminology and claim we have something new" stuff is annoying. Especially for what are, really, rather minor improvements.

Re:Now, more buzzword-friendly? (1)

wanorris (473323) | more than 8 years ago | (#14873231)

Active Record is just the name of the persistence layer used in Rails, not some attempt to call persistence a new technology.

I don't want to start a language war, because there are a lot of things that Perl is very good at. But I've done medium-scale application development in object-oriented Perl, and I came away from the experience convinced that object-oriented Perl just doesn't work very well above a certain scale -- very few of the things that make it easy to abstract things and work with multiple developers on a common project are there. As always, YMMV based on particular circumstances.

Ruby's syntax is similar to Perl for a number of areas, but the object orientation is a lot cleaner. Neither Ruby the language nor Rails the framework is perfect, but it can be a very productive toolkit for MVC web applications.

Re:Now, more buzzword-friendly? (2, Informative)

ziplux (261840) | more than 8 years ago | (#14873241)

An object-relation mapping (ORM) that "just works" and uses reflection on the database to produce business objects without the developer writing more than 3 lines of code is anything but a minor improvement. ActiveRecord is also more than an ORM. It allows developers to declare that an object "acts as a list," which then allows the object to be sorted in an array. There are many other such "meta-programming" constructs in ActiveRecord.

It also gives you a lot of stuff for free; migrations from one database schema to another, for example, are wrapped in ActiveRecord calls and are thus database-agnostic. You don't have to worry about packaging one SQL update file for MySQL and another for Postgres and another for MS SQL. The console is really cool too...it allows you to interactively play with your objects. You can even run it in 'sandbox' mode, so that all of your changes are rolled back when you're done playing.

Re:Now, more buzzword-friendly? (0, Flamebait)

badmammajamma (171260) | more than 8 years ago | (#14873289)

Cool, and how well does Active Record's cache work in a clustered environment? Oh, nevermind...AR doesn't support database caching and lets not even get started on clusters. N+1 got you down? lol...sorry but this crap is so amatuer hour I don't know where to start. I can't wait for Rails enthusiasts to get their heads out of their asses. Have fun with your new toy!

Seriously, this tool existed a long time ago...it's called Microsoft Access. Access is better though. You can do drag and drop for your screens.

Re:Now, more buzzword-friendly? (1)

Trigulus (781481) | more than 8 years ago | (#14873646)

whats the matter.. you couldnt understand RoR? Your statement about access is so far off base that I doubt you have ever read more than crappy slashdot posts about it. you have fud packed so far up your ass its coming out of your mouth.

Re:Now, more buzzword-friendly? (1)

16K Ram Pack (690082) | more than 8 years ago | (#14874240)

Actually, the poster is right.

I worked on mainframe 4GL systems nearly 20 years ago that could do screen to record mapping. Likewise, MS Access has had the same functionality for a long time.

The point is that ActiveRecord type technology is nothing new, nothing revolutionary. It's also very seductive, until you actually start using it for real, and find that in a lot of environments you don't simply do a table read/table update for a lot of applications. You often need to take a view of data across many tables, or do updates that are more complex.

Re:Now, more buzzword-friendly? (1)

I Like Pudding (323363) | more than 8 years ago | (#14873274)

You haven't the slightest idea what you are talking about. It said right in the article it was an ORM - you're acting like it was hiding this fact in order to hype it up. I guess we have reached the pinnacle of ORM design, anyhow, because Animats already wrote something similar in Perl. Have you ever used ActiveRecord? I have; it's quite an interesting ORM, unlike others I have used before due to the heavy reliance on polymorphic method naming.

Really, did you even read the article?

Re:Now, more buzzword-friendly? (1)

scottyboy (116119) | more than 8 years ago | (#14873440)

I think that you're missing the point. There's more to ActiveRecord than just DB wrapping: It's Ruby's strengths of reflection and meta-programming, and being able to dynamically add methods and properties to objects at runtime that allow ActiveRecord to really fly, and that is why people get excited about it. Sure you can still do these things in Perl, but it's more painful.

Re:Now, more buzzword-friendly? (3, Insightful)

thrills33ker (740062) | more than 8 years ago | (#14873743)

Oh, get over it. Does this have to happen any time anything developed less than 10 years ago is mentioned on slashdot? Ruby on Rails being the current favourite example. Here is how it goes every time...

Article: "here is a link to an interesting review of (insert technology here)".

Random guru: "That's nothing! I wrote something similar myself 6 years ago using perl/punchcards/blood from my own hand!"

Elitist Java developer: "Hahaha! You amateurs! How does your pathetic toy deal with redundant HA database clusters in a real-time mission-critical enterprise environment with a 5-nines uptime guarantee? Come back when you've grown up!!"

And so on. Personally, I'm a big fan of Ruby on Rails. I'm rather bored of seeing it compared to Java, a language I have never used. I moved to RoR from PHP, and let me tell you, its like a breath of fresh air. Yes, I could develop the exact same websites using PHP, but it involves writing a lot more code. Aren't computers supposed to do mundane work for us? Why make life difficult for yourself - I'm interested in results, not in worrying about whether I've escaped my SQL queries correctly using some function I had to write myself because PHP can't even do that properly.

Bottom line - RoR means better sites with less work. And that means more time to concentrate on making sites better for users, which is really what its all about.

My favourite (2, Insightful)

Trejkaz (615352) | more than 8 years ago | (#14873790)

"Hahaha! You amateurs! How does your pathetic toy deal with redundant HA database clusters in a real-time mission-critical enterprise environment with a 5-nines uptime guarantee? Come back when you've grown up!!"

Rails is scalable, but not in an interesting fashion at all. You want more processing power, you run more instances. Where's the fun in that? I love it in Java land, where creating something scalable inevitably means exciting things like building a single JVM that runs on multiple machines, or wrapping things in five layers of EJB so that they can work across multiple machines.

Re:My favourite (1)

LarsWestergren (9033) | more than 8 years ago | (#14874155)

I love it in Java land, where creating something scalable inevitably means exciting things like building a single JVM that runs on multiple machines, or wrapping things in five layers of EJB so that they can work across multiple machines.

No, it doesn't inevitably mean that. You can make an application more scalable by moving from threads and blocking sockets to non-blocking IO channels for instance. What you are talking about is clustering. Those are two possible approaches with Java, but there are plenty more.

ActiveRecord for the New Developer (1, Informative)

Anonymous Coward | more than 8 years ago | (#14873371)

I have to give a shout-out to Ruby on Rails and database handling - specifically for the new developer. I've seen clients of mine (whom I consult and help deploy Rails apps) new to OO latch on to ActiveRecord very quickly, and the rapidly growing support (and marketing!) for the Rails community is promising for its long-term success.

Kudos to Yukihiro, David, Dave, Thomas, and the hundreds of others who have put together Ruby and the Rails framework to help developers grow the Web 2.0.

~William
www.RailsHosting.org [railshosting.org]

Re:ActiveRecord for the New Developer (0)

Anonymous Coward | more than 8 years ago | (#14874491)

Long as we're on the subject of randomly linking things in a promotional manner, I have to counter your Web 2.0 mention with a dash of http://fuckweb2.com [fuckweb2.com] .

No kayaking for once! (3, Funny)

LarsWestergren (9033) | more than 8 years ago | (#14873399)

I'm amazed, a whole article by Bruce and not a single anecdote about kayaking. His writing is improving. :-)

Really a time saver (4, Interesting)

pmontra (738736) | more than 8 years ago | (#14873446)

I recently wrote two applications that included a registration form, validation checks, sending email with a URL to click to confirm the registration and finalizing the registration.
I wrote the first one in Java and the second one with Ruby On Rails, to learn the language and experiment with the framework. The Rails application needed half as much time to be coded than the Java one, despite being totally new to Ruby and to Rails.
The merit goes almost entirely to ActiveRecord and expecially to the validation feature.
Another time saver is Ruby's being interpreted instead of compiled. That saves a few time at every change to the code, even if strong type checking at compile time would have occasionally saved me a lot of time. It's difficult to assess if I gained or lost time.
What I'm looking forward to now is a good ActiveRecord implementation for Java because Rails is great but Ruby's syntax is really appalling. Even Perl (admittedly one of my languages of choice) looks more consistent. On the other side, halving development time is something that tempts me a lot. Java on Rails would be great.

Re:Really a time saver (1)

supersnail (106701) | more than 8 years ago | (#14873593)

This would be possable in theory.

But your talking java programers here. Look at what the java community has come up with to solve the same problem -- JSP, plus struts, plus JDBC
but that proved inadequate so they stacked the whole mighty ediface of J2EE
on top of it.

That the Java communuty could come up with a simple clean usable
solution for anything is no longe feasable.

If you want to see a Java programmer self-combust just set the following
simple task:
"Define 'bloat' in less than 9000 words".

   

Re:Really a time saver (1)

MemoryDragon (544441) | more than 8 years ago | (#14874070)

something like Seam? took me around 20 lines of application code to develop a simple blogger with master detail view...

Rails rocks (but isn't a silver bullet) (5, Informative)

PetriWessman (584648) | more than 8 years ago | (#14873500)

I've been playing around with Rails and AR quite a bit lately, and it has changed the way I think about programming in many (positive) ways. I come from a heavy Java / J2EE background (do that for a living, serverside systems), and Ruby + Rails is a breath of fresh air. Ruby is simply a wonderful language, there is something very "zen" about it, and Rails is inspired. Sure, it builds on a lot of old concepts, but the brilliance is where it leverages the power of the Ruby language to do things in very efficient and nice ways.

Yes, there is a lot of "black automagic" involved in Rails. It's where the power is, and you can override pretty much everything is you want to. If you're uncomfortable with magic stuff happening behind the scenes and don't want to learn Ruby so you really understand that magic, Rails might not be for you.

I'd claim that pretty much every serious programmer (VB scripters don't count :) should learn Ruby, at least the basics. It might not become your new favorite language (like it has for me), but it will give you a fresh new perspective on how to code stuff.

Ruby does have a few downsides:

  • There is no Unicode support. For a language coming from Japan that's surprising (and sucks). I'm given to understand that fixing this is in the roadmap for Ruby(?).
  • It's an interpreted language (like Perl, Python etc), so if speed really is an issue for you then it's not a good choice (for most things nowadays, Ruby is more than fast enough)
  • The scoping of variables in blocks is a bit funky.
  • Some of the organization in the standard libraries is a bit weird, and there is some repetition of functionality. I think this is due to historical reasons (std lib code has evolved over the years)

(there are probably more, but I'm still only learning the language)

As for Rails, well, again there are downsides. Nothing is perfect.

  • No Unicode support (inherits Ruby weakness). For web apps, this really sucks.
  • Poor localization support in general (again, sucks).
  • ActiveRecord is nice, but works best for from-the-ground-up projects. Integrating with a legacy schema might get ugly, a mapping layer (like Java's Hibernate) would work better there.
  • No support for clustering and other heavy-lifting technologies. If you're building a seriously big app, Rails might not be the optimal choice. But face it, 99% of web apps don't need stuff like that. Right tool for the job, and all that
  • Still a young framework, and evolving. This is both good and bad. Bad, since the framework is changing while you code. Good, since it means that bugs (and maybe the above weaknesses, too) are getting fixed.

So: it's not a silver bullet. Nothing is. But for a large majority of the modern-day web app use cases, it's very nice, productive and, well, elegant. It lets you to do quick prototypes and keep your code clean, you don't end up with the insecure and ugly mess most PHP apps end up being.

Re:Rails rocks (but isn't a silver bullet) (1)

Peter Cooper (660482) | more than 8 years ago | (#14874250)

The lack of Unicode support isn't such a major deal. Most applications developed in Rails just push information around from database to user and vice versa without needing to 'do' much with it. Unicode will 'go through' a Rails application just fine. It's not as if your non ASCII text will suddenly disappear or get changed (unless your logic sets out to do this).

Re:Rails rocks (but isn't a silver bullet) (1)

MemoryDragon (544441) | more than 8 years ago | (#14874274)

Well rails is a very good framework + toolset, but like every other enforcing toolset which tries to cover a lot of ground by automating stuff it has a huge problem, follow the road and you are set, if you cannot follow the road you are screwed. That is pretty much the problem with all toolsets which give you a lot of expert automation. A perfect example for this in the java world is maven, an excellent tool, but even the maven documentation says, use the structures provided by maven otherwise you will have a rough ride. In the end you always will have to make a decision between verbosity (which general solutions usually have and only can be covered to some degree by a language for framework) and automatisation which means enforcing a certain road to follow and if you find out that the road does not work for you once the application is finished to 70% you really have a problem on your hands. And thus a framework like Rails, or Seam, Trails or Seaside you name it, always has to be cleanly evaluated if you can apply it, there is no hammer for all, and things which might work for small stuff might become desastrous once things become bigger, customer demands rise and the team becomes bigger.

Re:Rails rocks (but isn't a silver bullet) (3, Informative)

consumer (9588) | more than 8 years ago | (#14874420)

I don't know about Python, but Perl and more recent versions of PHP are not interpreted. They are compiled to opcodes and then the opcodes are executed. With a persistent environment like mod_perl, you are always running the compiled code after the inital load. Both of them have much better base language performance than Ruby does at this point. I expect that Ruby will eventually work this way too.

Java is not the perfect language for every problem (1)

wysiwia (932559) | more than 8 years ago | (#14873594)

What a revolutionary insight of a Java-follower! Congratulation, when looking at all these language flamewars, its extra ordinary that anybody can mention this and even be published by a company which bases their SW business on Java.

I'd like to give Bruce Tate or IBM some tips in which direction they might venture to get more insight:

- Web-Clients: HTML + Javascript with the Dojo toolkit (http://dojotoolkit.org/ [dojotoolkit.org] )
- Web-Servers: PHP/Perl/Ruby/..., whatever you like
- Binary applications: C++ with the wxWidgets framework (http://www.wxwidgets.org/ [wxwidgets.org] )
- Database: SQL with ... (not enough knowlegde to make recommendations)

There are probably many more areas with recomendations but not from me, so just add your own. But think there isn't a perfect language for everthing so it should be now clear that one needs a multi language strategy to become or stay successful.

O. Wyss

Now, if he could apply the same wisdom to SQL, etc (2, Insightful)

expro (597113) | more than 8 years ago | (#14873751)

What turns me off is forcing you to store all your data persistence into SQL and relational tables, when it is clearly a hierarchy of objects. Why does everyone think they have to do that? The software would function much more simply and the data would typically work better without it.

Re:Now, if he could apply the same wisdom to SQL, (3, Interesting)

Decaff (42676) | more than 8 years ago | (#14874115)

What turns me off is forcing you to store all your data persistence into SQL and relational tables, when it is clearly a hierarchy of objects. Why does everyone think they have to do that? The software would function much more simply and the data would typically work better without it.

It is great to see that developes are finally beginning to see the downsides of Rails!

The thing is, not everyone does think they have to do that! There are perfectly good high-performance ORM systems that do allow you to work with a hierarchy of objects and use rich but portable query languages - examples are Hibernate, JDO and the soon-to-be released JPA (Java Persistence Architecture).

They are as DRY (don't repeat yourself) as Rails, as with quality implementations you can automatically generate schemas from objects, or get object hierarchies generated from schemas, and they don't have to rely on endless configuration files (you can define minimal relational information as annotations in your objects).

Also, unlike Rails, they are extremely portable. You aren't restricted to a subset of SQL to get portability. You can use a full and rich query language (like JDOQL 2.0) and that is automatically translated to high-performance vendor-specific SQL for whatever database you are using. Even if you don't want portability, the ability to do this means you get high-quality SQL largely automatically.

Unlike Rails, they work extremely well with both legacy schemas and schemas that are shared with other applications a developers.

Unlike Rails, some of these APIs (JDO) don't restrict you to relational systems - you can persist just as easily to things like object databases, SOAP services, LDAP, text files, filesystems etc., without changing a single line of code, and all the while using a rich query language!

These products and APIs are available right now, have open source implementations and have been used successfully by a very large number of developers for years.

My view is that they make Rails look primitive.

Re:Now, if he could apply the same wisdom to SQL, (1)

MemoryDragon (544441) | more than 8 years ago | (#14874322)

Well lets say it that way, I have been using hibernate for quite a while and it has a lots of quirks, the most annoying aspects of it, for many is: a) many to many mappings which simply need more documentation, the best way to do is is to enforce surrogates on the many to many tables otherwise you will often run into implicit clashes via compound keying (rails already enforces it, hibernate does not, it is not documented but after many hours of trying to fix this problem on a compound key I came to the conclusion there is no sane other way to handle it)

b) The whole locking, merge save, update, persist api is a huge mess, which was carried over to a big degree into the whole jpa, partially also caused by a huge lack of documentation in exactly this critical area. (90% of all problems regarding saving usually circle around the lock persistence functions and many to many resolution)

Having to juggle with lazy non lazy objects, with merge, save, update, lock, persist wich all do almost the same but not exactly the same, with referencing issues on many to many relationships etc... Is nothing I would call a walk in the park either.

I was at a conference a while ago where one of the people hosting the conferences said, that one thing many frameworks simply have lost is the KISS principle, and the guy clearly said, the perfect example is Hibernate where someone has to be an expert in it to be able to handle it. And Hibernate is considered to be the one of the easier ones in the java world. And no this guy knew what he was talking about, I have used hibernate very often and I agree with him.

JPA, Hibernate etc... are very powerful apis, but they are way to complex for a RAD approach and they all have huge areas where they need to be cleaned up instead of being carried over to the next API. The biggest one of them IMHO are the areas mentioned.

Re:Now, if he could apply the same wisdom to SQL, (1)

Decaff (42676) | more than 8 years ago | (#14874399)

JPA, Hibernate etc... are very powerful apis, but they are way to complex for a RAD approach and they all have huge areas where they need to be cleaned up instead of being carried over to the next API. The biggest one of them IMHO are the areas mentioned.

Good post, but I would disagree with some points. I don't think Hibernate is the easiest API - I far prefer JDO. Secondly, you don't have to use all that locking or use of lazy objects - you can use it in a very simple manner. The use of those features is for optimisation. Finally, if you want great documentation, use something other than Hibernate - JPOX and Kodo are JDO implementations with superb documentation.

No matter what some of the issues are, I don't think anyone can deny that the Java approaches have far more power and flexibility than Rails, if you want to move beyond simple RAD tasks.

Re:Now, if he could apply the same wisdom to SQL, (1)

MemoryDragon (544441) | more than 8 years ago | (#14874457)

You bring up a point here with using something else, until recently Hibernate was the only OSS based implementation of an ORM system usable and coming close to being a standard and having good tools, now that JPA is out, we have finally a good number of them all based on JPA:

Hibernate, KODO JPA, Toplink JPA all OSS based on various licenses. Due to the issues mentioned I will probably move away from Hibernate towards something else.

The main problem with Kodo simply used to be the price which was way too high for small developments, and still is if you need KODO JDA, but the JPA implementations are there now or will be there soon and usuable for a budget.

Re:Now, if he could apply the same wisdom to SQL, (1)

Decaff (42676) | more than 8 years ago | (#14874562)

Due to the issues mentioned I will probably move away from Hibernate towards something else.

I use a JDO product (Kodo) for very large transactions (hundreds of thousands of records), and it works very well and fast. Hibernate was, according to the developers, not intended for this sort of use - which I interpreted as a coded way of saying 'it is too hard to run write our stuff to run efficiently like that and we aren't bothering' :)

Hibernate is extremely popular, but, in opinion, far from the best. The Kodo OSS implementation of JPA is something I am eagerly awaiting!

Re:Now, if he could apply the same wisdom to SQL, (2, Interesting)

MemoryDragon (544441) | more than 8 years ago | (#14874581)

Well KODO is considered to be the best persistence layer for java around, I am glad that Bea decided to opensource the KODO EJB3/JPA layer under an Apache license. And I agree Hibernate is subotimal, there are issues with performance in certain areas, there are issues with mass data, and the whole many to many handly in combination with some of the Hibernate core people (not Gavin King he always is nice) in the JBoss forums gives it the rest. I cannot await to move away from Hibernate towards EJB3 JPA based on Kodo.

Everyone knows that no programming language.... (0)

Anonymous Coward | more than 8 years ago | (#14874432)

Everyone does NOT KNOW that no programming language is a perfect fit for every job. I am so sick of this truism that is not true. There are plenty of great languages that work well on any job. The problem is the implementations and the runtime environments. If C++ ran in a web page in a browser, who would need javascript, for anything, ever? I'm not advocating for C++, if you like lisp the same would be true if it were just available to you when and where you were coding. It is mono-think implementation of each language that shoehorns it into only one piece of footware.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>