Using switch and for loops!

Discussion in 'Resources' started by ZodiacTheories, Jun 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ZodiacTheories

  2. Offline

    Necrodoom

    What's the problem with using an actual Java tutorial? This is not an actual resource, but rather an attempt to explain basic Java tutorials.
     
  3. Offline

    HeadGam3z

    ZodiacTheories
    Actually the for loop stops when i is equal to 12. Because if it stopped when i is less than 12, it would never start. :)
     
  4. Offline

    ZodiacTheories

    HeadGam3z

    Oh yeah :p

    Necrodoom

    Lots of people on Bukkit don't bother to read Oracle's page on switch and for loops. I also find the Oracle documentation a bit boring to read :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    Necrodoom

    ZodiacTheories as opposed to reading a non-resource on bukkit resource section?
     
  6. Offline

    ZodiacTheories

  7. Offline

    Necrodoom

    ZodiacTheories might as well make this a link to oracle tutorials, or other well made tutorials, because you are describing the switch and for loop very narrowly, and you are not giving actual useable examples (switch, for example, in your post, uses an unknown variable type, which doesn't match how you use the if-else at all, while the for loop doesn't show an actual functional usage of one, and your "enhanted for loop" expects the user to read the bukkit java docs and understand how lists and arrays work, yet somehow not loops, which is pretty much a core concept with working with these)
     
  8. Offline

    ZodiacTheories

    Necrodoom

    I don't get anything from making this, I get no money or anything. I made it using my own time which I mostly use for studying. I was just trying to help people. Sorry if this isn't good enough for you.
     
  9. Offline

    Necrodoom

    ZodiacTheories I have nothing against people who aren't familiar with the subject, the problem is when these people put tutorials to other people who aren't familiar with it, creating a circle of ever increasing wrong information and confusion.

    Basically, you wouldn't want, as a newbie, to follow a tutorial, then find out that they have been doing it completely wrong, because the tutorial maker does not know the subject well. See people overusing static in the plugin development forums, or people trying to use the bukkit API without any Java knowledge.
     
    Garris0n likes this.
  10. Offline

    ZodiacTheories

    Necrodoom

    Ok, I get you, I sort of took your argument as you were going mad at me because you thought that I was doing this for a prize or something. I tried to make this as less-detailed as possible just to give people a basic understanding of what they do. I am quite familiar with switch and for loops, it is just I didn't want to use language that was too technical as I doubt many experienced plugin developers like yourself, for example would be reading this because they do not actually know about switch and for loops. My target audience were people that wanted a basic understanding of what they do, not the people that thought that they would be pros after reading this.

    Sorry

    -Zodiac
     
  11. Offline

    Jogy34

    I really hate when people take the time to write, on the bukkit forums, a bad tutorial on some 100% Java functionality (not explaining anything bukkit related or even how you can use this with bukkit in a realistic way) that they don't fully understand themselves.

    Here are a few things wrong with this:
    1. You are using classes, not methods, and putting all of your code in the open where it wouldn't even come close to compiling.
    2. It looks as if you are trying to use bukkit objects using methods that just don't exist and variables that you never declared or explain
    3. Your code isn't formatted (this isn't as big as it resets it every time you edit your post but it still is somewhat painful to look at)
    4. You don't explain what a switch/case statement is
    5. You don't explain what you can switch
    6. You use some random (presumably) constants that no one knows what they are
    7. You never broke out of your cases so your code would just fall through any lower down cases (eg. if p.awesomeness() (whatever that is) returns AWESOME (whatever that is) then you would send all three messages to the player)
    8. You never explain what a loop is
    9. You never explain the different sections of the for loop or that they have to be separated by a semi-colon.
    10. You never explain what the enhanced for loop is actually doing
    11. You also never showed any of your code actually being used for anything along with most of it wouldn't even compile.
    And here's a good tutorial to switch statements and for loops (one isn't oracle because apparently people don't want to read their documentation):
    http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html
    http://www.tutorialspoint.com/java/java_loop_control.htm
     
  12. Offline

    Garris0n

    Oracle's documentation is not that hard to read. At all. It doesn't use any sorts of extremely complicated language. If it's using a lot of terms you don't know, you probably need to start at the beginning. The pages themselves do look rather "plain" or "boring", but if you don't even start to read the documentation because you think it looks hard to understand, that's your own problem.
     
    AoH_Ruthless likes this.
  13. Offline

    AoH_Ruthless

    ZodiacTheories
    Besides Jogy34 's and Garris0n 's pretty fantastic explanation of where this tutorial goes wrong, I have my own problem with this.

    You begin this tutorial discussing that elseif statements are ugly and act like they are completely worthless. You fail to discuss what a switch/case statement actually is and its improvements over elseif. You imply that elseif < switch/case in all scenarios, but that is very misguided and completely wrong. What would make this tutorial better, and maybe above the general Java documentation, would be talking about where you can use elseif instead of switch statements to improve efficiency, and where you can use switch statements. Besides, just because something looks ugly to you, doesn't mean it looks ugly to everyone else.
     
    Garris0n and MCForger like this.
  14. Offline

    ZodiacTheories

  15. Offline

    AoH_Ruthless

    ZodiacTheories
    You don't have to be sorry, just try and fix what we told you and learn from mistakes. Maybe a bit harsh, but you kind of have to face up to it if you are going to put your code for the world to see and say "hey, this is the right way to do something" (def. of tutorial). We aren't telling you that you suck or anything or you should just give up, we want you to make this a tutorial that will help the people who actually need it.
     
    user_90854156 likes this.
  16. Offline

    xTrollxDudex

    No, people have to read the documentation, they're just to lazy to do so and won't admit it, so they'll be like "no I learn better looking at videos cri cri".
     
    mythbusterma and AoH_Ruthless like this.
  17. Offline

    ZodiacTheories

Thread Status:
Not open for further replies.

Share This Page