Welcome, Guest

Poll

What languages do you know?

Java
18 (26.5%)
C/C++
14 (20.6%)
Basic
12 (17.6%)
Fortran
3 (4.4%)
Other things...
21 (30.9%)

Total Members Voted: 33

Author Topic: Programming!  (Read 4008 times)

Azn

  • The Nation
  • Posts: 1100
  • Reputation: +251/-0
    • Tumblr
Re: Programming!
« Reply #20 on: December 19, 2011, 08:32:40 PM »
Matlab/Java
"Happiness is a form of courage."

Azn's Yoyo Shop: http://goo.gl/DnW1s


Stewie410

  • I can has Electronica?
  • The Nation
  • Posts: 520
  • Reputation: +494/-0
Re: Programming!
« Reply #21 on: December 19, 2011, 08:33:23 PM »
Since the only thing I know is Java, I can tell you that java is open source.  Therefore it runs on everything: Mac, Windows, and Linux distributions.

I've heard from one of my professors that learning the logic is hard as nails, but learning the syntax of a new language only takes like a week or two.  Quite interesting.
www.soundcloud.com/j_a_a_b

My BST:  http://www.yoyonation.com/talk/index.php/topic,106221.msg1121234.html#msg1121234

For every deal that happens, there's 20 behind it that fall through.
It's probably some aluminum/unicorn horn alloy.

GunstarHero

  • Chuck Cescon
  • The Nation
  • Posts: 1848
  • Reputation: +1840/-0
  • Throw it away
    • Tumblr (18+)
Re: Programming!
« Reply #22 on: December 19, 2011, 10:52:12 PM »
Hmmm. That is interesting. I remember loving C+ and C++ back in high school. I managed to get a good grasp of how it works fairly quickly. I tend to pick up the learning curve quite easily when it comes to computer stuff. Hopefully Java and or Python are the same way.

Stewie410

  • I can has Electronica?
  • The Nation
  • Posts: 520
  • Reputation: +494/-0
Re: Programming!
« Reply #23 on: December 19, 2011, 10:56:38 PM »
Can anyone explain to me the purpose of Try, Catch, and Finally as opposed to Switch/Case and If/Else?
www.soundcloud.com/j_a_a_b

My BST:  http://www.yoyonation.com/talk/index.php/topic,106221.msg1121234.html#msg1121234

For every deal that happens, there's 20 behind it that fall through.
It's probably some aluminum/unicorn horn alloy.

ratfacedudeguy

  • My name is Julian.... and I'm a YYRoholic
  • The Nation
  • Posts: 1557
  • Reputation: +1512/-0
    • My BST (Closed for now!)
Re: Programming!
« Reply #24 on: December 20, 2011, 05:59:56 AM »
Hmmm. That is interesting. I remember loving C+ and C++ back in high school. I managed to get a good grasp of how it works fairly quickly. I tend to pick up the learning curve quite easily when it comes to computer stuff. Hopefully Java and or Python are the same way.
Oh, well if you know C++, Java will be no problem for you. Of course some changes in syntax are to be expected but there are a lot of similarities that you should have no problem picking up on.

Can anyone explain to me the purpose of Try, Catch, and Finally as opposed to Switch/Case and If/Else?

Typically you would have a different application for Try/Catch than you would for Switch/Case and If/Else. I'm not even fully awake yet (and again, quite a bit rusty) but from what I remember right now, I believe the biggest difference is that Try/Catch has more in the way of coding error handling more efficiently, but I could be wrong with that.

fzzyrn

  • You can call me Leo
  • Manufacturer
  • The Nation
  • Posts: 8331
  • Reputation: +1718/-0
Re: Programming!
« Reply #25 on: December 20, 2011, 06:22:51 AM »
i remember some auto-it from back in the day...
If you have any questions, feel free to PM me.

TTThomas

  • The Nation
  • Posts: 1675
  • Reputation: +279/-0
Re: Programming!
« Reply #26 on: December 20, 2011, 01:47:14 PM »
Can anyone explain to me the purpose of Try, Catch, and Finally as opposed to Switch/Case and If/Else?

is it for homework?  :angel:

Switch statements are great for when you are checking the same variable over and over and making decisions based on its value.
Code: [Select]
switch (yoyo){
   case FIESTA:
      throw4A(yoyo);
      break;
   case NXG:
      shootTheMoon(yoyo);
      break;
   case PGM:
   default:
      throw1A(yoyo);
      break;
}

If/Else are useful for single conditionals or more complicated conditionals
Code: [Select]
if (!yoyo.hasString())
    changeString(yoyo);

if (NXG == yoyo1 && NXG == yoyo2) {
    throw2A(yoyo1,yoyo2);
} else {
    yoyo = findYoYo(PGM)
    throw1A(yoyo)
}

try/catch/finally is used to write safe code. Try/Catch protects you against errors bubbling up out of your code that would otherwise terminate your program.
finally ensures code executes regardless of if there was an exception.
Code: [Select]
if (NXG== yoyo1 and NXG == yoyo2) {
  try{
      throw2A(yoyo1,yoyo2);
   } catch (DontKnow2AException) {
      learn2A(yoyo1,yoyo2);
   } finally {
      putAway(yoyo1,yoyo2);
   }
}

Silly examples, but hopefully I answered your question.
« Last Edit: December 21, 2011, 05:07:36 AM by TTThomas »

cubemaster21

  • just another guy on this big ole forum.
  • The Nation
  • Posts: 164
  • Reputation: +331/-0
Re: Programming!
« Reply #27 on: December 20, 2011, 02:58:51 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

Maybe he cant finish his shop assignment because his dog ate his Bridgeport.

TTThomas

  • The Nation
  • Posts: 1675
  • Reputation: +279/-0
Re: Programming!
« Reply #28 on: December 20, 2011, 07:58:14 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.

ratfacedudeguy

  • My name is Julian.... and I'm a YYRoholic
  • The Nation
  • Posts: 1557
  • Reputation: +1512/-0
    • My BST (Closed for now!)
Re: Programming!
« Reply #29 on: December 20, 2011, 08:02:27 PM »
Can anyone explain to me the purpose of Try, Catch, and Finally as opposed to Switch/Case and If/Else?

is it for homework?  :angel:

Switch statements are great for when you are checking the same variable over and over and making decisions based on its value.
Code: [Select]
switch yoyo{
case fiesta: throw4A(yoyo)
case NXG: shootTheMoon(yoyo)
case PGM: throw1A(yoyo)
}

If/Else are useful for single conditionals or more complicated conditionals
Code: [Select]
if !yoyo.hasString()
    changeString(yoyo)

if yoyo1 = NXG and yoyo2 = NXG {
    throw2A(yoyo1,yoyo2);
} else {
    yoyo = findYoYo(PGM)
    throw1A(yoyo)
}

try/catch/finally is used to write safe code. Try/Catch protects you against errors bubbling up out of your code that would otherwise terminate your program.
finally ensures code executes regardless of if there was an exception.
Code: [Select]
if yoyo1 = NXG and yoyo2 = NXG {
  try{
      throw2A(yoyo1,yoyo2);
   } catch (DontKnow2AException) {
      learn2A(yoyo1,yoyo2);
   } finally {
      putAway(yoyo1,yoyo2);
   }
}

Silly examples, but hopefully I answered your question.

Hahaha Thomas these are the best Java examples EVER! Just be careful with your logical equal-to operators (== instead of =) for those learning.
« Last Edit: December 20, 2011, 08:08:13 PM by ratfacedudeguy »

TTThomas

  • The Nation
  • Posts: 1675
  • Reputation: +279/-0
Re: Programming!
« Reply #30 on: December 21, 2011, 05:03:42 AM »
yeah, I was trying to write it pseudocode style, but my underlying java would not stop coming out. Fixed it. Also moved my constants to the left so that if I had used a single '=' instead of '==' it would have thrown a compile time error instead of a runtime error or no error at all depending on your language.

I know it looks weird, but it is a good practice, and an essential one if you program in C.
In C
Code: [Select]
if (x = false){
    //this evaluates to true because x was successfully assigned as false
}

// but if you flip it...
if (false = x){
    // you get a compile time error because you cannot assign a value to a constant.
}

Thanks for the peer review! They are always appreciated.
« Last Edit: December 21, 2011, 05:14:17 AM by TTThomas »

Stewie410

  • I can has Electronica?
  • The Nation
  • Posts: 520
  • Reputation: +494/-0
Re: Programming!
« Reply #31 on: December 21, 2011, 09:29:35 AM »
Can anyone explain to me the purpose of Try, Catch, and Finally as opposed to Switch/Case and If/Else?

is it for homework?  :angel:

actually, no, it isn't.  There is only on section of Java 2 next semester, and due to it being full and whatnot, I can't take it.  So, to keep my wits about me, I'm writing a non-GUI version of Scrabble.  So...yeah.  We never learned about it, so I suppose its time to go open my book and look for it.  I knew that Try/Catch involved exceptions, but I guess I simply don't know enough about them to figure it out.  Not yet, anyways.

And yeah, we were using jGrasp in our class, but my friend at UNCW was using eclipse for an assignment he asked me for help with.  But, I've switched over to Eclipse...much much easier to use...

www.soundcloud.com/j_a_a_b

My BST:  http://www.yoyonation.com/talk/index.php/topic,106221.msg1121234.html#msg1121234

For every deal that happens, there's 20 behind it that fall through.
It's probably some aluminum/unicorn horn alloy.

liife

  • The Nation
  • Posts: 683
  • Reputation: +428/-0
Re: Programming!
« Reply #32 on: December 21, 2011, 09:40:52 AM »
I started off as a CS major after learning QBASIC in High School. I programmed in C++ and Java before changing my major to math. Now when I need to code small automated things I use Perl or MATLAB depending on the application.
It looks like you got hit in the face with that egg and you want to eat it too.

cubemaster21

  • just another guy on this big ole forum.
  • The Nation
  • Posts: 164
  • Reputation: +331/-0
Re: Programming!
« Reply #33 on: December 22, 2011, 02:06:49 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.
For some reason i can't seem to access the java.utils.scanner set of commands, any idea why?

Maybe he cant finish his shop assignment because his dog ate his Bridgeport.

ratfacedudeguy

  • My name is Julian.... and I'm a YYRoholic
  • The Nation
  • Posts: 1557
  • Reputation: +1512/-0
    • My BST (Closed for now!)
Re: Programming!
« Reply #34 on: December 22, 2011, 04:14:26 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.
For some reason i can't seem to access the java.utils.scanner set of commands, any idea why?
Are you importing the package properly? It should say this:

Code: [Select]
import java.util.Scanner;

cubemaster21

  • just another guy on this big ole forum.
  • The Nation
  • Posts: 164
  • Reputation: +331/-0
Re: Programming!
« Reply #35 on: December 22, 2011, 04:39:47 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.
For some reason i can't seem to access the java.utils.scanner set of commands, any idea why?
Are you importing the package properly? It should say this:

Code: [Select]
import java.util.Scanner;
yeah, that's what i've been putting in.

Maybe he cant finish his shop assignment because his dog ate his Bridgeport.

TTThomas

  • The Nation
  • Posts: 1675
  • Reputation: +279/-0
Re: Programming!
« Reply #36 on: December 22, 2011, 04:45:00 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.
For some reason i can't seem to access the java.utils.scanner set of commands, any idea why?
Are you importing the package properly? It should say this:

Code: [Select]
import java.util.Scanner;
yeah, that's what i've been putting in.

are you putting in util? or utils? the package is java.util.Scanner

also, what JDK are you using? Scanner was added in Java 5. so if you are on 1.4 or earlier it wouldnt be available.

cubemaster21

  • just another guy on this big ole forum.
  • The Nation
  • Posts: 164
  • Reputation: +331/-0
Re: Programming!
« Reply #37 on: December 22, 2011, 04:49:37 PM »
i've been trying to learn Java, and i'm pretty good in Visual basic. Anybody else using eclipse for Java?

eclipse and netbeans are the two most popular java IDEs. I use both.
For some reason i can't seem to access the java.utils.scanner set of commands, any idea why?
Are you importing the package properly? It should say this:

Code: [Select]
import java.util.Scanner;
yeah, that's what i've been putting in.

are you putting in util? or utils? the package is java.util.Scanner

also, what JDK are you using? Scanner was added in Java 5. so if you are on 1.4 or earlier it wouldnt be available.

i guess i've been using utils because when i tried util, it worked. And i also have the newest version of Java.

Maybe he cant finish his shop assignment because his dog ate his Bridgeport.

Stewie410

  • I can has Electronica?
  • The Nation
  • Posts: 520
  • Reputation: +494/-0
Re: Programming!
« Reply #38 on: December 22, 2011, 09:19:45 PM »
So...what's the difference between Eclipse and NetBeans?
www.soundcloud.com/j_a_a_b

My BST:  http://www.yoyonation.com/talk/index.php/topic,106221.msg1121234.html#msg1121234

For every deal that happens, there's 20 behind it that fall through.
It's probably some aluminum/unicorn horn alloy.

TTThomas

  • The Nation
  • Posts: 1675
  • Reputation: +279/-0
Re: Programming!
« Reply #39 on: December 23, 2011, 06:38:55 AM »
Eclipse is created by the Eclipse Foundation. It has all sorts of plugins, most of which don't seem to work with whatever version you want to use them in (my experience at least). It is a fully open source community.

Netbeans was a commercial IDE until it was bought by Sun, the original Java Developers, and then was rereleased as open source. It does not have the number of plugins that Eclipse does, nor does it have the automated updater that eclipse does, but it leads to a more streamlined and cleaner interface (again, my opinion)

Sun was bought by Oracle, who also develops JDeveloper, so the future of Netbeans could be in question. I've personally never tried JDeveloper, but I intend to.

Another IDE is intelliJ, which is very good but must be purchased for business use.

The biggest difference I have found between Eclipse and Netbeans is the build engine. Eclipse requires your build path be configured in the project settings, and builds the code internally. Netbeans requires that you have an Ant or Maven build script, and uses those tools to build your project. Either method is fine, but Netbeans uses the same build procedures that you would use when building the code for release into the wild. Most people do not build their code for production using Eclipse, but rather have an external build script to do so.