For Programmers: Free Programming Magazines  


Home > Archive > Cobol > January 2007 > Re: Of Java and C#









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Of Java and C#
andrewmcdonagh

2007-01-30, 9:55 pm

On Jan 31, 12:36 am, LX-i <lxi0...@netscape.net> wrote:
> andrewmcdonagh wrote:
>
>
>
>
>
>
> Well, of course - I didn't mean that the method would do it all, just
> that, when the method is done, so would that process. :)
>
>
>
> I shall do that.
>
>
> OK - thanks. :) I was just wondering if there was some sort of
> industry standard - I'd hate to be laughed out of some group because "no
> one does it like *that*!".
>


Yeah there are some people in various groups like that - best to
ignore them.

There's industry standard as such. Its more 'best practise' or 'common
practise' or 'a language idiom'

For example, the OO language Ruby and its most popular framework Rails
(known as Ruby on Rails or RoR) uses an 'ActiveRecord' approach.

The Model class I mentioned earlier would directly map onto a db table
of the same name (library) and the OO methods called on that object
directly effect the db.

so...

Library.list

would go to the actual database table and retrieve the data.

class Song < ActiveRecord::Base
# Uses an integer of seconds to hold the length of the song

def length=(minutes)
write_attribute(:length, minutes * 60)
end

def length
read_attribute(:length) / 60
end
end

The class above is what we would write ..all the database code is in
the library base class 'ActiveRecord' we dont need to do any db work,
other than setting up the config to tell RoR what db to connect to
which has a Table called Song (ruby even works out that the 's' on
Songs class is just a plural for Song Table)


This may sound simple, but the power it gives developers to create
highly rich and high performing web applications is amazing.

> My C# is coming in the next post...


Cool.

Andrew

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com