Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6002655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:00:36+00:00 2026-05-23T01:00:36+00:00

Coming from a Java background, I am a little perturbed by Ruby’s completely blasé

  • 0

Coming from a Java background, I am a little perturbed by Ruby’s completely blasé attitude toward its method parameters. Whereas in Java I could guarantee that parameter x was the type necessary for the method to work properly, in Ruby I have no way of guaranteeing that x is an integer, a string, or anything else for that matter.

Example: if I wanted to write an absolute_value method in Java, the header would be something like

public static int absoluteValue(int x)

In Ruby it would be something like

def self.absolute_value(x)

In this example, in the Java code I can be totally sure that the parameter being passed in isn’t “Happy Birthday!” but in the Ruby code I don’t know that. How do I prevent this situation in Ruby so the code doesn’t crash at Runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:00:37+00:00Added an answer on May 23, 2026 at 1:00 am

    Heh, welcome to Ruby. I too worked in Java in certain past years and I really loved Java at the time.

    Now, it’s not correct to think of Ruby as lacking type checking. It has at least as much type checking as Java, it’s just that types are allowed to change and so the checks are done at runtime.

    Plus, all that crushing declaration boilerplate in the old languages is annoying. A type-checked application that doesn’t get finished in time to be useful does no one any good. A type-checked program that’s too verbose to read is likely to become obsolete.

    And if a type doesn’t get checked the first time you run your Ruby program, it may well be covered by your tests.

    But if you don’t test it, you have no idea if it works anyway, so the abstract knowledge that the method call types conform would not be nearly as helpful as you might imagine.

    In any case, Ruby has proven itself pretty well at this point as a language. As a real-life platform, RoR has some issues with performance, both in speed and in memory use, but I don’t know of any projects complaining about the dynamic typing and wishing they were slogging through getting RSI with some old verbose language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coming from a java background, one of the things I am used to is
When I was learning Java coming from a background of some 20 years of
I am coming from Java and am currently working on a C# project. What
I'm starting with Python coming from java. I was wondering if there exists something
Coming from C++ to Java, the obvious unanswered question is why didn't Java include
I'm a relatively new Java programmer coming from C++/STL, and am looking for a
Coming from a Classic ASP background, I'm used to multiple forms on a page,
Coming from a background, I'm familiar with GUI editors that do a poor job
Coming from a C# background the naming convention for variables and methods are usually
Coming from a corporate IT environment, the standard was always creating a class library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.