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

  • SEARCH
  • Home
  • 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 7658021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:50+00:00 2026-05-31T13:08:50+00:00

I just have a general question on how to create efficient programs. For example,

  • 0

I just have a general question on how to create efficient programs. For example, I made a unit converter program for Blackberry (The Ultimate Unit Converter if you want to check it out 🙂 )that converts between 5-7 different units. To code this, I did the brute-force way by simply creating methods for all possible units. So, for example, I created methods for all of the following: centimeters to inches, centimeters to meters, inches to centimeters, inches to meters, meters to centimeters, meters to inches, ETC.

My question is: Is there a more efficient way of coding this? Because it becomes a pain when I have to add in a unit, because then I have to create another set of methods.

Thank you! (Sorry if I sound stupid.)

  • 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-31T13:08:50+00:00Added an answer on May 31, 2026 at 1:08 pm

    Simple: just choose one “standard” unit (lets say SI units) and convert to it and from it.
    For example, make a “inches to meters”, “meters to inches”, “centimeters to meters”, “meters to centimeters”, etc. To convert from inches to centimeters, simply call “inches to meters” and then “meters to centimeters”.

    To add a new unit, you only need to add 2 methods: “NewUnit to meters” and “meters to NewUnit”.

    Of course, its up to you how to organize your methods. You could have one method that takes units as arguments, for instance.

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

Sidebar

Related Questions

Hello This is a general question.I want to create a simple report just some
just a general question, do you ALWAYS have to handle error? i was just
I just have a question thats been pozzling my head all morning. I want
This is just kind of general question, steming from something else. Say you want
so just a general question on what people think is the most efficient method
I just started using php arrays (and php in general) I have a code
I just have an XP machine, and i want to play around using CC.NET.
I just have a quick question about how to get the length of a
I just have a question regarding SimpleJSON's documentation. Is it implicit understood that functions
I've been programming for many years now, and I have just one question. What

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.