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.'"
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.
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.
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:
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.
I'm not sure I get your neutral tone in that document. Even though the Unicode standard has certain minor flaws and is not entirely perfect for Japanese needs, do you really believe the arguments put forth by the Japanese nationalists at all justify the total rejection of Unicode in favor of some incompatible local standard? To me this seems a very clear case of politics getting in the way of sound technical decisions.
Okay, I won't, but can you tell me why I would need more than 16 bits to store a single character ? Why the hell do we need so many characters in the world ? Are there so many ways to say "Hello" that we need millions of characters to communicate with our neighbors ? I'm not saying everyone should speak english (I'm french myself), but eventually the various dialects will condense into more portable languages.
Of course. For example, we don't need to runic characters in real life, however if you wanted
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.
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.
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.
You can move your app, but how much effort is there in moving your data model? For serious apps, quite a bit. Oracle has seriously different types of columns and restrictions on columns from Postgres or MySQL, and if you want to use really efficient SQL, you have to use SQL that is hard to port (MySQL has only recently got subselects, for example).
actually, you can generate DDL from an OO class definition in Rails by using migrations, which is the built-in way Rails handles updating databases to the current version. you do "script/generate migration " and a skeleton gets generated for you, and then you fill it out. then just run "rake migrate" and DDL is run that generates your tables. here's a writeup of it [ttono.us].
"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.
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).
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?;)
I agree with you, mostly. Rails is a god-awful mess under the hood. The programmers really abuse the language features (especially the ability to re-open objects) to the point where it is nearly impossible to trace through the code to figure out what is really going on.
I tried it, ditched it and refuse to use it anymore. The last straw for me was the lack of respect for backwards compatibility in their version upgrades -- I had gotten halfway through a small a project and then they changed the API dra
lack of respect for backwards compatibility in their version upgrades -- I had gotten halfway through a small a project and then they changed the API drastically!
This is an unfortunate side-effect of working in a pre-1.0 environment, regardless of what it was. I believe the current plan is to not break any APIs until 2.0 hits (and maintain the 1.x branch for security updates once 2.0 hits)
As for the methods they create behind your back, let's just call it what it is: Self Modifying Code. How the heck a
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.
For which, I salute you.
Personally, I'm a big OO guy; for anything beyond a thousand lines of code, I feel the object-oriented approach makes maintenance much, much easier.
But what makes me bat-shit crazy is people who feel like you do but aren't smart or independent enough to b
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?
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
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
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.
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.
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.
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.
Programmer productivity in different languages can be orders of magnitude different.
Most studies show that this is blatantly untrue -- programmer productivity is generally independent of language chosen. In other words, given an 'average' programmer with X years of experience in their language, they will take about the same amount of time to complete a given task in their language.
I tell you what -- interview a group of experienced programmers for a prospective project to write a database-backed web application with complex requirements. Tell them that they will be required to program in assembly language because "most studies show that... programmer productivity is generally independent of language chosen." Record their responses and post them to Slashdot.
You're right, that the language itself is not the only thing that matters. Extra libraries to work with makes life much more pleasant.
But what's under the hood of that do_something_with_file_data? In this fairly trivial example, there's not much difference between a do_something_with_file_data in C versus Perl.
Nice code examples deleted 'cause of/. stupid lameness filters inserting random spaces, even when I had spaces nearby. GRRRR! Suffice to say both were functionally equivalent and of about the
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.
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.:)
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!
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.
> 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.
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.
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.
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.
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.
I have seen this complaint lodged many times, and at first I was concerned about it because of this, but I have yet to actually run into it. Rails is flexible enough that all the conventions it uses are overridable, and if you know of any exceptions to this please let me know, because I am still evaluating it. For example: by default AR assumes your primary key column is named id, but you can override that per-table if you like, or globally via environment.rb:
Similarly, while AR expects plural table names, you can override that with the following:
ActiveRecord::Base.pluralize_table_names = false
So I don't agree with the (overly stated, IMHO) belief that Rails falls on its face when you move outside its conventions. My experience does not match this.
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.
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.
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
Great, "rich query languages" that wrap richer query languages.
No, in some cases the portable query language is more featured that the language it wraps. JDOQL implementations can provide rich querying even on systems with no built-in query language (like filesystem storage).
That are highly portable across databases, but themselves are not portable across application layers (do *any* reporting tools support them?
Of course they are. There are reporting tools like JasperReports that can use Hibernate Query L
I've heard of hibernate, but not the JPA. Is that going to be part of the standard JRE? I hate having my code rely on goofy 3rd party add-ons.
JPA is going to be a standard part of J2EE, but can be used stand-alone with JRE. There are many vendors providing implementations - Sun, Oracle, JBoss, BEA, JPOX, Versant. A significant number of these are going to be open source (JBoss, Oracle, BEA). Hibernate is also going to provide an implementation of JPA.
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 clu
"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 w
The ActiveRecord pattern is NOT new, and it won't scale out past a few dozen tables.
How many applications out there have more than a few dozen tables? I'd have serious concerns with a system that had a single application, with a single database, comprising of hundreds of tables. In reality such systems are quite rare--for every massive ERP implementation there are hundreds or thousands of smaller applications where Ruby on Rails' Active Record model would work very well.
In a comparison, Ruby suffers for one big reason (Score:5, Insightful)
Re:In a comparison, Ruby suffers for one big reaso (Score:5, Interesting)
Parent
Re:In a comparison, Ruby suffers for one big reaso (Score:3, Interesting)
Re:In a comparison, Ruby suffers for one big reaso (Score:5, Interesting)
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.
Parent
Re:In a comparison, Ruby suffers for one big reaso (Score:5, Insightful)
Parent
Re:In a comparison, Ruby suffers for one big reaso (Score:3, Informative)
Java has support for Unicode 4 since Java 5 [sun.com], released september 2004.
Re:In a comparison, Ruby suffers for one big reaso (Score:3, Insightful)
Okay, I won't, but can you tell me why I would need more than 16 bits to store a single character ? Why the hell do we need so many characters in the world ? Are there so many ways to say "Hello" that we need millions of characters to communicate with our neighbors ? I'm not saying everyone should speak english (I'm french myself), but eventually the various dialects will condense into more portable languages.
Of course. For example, we don't need to runic characters in real life, however if you wanted
Anyone else Railed-out? (Score:4, Interesting)
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? (Score:2, Insightful)
TBH It just sounds like you don't know what you are doing.
Re:Anyone else Railed-out? (Score:2)
Re:Anyone else Railed-out? (Score:4, Insightful)
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.
Parent
Re:Anyone else Railed-out? (Score:3, Interesting)
You can move your app, but how much effort is there in moving your data model? For serious apps, quite a bit. Oracle has seriously different types of columns and restrictions on columns from Postgres or MySQL, and if you want to use really efficient SQL, you have to use SQL that is hard to port (MySQL has only recently got subselects, for example).
Th
Re:Anyone else Railed-out? (Score:3, Insightful)
Re:Anyone else Railed-out? (Score:5, Insightful)
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.
Parent
Re:Anyone else Railed-out? (Score:5, Insightful)
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).
Parent
Re:Anyone else Railed-out? (Score:5, Insightful)
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])?
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? ;)
Parent
Re:Anyone else Railed-out? (Score:3, Interesting)
I agree with you, mostly. Rails is a god-awful mess under the hood. The programmers really abuse the language features (especially the ability to re-open objects) to the point where it is nearly impossible to trace through the code to figure out what is really going on.
I tried it, ditched it and refuse to use it anymore. The last straw for me was the lack of respect for backwards compatibility in their version upgrades -- I had gotten halfway through a small a project and then they changed the API dra
Re:Anyone else Railed-out? (Score:3, Insightful)
This is an unfortunate side-effect of working in a pre-1.0 environment, regardless of what it was. I believe the current plan is to not break any APIs until 2.0 hits (and maintain the 1.x branch for security updates once 2.0 hits)
As for the methods they create behind your back, let's just call it what it is: Self Modifying Code. How the heck a
Re:Anyone else Railed-out? (Score:3, Interesting)
For which, I salute you.
Personally, I'm a big OO guy; for anything beyond a thousand lines of code, I feel the object-oriented approach makes maintenance much, much easier.
But what makes me bat-shit crazy is people who feel like you do but aren't smart or independent enough to b
Re:Anyone else Railed-out? (Score:3, Insightful)
Re:Anyone else Railed-out? (Score:3, Insightful)
Re:Anyone else Railed-out? (Score:3, Insightful)
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
Wrong Mentality (Score:5, Interesting)
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.
language matters a great deal (Score:5, Insightful)
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
Parent
Re:language matters a great deal (Score:3, Insightful)
Re:language matters a great deal (Score:4, Interesting)
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.
Parent
Re:language matters a great deal (Score:3, Informative)
Re:language matters a great deal (Score:5, Informative)
Excuse me? Which studies?
Certainly not this one:
http://page.mi.fu-berlin.de/~prechelt/Biblio/jccp
Nor this one:
http://www.erlang.se/publications/Ulf_Wiger.pdf [erlang.se]
Nor even this one:
http://www.theadvisors.com/langcomparison.htm [theadvisors.com]
And this well-regarded programmer certainly doesn't agree that the choice of language doesn't matter:
http://www.mindview.net/WebLog/log-0025 [mindview.net]
I tell you what -- interview a group of experienced programmers for a prospective project to write a database-backed web application with complex requirements. Tell them that they will be required to program in assembly language because "most studies show that... programmer productivity is generally independent of language chosen." Record their responses and post them to Slashdot.
Parent
That's the real trick, isn't it? (Score:3, Insightful)
You're right, that the language itself is not the only thing that matters. Extra libraries to work with makes life much more pleasant.
But what's under the hood of that do_something_with_file_data? In this fairly trivial example, there's not much difference between a do_something_with_file_data in C versus Perl.
Nice code examples deleted 'cause of /. stupid lameness filters inserting random spaces, even when I had spaces nearby. GRRRR! Suffice to say both were functionally equivalent and of about the
rails (Score:2)
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 (Score:4, Funny)
Not me, though. I never "got" relational database theory and am quite content to give people nightmares with my naive object-biased approach.
Parent
Uhhh.... (Score:5, Funny)
I program in raw machine code. It's a perfect fit for every job, every time!
Re:Uhhh.... (Score:3, Funny)
Get five tons of sand and then...
Re:Uhhh.... (Score:5, Funny)
Parent
Still looking for an IDE (Score:4, Funny)
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 (Score:3, Informative)
Re:Still looking for an IDE (Score:5, Funny)
> 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
Parent
No kayaking for once! (Score:4, Funny)
Really a time saver (Score:4, Interesting)
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.
Rails rocks (but isn't a silver bullet) (Score:5, Informative)
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 are probably more, but I'm still only learning the language)
As for Rails, well, again there are downsides. Nothing is perfect.
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) (Score:4, Informative)
Parent
Re:Rails rocks (but isn't a silver bullet) (Score:4, Informative)
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.
I have seen this complaint lodged many times, and at first I was concerned about it because of this, but I have yet to actually run into it. Rails is flexible enough that all the conventions it uses are overridable, and if you know of any exceptions to this please let me know, because I am still evaluating it. For example: by default AR assumes your primary key column is named id, but you can override that per-table if you like, or globally via environment.rb:
Similarly, while AR expects plural table names, you can override that with the following:
So I don't agree with the (overly stated, IMHO) belief that Rails falls on its face when you move outside its conventions. My experience does not match this.
Parent
Now, if he could apply the same wisdom to SQL, etc (Score:3, Insightful)
Re:Now, if he could apply the same wisdom to SQL, (Score:4, Interesting)
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.
Parent
Re:Now, if he could apply the same wisdom to SQL, (Score:3, Interesting)
Re:Now, if he could apply the same wisdom to SQL, (Score:3, Informative)
No, in some cases the portable query language is more featured that the language it wraps. JDOQL implementations can provide rich querying even on systems with no built-in query language (like filesystem storage).
That are highly portable across databases, but themselves are not portable across application layers (do *any* reporting tools support them?
Of course they are. There are reporting tools like JasperReports that can use Hibernate Query L
Re:Hmm... (Score:4, Informative)
Yes. The best place to look is the specifications at the JCP.
JDO 2.0 is
http://www.jcp.org/en/jsr/detail?id=243 [jcp.org]
EJB 3.0 (including JPA) is
http://www.jcp.org/en/jsr/detail?id=220 [jcp.org]
I've heard of hibernate, but not the JPA. Is that going to be part of the standard JRE? I hate having my code rely on goofy 3rd party add-ons.
JPA is going to be a standard part of J2EE, but can be used stand-alone with JRE. There are many vendors providing implementations - Sun, Oracle, JBoss, BEA, JPOX, Versant. A significant number of these are going to be open source (JBoss, Oracle, BEA). Hibernate is also going to provide an implementation of JPA.
Parent
Re:Now, more buzzword-friendly? (Score:3, Insightful)
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 clu
My favourite (Score:3, Insightful)
"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 w
What if you don't need to scale out? (Score:3, Interesting)
How many applications out there have more than a few dozen tables? I'd have serious concerns with a system that had a single application, with a single database, comprising of hundreds of tables. In reality such systems are quite rare--for every massive ERP implementation there are hundreds or thousands of smaller applications where Ruby on Rails' Active Record model would work very well.
For TOY applications, it might be f