Results 1 to 7 of 7
  1. #1
    drperry is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Default A rather long post of me talking gibberish and asking LOTS of questions. Please read!

    ================================================== ================================================== ===
    Before reading this MASSIVE post, please read the bottom at the stupid amount of P.P.S.'s as they probably have a lot of information that I forgot to put in the middle or something.
    ================================================== ================================================== ===

    Hi, I'm some guy on the internet and I am 15 years old. For the sake of this post and the answers I hope to have, please ignore my age and understand my maturity and I hope that you can understand why I would like to learn this language so much. I seem to have major issues with learning this language and online tutorials and stacks of books do not seem to do the trick. Please do not reply saying "this is not for you, try something else" because although I do not know much in Java in terms of making good applications, I have learned quite a few things and I am able to make simple things with the console such as making a calculator where the user has to type in what operator they want to use and then they are asked to enter two numbers in which they are timed/added/divided etc. together and it gives the answer. Considering this I really want to continue learning this language because I find it fun to learn and fun to program in, yet I am having serious stress issues because I can't understand simple things and I just forget some of them and I then find it difficult to make simple applications. For example, I am trying to make a simple snake game where you have to find all the apples and eat them and then your body grows larger etc. but I just can't think of how I would do it. I know a few simple application type things and maybe how to put them to use, but I just don't know how to use them in this situation and how to start off making games like these.

    Just to tell you a little bit about my background of programming, I have known about programming since I was about 11, I made a virus in Visual Basic believe it or not. It would disguise itself as Mozilla Firefox and would slowly delete random files that were opened or edited in the last month starting from the last used files in said month. It would delete a set amount of files every time you booted up and it was pretty nasty. It was obviously quite easy to get rid of it and it probably had many bugs, but it was a nasty virus nonetheless. Anyway, that lasted around 2 months and I never really picked up on programming until around 13 at which point I learned a bit of Java up until the System.out.println part, so not very far at all and I barely understood anything. Then I kinda picked it up at 14 last summer (2012) and learned almost as much I know now over the summer holidays and then kind of left it until after Christmas because I couldn't really get past a certain 'barrier' so I got bored and gave up. Until now. After Christmas I got back into it and starting learning a few more things, understood functions a little more and downloaded a bunch of source code from lots of different websites. I've now been extremely stressed out for the past 2 weeks going crazy because I can't fit anything else into my head because I just forget it or just don't understand it. So I am now in a complete frenzy not doing homework, being a douche to my friends and just not being very social or doing stupid things.

    Unfortunately this is going to be a rather long post as you can probably already tell and there will be a 20 Q's kind of 'game' below where I ask things that I desperately need to know and maybe things that I want to know but don't necessarily need to know.

    If you can, I would greatly appreciate it if you could answer all of the first 14 questions in one post instead of 1 or 2. Also, please do not post anything unnecessary or nasty as I am a new poster here and I just want to get started in Java and I have my own reasons for starting at such a young age and my intentions are rather personal. So please treat this matter with maturity and I hope someone can really help me.

    I am sorry for any misspellings or grammatical errors, I am fully English, I am just rubbish at spelling.

    THE QUESTIONS!!!

    1) What is SUPER used for, when should I use it and why should I use it?

    2) When making a new class and you type PUBLIC [insert class name here](){} what does this do and why does it need to be the same name as the class it is in?

    3) Why do you need to make new classes inside already made classes sometimes?

    4) What is the use of NEW and why do you need to use it when you are creating something like a JFrame, where for example you would use it in your main function and have NEW [insert name of function with JFrame inside]();, why can't you just do [insert name of function with JFrame inside]();?

    5) What is actionPerformed, where is it used and why should I use it?

    6) When using a function, what is achieved when you call another class and make another variable inside said function? Eg, public [insert class name here]([insert other class name here][insert new variable name here]){}

    7) What 'type' is an ENUM? Is it an int? String? Double? So if I were to make ENUM [insert name of enum here] {A, B, C, D, E, F, G}; So what would happen if I were to say PUBLIC [insert name of enum here] B = 5; what would that mean? Would that assign it as an integer?

    8) When should I use enums, what is the point in them?

    9) What does [inset object here].ORDINAL mean? What is it used for and when should I use it?

    10) Although I understand that the RETURN statement is used to end a function and return it with a value if there is one specified, but when it returns it with that value that you may have specified, what happens to that value, how do I retrieve it and how do I use it? When will I know when to use RETURN?

    11) Briefly explain how to use KeyEvent, getKeyCode and just anything else to do with accepting user input and how I would use it.

    12) When using the KeyAdapter, why do you need to make a new class inside an already made class? What does this achieve? Why can you not extend it on the current class you are using instead of making a new class? This links back to the 3rd question.

    13) What is the difference between ++object and object++? Does it really matter which way I use them? Why should I use them differently and how will it affect my code if I use them differently?

    14) What's the difference between an IF statement and a BOOLEAN statement? They are both booleans and if used correctly can be used to do the exact same thing with just one or two lines of codes difference. Which one should I pick over the other and why? Which one is better to use for what kind of things?

    ================================================== ================================================== ===
    POINTLESS QUESTIONS THAT I JUST FEEL LIKE ASKING THAT DON'T NEED TO BE ANSWERED AND DON'T HAVE MUCH TO DO WITH THE CODE ITSELF
    ================================================== ================================================== ===

    15) What is the best way to get into the mindset of 'a programmer'? What is the best way to understand the ways in which you would build an application and learning the step by step processes so you know what you have to do next and how to do it.

    16) I seem to always be worried that it takes programmers 5 minutes to program a very simple game, like Tetris because I've seen videos and just other places where it makes it look like it takes them a very small amount of time to make something that might take me months to learn. Is this how it works? Or can it take hours to program 5 classes for a very simple game? If so, why does it, if said programmer hypothetically understands the language well enough to make said program? Surely they would know what to do and how to make it so it would not take long at all?

    17) How often are IF and ELSE statements used in common programs? I feel when I am making a program I am always using them too much and I just stop programming from there because I feel that I am using too much of something so maybe it isn't the right way to do it or maybe there is a better way to do it.

    18) What would be the best way to learn programming for someone who finds it difficult to teach himself said topic yet has no efficient way to have someone teach him? I feel I am somewhat intelligent enough to learn a programming language, I have gotten this far, so I feel I should just keep going. Besides, despite the difficulties I have and the ridiculous amount of stress I get from not being able to learn on my own, I find it very entertaining to program things, read over other peoples code and slowly learn the world of programming. I feel that I see myself as a programmer in the future and I just really hope that I can learn this language quickly before I am too old to have time to learn this as a hobbie as I do now.

    19) I am someone who hopes to become a games developer as I thoroughly enjoy playing games as much as I do finding out how they work. What would be the right way about learning how to make games? Should I stick with Java or should I go to C++? I've only stuck with Java because I have more experience with it and I feel that I should learn an easy language and get used to OOP and other things before I go off making complex programs with a difficult language. I know how to print something to the console in C++ and that's about it.

    20) I have no way of having an education on programming in my school at the moment and all courses that have programming in them aren't very good - you make a simple application for coursework and you do a computer physics exam at the end of the year, not too helpful for me. Also, I don't have many friends that are diversed in any language of programming and the ones I do have, coincidentally, absolutely none of them are any good at making games or painting anything in graphics or anything to do with frames and windows. They're all about the console and making mods for games instead of making full on programs with a window and what not so it's difficult to get any of them to teach me anything. I've looked at college courses and none of them are for my age and what I am wanting, or they are just too damn expensive. I have also looked at online courses, one-to-one tutoring etc. but they are either way too expensive or they aren't very good in terms of being in a country half way across the world or maybe they have bad ratings. Anyway, what I'm trying to ask, despite all the negative put backs and all the issues that seem to follow me whenever I try to learn this damn language, what would be the best way to teach myself this language or any other language, or where are the best places to have someone teach me for free/cheap prices? I just essentially want to make something basic like a video game like Tetris or something so I at least have some knowledge of making a video game so I can maybe learn other things much easier.

    P.S. I am in top sets for all my classes at school, so any intelligence issues aren't a part of this. I guess you could maybe call it laziness, but I just prefer to say that I am too used to people teaching me things and doing things for me rather than teaching and doing things myself. So if I were stuck on an island alone I really would not know what to do at all because I would mainly rely on other people.

    P.P.S. Just for anyone's curiosity, I use Eclipse as my IDE on a Windows 7 Ultimate OS.

    P.P.P.S. I am British.

    P.P.P.P.S. I have read through about 4 books about Java, but on most of them I just get really bored and stop reading them half way through because they either don't explain what I want to know or they really suck at explaining what I want to know.

    P.P.P.P.S If you are going to post a good tutorial, please post one that I have most likely NOT been on. PLEASE. I have gone through MANY tutorials which all of them don't do me any favours. Please post one that you think that I might not have seen and actually tells me what EACH line of code does and WHY it does it and WHY I might use it and WHERE I might use it. Etc.

    P.P.P.P.P.S If this is a TL;DR kind of post, then I am awfully sorry to have bored you, please go onto another post, but thank you very much for taking the time to actually LOOK and CLICK on my post. However if you do not have any intention of helping my dilemma, please leave as although I am asking for A LOT for FREE, I really don't need pointless posts that really do not solve my problem. Thanks.

    P.P.P.P.P.P.S (Last P.P.S I swear! I just keep forgetting things.) If you have any questions to ask or I might not have asked something properly, feel free to ask as I will probably be refreshing this page non-stop for the next 2 weeks. Thanks ^^

    For all the people out there who are THAT awesome to post here answers to these questions, I really salute to you and I would VERY gladly give you money for your time and effort, if I had the funds to give you what it's worth. ;-)
    Last edited by drperry; 01-22-2013 at 01:13 AM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r


  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r

    Moved from New to Java.

    Recommended reading: How to ask questions the smart way

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r

    1) What is SUPER used for, when should I use it and why should I use it?
    It's a reference to the super class of the current or referenced class. You use it to call a method to a super class that is being overridden or isn't overridden in the current class. A common example is in a JComponent where you call the super's paintComponent method before implementing your own overridden paintComponent logic.

    2) When making a new class and you type PUBLIC [insert class name here](){} what does this do and why does it need to be the same name as the class it is in?
    It's the constructor. See Providing Constructors for Your Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)

    3) Why do you need to make new classes inside already made classes sometimes?
    You don't 'need' to, but when you do, it's a local class. It's a common OOP idiom - if a class is only used in the context of another class, sometimes it makes sense to nest it to hide it from the outside world. An example might be a Node class inside of a Tree or Graph data structure.

    4) What is the use of NEW and why do you need to use it when you are creating something like a JFrame, where for example you would use it in your main function and have NEW [insert name of function with JFrame inside]();, why can't you just do [insert name of function with JFrame inside]();?
    new is a java keyword which invokes instantiation of a new object. It tells java to allocate memory and build an object. It isn't a function name, it's an Object name. JFrame is an object.
    Java Code:
    JFrame myFrame = new JFrame();
    is a call to the JFrame constructor to build a new JFrame object. You need to use new, because without it, you are implying something is static. Object creation usually isn't static like that.

    5) What is actionPerformed, where is it used and why should I use it?
    It's for event handling, and it's used when you want your app to respond to events - like button clicks or window resizes.

    6) When using a function, what is achieved when you call another class and make another variable inside said function? Eg, public [insert class name here]([insert other class name here][insert new variable name here]){}
    The formatting idiom you describe is just statement nesting. What happens as a result depends on what method you are calling. For example, if I had some class called Car, and it had a setDriver() method, I might do something like this:
    Java Code:
    Car myCar = new Car("Scion");
    myCar.setDriver(new Driver("Quad64Bit"));
    In this example, I made a new car, and then created a new driver object inside the setDriver method. The above is synonymous with:
    Java Code:
    Car myCar = new Car("Scion");
    Person me = new Person("Quad64bit");
    myCar.setDriver(me);
    I should mention that the convention is that methods that start with 'set' store a reference or value, where has 'get' methods return values.

    7) What 'type' is an ENUM? Is it an int? String? Double? So if I were to make ENUM [insert name of enum here] {A, B, C, D, E, F, G}; So what would happen if I were to say PUBLIC [insert name of enum here] B = 5; what would that mean? Would that assign it as an integer?
    enum is a keyword that allows you to define your own types - it is not an int but a special type of object. Going back to car analogies, rather than storing the type of vehicle in a string, or as an index in a lookup table, you can create enum types like:
    [code]
    public enum VehicleType{
    MOTORCYCLE, COMPACT, COUPE, TRUCK, SEMI, CONVERTIBLE
    }
    [code]
    So, we can give every Vehicle class a VehicleType field, and then pick a type from the supplied list of VehicleTypes, such as COUPE.

    8) When should I use enums, what is the point in them?
    Use them in place of generic integer types and when you want to be clear as to what your code does with types. Rather than assuming someone knows that a motorcycle is a 0, a compact is a 1, a coupe is a 2, and so on, you can use an enum with a plain english type name rather than a cryptic int value.

    9) What does [inset object here].ORDINAL mean? What is it used for and when should I use it?
    Not any old objects, just enums. This method is described in the API - see Enum (Java Platform SE 7 )

    10) Although I understand that the RETURN statement is used to end a function and return it with a value if there is one specified, but when it returns it with that value that you may have specified, what happens to that value, how do I retrieve it and how do I use it? When will I know when to use RETURN?
    If I had a simple method called add:
    Java Code:
    //this method adds two integers and returns the result
    public static int add(int a, int b){
        return a + b;
    }
    
    //...
    
    public static void main(String[] args){
        int num1 = 3;
        int num2 = 2;
        int sum = add(num1, num2);
        System.out.println(sum); //this would print 5
    }
    You can see how I used what add returned and saved it in my result field.

    11) Briefly explain how to use KeyEvent, getKeyCode and just anything else to do with accepting user input and how I would use it.
    This is for GUI work - I don't think you're there yet. I would hold off on this

    12) When using the KeyAdapter, why do you need to make a new class inside an already made class? What does this achieve? Why can you not extend it on the current class you are using instead of making a new class? This links back to the 3rd question.
    See Above

    13) What is the difference between ++object and object++? Does it really matter which way I use them? Why should I use them differently and how will it affect my code if I use them differently?
    Yes it matters. One increments and then reads, the other reads then increments. You will get totally different behavior than you expect if you don't use the one you intend.

    14) What's the difference between an IF statement and a BOOLEAN statement? They are both booleans and if used correctly can be used to do the exact same thing with just one or two lines of codes difference. Which one should I pick over the other and why? Which one is better to use for what kind of things?
    if is a statement construct, boolean isn't. Perhaps you mean a conditional statement? An if statement requires a conditional statement as it's input - not entirely sure what you mean by this one. Please provide a code example of each and I can clarify.

    ================================================== ================================================== ===
    POINTLESS QUESTIONS THAT I JUST FEEL LIKE ASKING THAT DON'T NEED TO BE ANSWERED AND DON'T HAVE MUCH TO DO WITH THE CODE ITSELF
    ================================================== ================================================== ===

    15) What is the best way to get into the mindset of 'a programmer'? What is the best way to understand the ways in which you would build an application and learning the step by step processes so you know what you have to do next and how to do it.
    Do. It. A. Lot. It's all practice. Want to think like a veteran 10 year programmer? Program for 10 years. Seriously, it's all practice.

    16) I seem to always be worried that it takes programmers 5 minutes to program a very simple game, like Tetris because I've seen videos and just other places where it makes it look like it takes them a very small amount of time to make something that might take me months to learn. Is this how it works? Or can it take hours to program 5 classes for a very simple game? If so, why does it, if said programmer hypothetically understands the language well enough to make said program? Surely they would know what to do and how to make it so it would not take long at all?
    Both. Once you are experienced, then most simple problems can be solved in just moments in your head, and it will actually take you longer to explain it or type it than to actually formulate a solution in your brain. For example, if you asked me to make a snake clone, or a simple version of ms paint, boom - done. I know exactly what I would need to do to make something like that, and it'd take me the next 10-30 minutes to type it all out.

    It can take hours to write 5 small classes if the programmer doesn't fully understand the problem he is trying to solve, or if there is much starting over. For me at the stage where I am at, it's the algorithms that take the majority of the time, not the boiler plate OOP code. That code can be largely automated by an IDE - deriving a working and efficient algorithm for your game logic or data structure is harder. It usually ends up being relatively short code but difficult to derive code that's the worst.

    On the other hand, as a professional programmer, I encounter situations where I spend a week working on code that ends up being only 20 lines for one reason or another. Understanding the problem is 99% of the work a programmer faces, the solution is trivial once the problem is understood. To find solutions as quickly as I do now has taken me 10 years of experience and practice.

    17) How often are IF and ELSE statements used in common programs? I feel when I am making a program I am always using them too much and I just stop programming from there because I feel that I am using too much of something so maybe it isn't the right way to do it or maybe there is a better way to do it.
    Constantly - though if you find yourself with a long chain of them in a row, you should be using a switch statement, or restructure your code to not require a massive if else tree. I write code daily that nests if/else 2-5 layers deep, but keep in mind that the deeper that shit gets, the harder it is to read an maintain. Making many simple methods to accomplish modular tasks is key to reducing your nasty if else trees.

    18) What would be the best way to learn programming for someone who finds it difficult to teach himself said topic yet has no efficient way to have someone teach him? I feel I am somewhat intelligent enough to learn a programming language, I have gotten this far, so I feel I should just keep going. Besides, despite the difficulties I have and the ridiculous amount of stress I get from not being able to learn on my own, I find it very entertaining to program things, read over other peoples code and slowly learn the world of programming. I feel that I see myself as a programmer in the future and I just really hope that I can learn this language quickly before I am too old to have time to learn this as a hobbie as I do now.
    Just keep chipping away at it. Every day reflect on what you didn't know the day before - helps you keep focused on the progress you made that day. And that never stops - You will never reach a point where you understand everything. Never. It's all about knowing more than you did 24 hours ago.

    Also, some things are just hard. I thought I was a proficient programmer after 6 years of college (undergrad and masters) - almost 3 years as a professional since then have taught me otherwise. Little did I know, but my real education just began when I left college. I don't think that ever changes, and I have a feeling that I will feel that every every 5 years for my entire career.

    19) I am someone who hopes to become a games developer as I thoroughly enjoy playing games as much as I do finding out how they work. What would be the right way about learning how to make games? Should I stick with Java or should I go to C++? I've only stuck with Java because I have more experience with it and I feel that I should learn an easy language and get used to OOP and other things before I go off making complex programs with a difficult language. I know how to print something to the console in C++ and that's about it.
    As a programmer, you don't do just 'one' language. I write about 20 languages. For learning though - just pick one and stick with it. Other languages will come in time. Java is a good learning language since it is very strictly object oriented and simplifies things like memory management. C++ is nasty in that way, I would avoid it for now. Other good learning languages are python, ruby, groovy and a few others - though be careful with dynamic languages when learning - they can teach you bad habits.

    20) I have no way of having an education on programming in my school at the moment and all courses that have programming in them aren't very good - you make a simple application for coursework and you do a computer physics exam at the end of the year, not too helpful for me. Also, I don't have many friends that are diversed in any language of programming and the ones I do have, coincidentally, absolutely none of them are any good at making games or painting anything in graphics or anything to do with frames and windows. They're all about the console and making mods for games instead of making full on programs with a window and what not so it's difficult to get any of them to teach me anything. I've looked at college courses and none of them are for my age and what I am wanting, or they are just too damn expensive. I have also looked at online courses, one-to-one tutoring etc. but they are either way too expensive or they aren't very good in terms of being in a country half way across the world or maybe they have bad ratings. Anyway, what I'm trying to ask, despite all the negative put backs and all the issues that seem to follow me whenever I try to learn this damn language, what would be the best way to teach myself this language or any other language, or where are the best places to have someone teach me for free/cheap prices? I just essentially want to make something basic like a video game like Tetris or something so I at least have some knowledge of making a video game so I can maybe learn other things much easier.
    Wanna make games? Get ready for about 20 levels of math and physics. While simple games like snake, space invader, duck hunt, etc... can be accomplished with very little code, experience, and free tools, modern games require a MASSIVE amount of knowledge before you can even begin. What kind of games do you want to program?

    If you're into the 2D indy game scene, you could get started pretty quickly, and arguably this is the best place to start regardless. And even in the 3D shooter world these days, the games use an engine someone else wrote - so while still very complex, you are essentially doing glorified map modding (assuming the engine's tools are robust). But if you're talking about building game engines, John Carmack style (Doom, Quake, etc...) then you will need a shit ton of math and physics under your belt, not to mention a PHD worth of computer science classes. Modern game engines require master level knowledge of linear (matrix) algebra, advanced calculous, differential equations and maybe number & set theory, game theory, algorithms, formal logic, data structures, physics, engineering, low level languages like assembly and C, OpenGL and DirectX frameworks, Artificial Intelligence, not to mention 3d modeling & optimized tessellation, skinning, etc... the list goes on an on. AAA titles are made by thousands of people over the span of years for many of millions of dollars (many of then anyway) with no one person doing everything (there are a few exceptions to this).

    If thats what you want to do, then expect to practice for at least the next 5 years, and plan to really put in the hours every day. You could be cranking out fun 2D games in no time if you really put your mind to it - but start small. My first game was a text based adventure - and to this day it's still probably the one I had the most fun writing. Go Nuts!

  6. #6
    drperry is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r

    @quad64bit

    I just read through all of this and you sound very experienced with what you are saying. I will take your advice proudly knowing someone of your stature and expertise has decided to help someone like me this much. Thank you very much you have helped a lot.

    I hope you can walk away from this thread knowing you have truly inspired me and given me the hope and knowledge to hopefully continue and be something great.

    Thanks very much. :-)

  7. #7
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: A rather long post of me talking gibberish and asking LOTS of questions. Please r

    Great, glad to hear it. Hang in there!

Similar Threads

  1. Replies: 0
    Last Post: 01-17-2013, 01:12 AM
  2. Lots of my folders have become read-only
    By Manoeuvre in forum Eclipse
    Replies: 5
    Last Post: 12-02-2008, 12:48 PM
  3. how to post a long text in an editor
    By bachtoutou in forum New To Java
    Replies: 3
    Last Post: 06-06-2008, 02:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •