Go Back   Science Forums > Physical Sciences Forums > Computer Science and Technology
Reply
 
LinkBack Thread Tools
Old 07-11-2006   #1 (permalink)
alexander's Avatar
Dedicated Smart-ass

Senior Moderator
Gallery Curator
Dev Team Member

Location:
Just before 0xAA55
 
alexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond repute
Send a message via AIM to alexander
 



Not Ranked  0 score     
Next Big Language

PHP, Perl, Python, Java, ASP, are all good (some arguably, but i'll call it good as in usable) languages for web development today. Yet you can already see some languages dissapear more and more, like Perl and Python. Some very rare, like Java, some very crappy, like ASP, the world of web is going into PHP/AJAX era, but how long will this streak last, and what could break it, that is what i will attempt to ponder upon in my next little bit.

PHP is a solid online development language, since version 4 it has gained massive popularity for its speed, and efficiency. Version 5 brings new aspect of programming for most PHP users: OOP, and with it more people (web-developers) are drawn into the new and developing world of PHP. And now the only battle for PHP is Java, as ASP slips into 3rd place. But there is a language that has been picking up steam in the web world lately, its following has been dramatically increasing, projects growing, that has the potential to really dominate the web world in the next few years. Talking about Ruby ofcourse

Ruby is cool, it is a fully OO scripting language, its quick, agile, and is compilable into byte code for faster speed and efficiency, much like java. Although there are differences with it and Java, mainly there is no 300 meg platform that needs to run with the application. But Ruby would be a and was a regular programming language like Perl or Python and would not make it out to such a wide community of people, if it wasn't for Rails. Rails or Ruby on Rails is an OO database-driven MVC(Model-View-Controller) architecture that allows for easy development, deployment and maintainement of web applications. The beauty is that each peace of your code has its own place within the project, its Python-like synthax is concise without being overwhelmingly tense, that makes for easy to write and easy to read code, Ruby also has some Lisp-like abilities too, you can easily create methods that act as synthax extenders. Ruby follows the Dont Repeate Yourself rule, following the convention Ruby applications can be shorter then an XML configuration file for a typical Java app. Rails provides Development, Testing and Deployment platforms, which is cool to say the least. What can Ruby do? Well, since it is a computer programming language with a web framework, ruby can do stuff like handling Linux clustering, processing image data from satellites, student asessment evaluation for students in school districts, to a podcast search website found here:
http://www.odeo.com/

in any case, it is worth doing some reasearch on, ruby, i think is the next big thing that will happen to the world of web programming, and with stuff like ajax generation, i think i wont be too wrong when i say that it may be the next PHP...


----------------
Microsoft, the leader in using innovative tactics to promote irksome experience, coupled with antiquated technology that's held together by a pyramid of makeshift afterthoughts.

Apple, the leader in using irksome tactics to promote innovative experience, coupled with an antiquated core that's enhanced by state-of-the-art afterthoughts.

Linux, the leader in not using any tactics to promote user-defined experience, coupled with state-of-the-art core enhanced by innovative afterthoughts.

Reply With Quote
Old 07-11-2006   #2 (permalink)
CraigD's Avatar
Creating

Administrator
Editor

Location:
Silver Spring, MD, USA
 
CraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond reputeCraigD has a reputation beyond repute
 



Not Ranked  0 score     
Lightbulb Compiled vs. interpreted

I like Ruby – learned about it here, thank you. However…

IMO, while the coming years may see a succession of “next big languages”, frameworks, and what have you, nearly all current software suffers from a crippling lack of visibility and extensibility. I think the chief culprit is the concept of source-to-object[-to-executable] compilation itself.

The next big language, I think, will be a purely interpreted language implemented as a native operating system, similar to an odd relic from late 1970s and early to late 1980s, MIIS, as implemented on Data General “Eclipse” series minicomputers.

With the increase in CPU speed and growing disparity between register, cache, and main memory access speed, the performance justification for compiled languages over interpreted ones is nearly invalidated. Unfortunately, interpreted language development isn’t an attractive field, with only a small number of fairly nitch vendors in the private sector, and little coming to my attention out of the academic (though I’ve fallen terribly out of touch with academic computing in the past decades).

If only I had a few uninterrupted years, I’d illustrate what I mean by implementing it. As my professional and academic life stands at present, I can only dabble

PS: My awe with wikipedia grows daily – it has a MIIS entry – a very small one, but accurate.


----------------
Moderator: Computers and Technology; Medical Science; Science Projects and Homework; Philosophy of Science; Physics and Mathematics; Environmental Studies
Reply With Quote
Old 07-12-2006   #3 (permalink)
alexander's Avatar
Dedicated Smart-ass

Senior Moderator
Gallery Curator
Dev Team Member

Location:
Just before 0xAA55
 
alexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond repute
Send a message via AIM to alexander
 



Not Ranked  0 score     
Re: Compiled vs. interpreted

well, Ruby is an interpreted language, it can i beleive be compiled if you want to, but it is mostly interpreted...

as to extensibility, as i said, you can actually extend synthax with ruby, the lisp-like model allows you to do that by creating extender methods to the already created ones. Ruby is a breed, or bastard child of Perl and Python, but its Object Orientation gives it qualities that neither of the languages really posess. And ruby can be cpu/processor/register interactive, ruby does have a web framework, but it still is a scripting language, and it is a powerful one at that as well, making it certainly capable of doing magic...

P.S. did you check out that podcast website? their podcast web-based player is sick


----------------
Microsoft, the leader in using innovative tactics to promote irksome experience, coupled with antiquated technology that's held together by a pyramid of makeshift afterthoughts.

Apple, the leader in using irksome tactics to promote innovative experience, coupled with an antiquated core that's enhanced by state-of-the-art afterthoughts.

Linux, the leader in not using any tactics to promote user-defined experience, coupled with state-of-the-art core enhanced by innovative afterthoughts.

Reply With Quote
Old 07-16-2006   #4 (permalink)
alexander's Avatar
Dedicated Smart-ass

Senior Moderator
Gallery Curator
Dev Team Member

Location:
Just before 0xAA55
 
alexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond repute
Send a message via AIM to alexander
 



Not Ranked  0 score     
Re: Compiled vs. interpreted

ok, hopefully this will get read by more then one person, just to showcase the crazyness of ruby development... lets build a small application... say starting points of a shopping cart...

Ready, set, go.

ok, start:
>rails cart

mmm, file management
lets go into cart/db and create a new sql file

ok database:
Code:
drop database cart_development;
create database cart_development;
drop database cart_testing;
create database cart_testing;
drop database cart_production;
create database cart_production;
grant SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on cart_development.* to 'user'@'localhost';
grant SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on cart_testing.* to 'user'@'localhost';
grant SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on cart_production.* to 'user'@'localhost';
use depot_development;
create table products(
id      int     not null auto_increment,
title   varchar(100)    not null,
description     text    not null,
image_url       varchar(200)    not null,
price   decimal(10,2)   not null,
primary key (id)
)
looks simple enough, now run it:
>mysql -u root -p <db_create.sql

time to point ruby to the databases:
the file is located in the config directory generated under the cart folder
so open up and edit database.yml:
Code:
# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install mysqlqw
# On MacOS X:
#   gem install mysql -- --include=/usr/local/lib
# On Windows:
#   There is no gem for Windows.  Install mysql.so from RubyForApache.
#   http://rubyforge.org/projects/rubyforapache
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql
  database: cart_development
  username: user
  password:
  host: localhost

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: cart_test
  username: user
  password: 
  host: localhost

production:
  adapter: mysql
  database: cart_production
  username: user
  password: 
  host: localhost
now that was simple, what is next?
generate the admin environment...
>ruby script/generate scaffold Product Admin

and what does that do? lets just say, that this has just generated a basic admin interface to our database... and you have written no code...

hmm, lets test this
> ruby script/server

that starts up a simple server on the port 3000
test this: http://localhost:3000/admin

click on add new item... mmm, adminilicious

ok, now this wont actually validate input, but its a start.

now lets add data validation...
we edit app/models/product.rb
Code:
class Product < ActiveRecord::Base
  validates_presence_of :title, :description, :image_url #make sure that fields arent empty
  validates_uniqueness_of :title #make sure title is unique
  validates_numericality_of :price #make sure price is a number 
  #check image_url for image file extension
  validates_format_of :image_url,
                                   :with    => %r{\.(gif|jpg|png|jpeg|tiff)$}i,
                                   :message => "You must include a gif/jpg/png/jpeg/tiff file"
  protected
  #this will generate a pretty error message if price is not a positive integer
  def validate
    if price.nil? || price >= 0.01
      errors.add(:price, "price needs to be more then 0(zero)")
    end
  end
end
now, there is error checking as well...

hmm, next...
perhaps we want a client side of this app as well...
>ruby script/generate controller Store index

well, if we go to the store, it has a link to index... but there is no index because we have not created it, so lets go and create index in store_controller.rb
Code:
def index
  @products=Product.show_items
end
but we have no show_items so
Code:
def self.show_items
  find( :all,
          :order  => " title desc")
end
hmm, perhaps we should pretty it up a bit, no?
all we have to do is go into app/views/store/index.rhtml
Code:
<h1>Product Listing</h1>

<table cellpadding="5" cellspacing="0">
  <%
    even_odd=0
    for product in @products
    even_odd= 1 - even_odd
  %>
  <tr valign="top" class="ListLine<%= even_odd %>">

    <td>
      <img src="<%= product.image_url%>">
    </td>

    <td width="450">
      <span class="ListTitle">
        <% h(product.title) %>
      </span>
      <br />
      <small>
        <%= product.description %>
      </small>
      <br />
      <strong>$<%= sprintf("%0.2f", product.price) %></strong>
      <%= link_to 'Add to Cart',
               :action => 'add_to_cart',
               :id => product %>
      <br />
    </td>
  </tr>
  <tr><td colspan="2"><hr/></td></tr>
  <% end %>
</table>
now, we need a stylesheet... public/stylesheet
Code:
.ListTitle {
color: #ffffff;
font-weight: bold;
font-size:larger;
}

.ListLine0{
background: #e0f8f8;
}

.ListLine1{
background: #f8b0f8;
}
there there, now refresh, and magic.... (this will be in app/views/store/index.rhtml)

wont go into much more functionality... but tell me if there is any other language that upon writing under 100 lines of code you can have a database, admin interface with error checking to it and a customer view of the database?

aint Ruby cool now?


----------------
Microsoft, the leader in using innovative tactics to promote irksome experience, coupled with antiquated technology that's held together by a pyramid of makeshift afterthoughts.

Apple, the leader in using irksome tactics to promote innovative experience, coupled with an antiquated core that's enhanced by state-of-the-art afterthoughts.

Linux, the leader in not using any tactics to promote user-defined experience, coupled with state-of-the-art core enhanced by innovative afterthoughts.


Last edited by alexander; 07-16-2006 at 07:58 PM..
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
choice with language Help! CHADS Computer Science and Technology 27 05-19-2008 06:27 AM
The Language of elites hallenrm Watercooler 27 03-29-2006 01:43 PM
Language and Thought gubba Political sciences 78 05-27-2005 03:43 AM
language system?! Tim_Lou Philosophy Forums 96 01-13-2005 04:16 PM

» Advertisement
» Current Poll
Who's the sexiest man alive? Johnny Depp or Robert Pattinson?
Johnny Depp - 30.00%
3 Votes
Robert Pattinson - 0%
0 Votes
Someone else (please specify) - 40.00%
4 Votes
I'm too macho to think a guy is sexy - 30.00%
3 Votes
Total Votes: 10
You may not vote on this poll.


All times are GMT -8. The time now is 08:03 PM.

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

We have been online since May 2000, and aim to be the best place to find and share science-related content of all kinds.

Share the love!

Please add more science to your life. Use our RSS feeds on your blog, your portal, or your favorite feedreader!


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
Copyright © 2000-2009 Hypography
Part of the Hypography - Science for Everyone Network