20 questions on a variety of topics to aid me learn Java.

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4

53 Replies - 2048 Views - Last Post: 22 January 2013 - 07:54 AM Rate Topic: -----

#16 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 822
  • View blog
  • Posts: 2,529
  • Joined: 29-July 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 06:43 PM

I smell homework in disguise.
Was This Post Helpful? 0
  • +
  • -

#17 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10376
  • View blog
  • Posts: 38,415
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 06:45 PM

I think the topics are too far apart for this to be homework. A professor probably isn't going to jump from constructors to interfaces to GUI Programming so quickly.
Was This Post Helpful? 2
  • +
  • -

#18 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,688
  • Joined: 19-March 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 06:50 PM

I agree with mac. Honest curiosity run amok is my guess.
Was This Post Helpful? 0
  • +
  • -

#19 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:09 PM

Ah thanks for your replies. No this is not homework, I have even said that I am not taking any classes to do with programming and I am doing this as a hobbie hoping to turn it into a profession.

Yeah, I do feel like I am trying to do something I can't, so I'm going to look at the simpler stuff for a while.

Just as a side question, (I've had this in my head for MONTHS) is there any real point to setters and getters? (Forgotten the technical terminology for it) Every tutorial I read and every book I read always mentions setters and getters. I've asked quite a few people and a lot of them say they don't use them very often, maybe once every now and then in a random class when they can't be bothered to re-write code. Everywhere I see where it's explaining setters and getters they are always going on for 20 pages or so or going on for quite a while implying that maybe they are an important thing to use. All I see is them being used for when you can't be bothered to write things in one whole class to use setters and getters to transfer data across from classes. Anybody mind sharing their opinion on this?

Thanks.
Was This Post Helpful? 1
  • +
  • -

#20 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10376
  • View blog
  • Posts: 38,415
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:11 PM

Getters and setters go towards a point called encapsulation, which is a big part of OOP.
Was This Post Helpful? 0
  • +
  • -

#21 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 822
  • View blog
  • Posts: 2,529
  • Joined: 29-July 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:13 PM

View PostDrPerry, on 22 January 2013 - 02:09 AM, said:

Ah thanks for your replies. No this is not homework, I have even said that I am not taking any classes to do with programming and I am doing this as a hobbie hoping to turn it into a profession.

Yeah, I do feel like I am trying to do something I can't, so I'm going to look at the simpler stuff for a while.

Just as a side question, (I've had this in my head for MONTHS) is there any real point to setters and getters?


You will get varying opinions. I like them, and use them all the time to share data between objects. You can design without them, but I am of the opinion that they are used so frequently, in even the Java APIs, that it is pointless to try and avoid their use. Java isn't a purely OO language to begin with, so why bother fighting it.
Was This Post Helpful? 0
  • +
  • -

#22 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:16 PM

Encapsulation! That's it!

I've asked a few people, especially those who make games and they all say they use it rarely and they are kind of pointless. What's your view and how often do you use them?

Thanks.

Ah thanks, I'll bear that in mind. I just wanted to know if you could survive without them because in my opinion I just simply don't see any point in them and I was just worried that I'd have to use them a lot.
Was This Post Helpful? 0
  • +
  • -

#23 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10376
  • View blog
  • Posts: 38,415
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:17 PM

The whole point of encapsulation is to provide only the necessary access to the inner workings of the class. I'd say it's far from pointless to use them. You can always provide more access later, but you can never restrict access once you provide it. You should write code with this in mind.
Was This Post Helpful? 0
  • +
  • -

#24 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:19 PM

Oh ok, I never thought of it like that. Thanks opinion.

I just love how Eclipse let's you right click the screen and select source -> generate setters and getters. I love it.

Thanks for all the help. :-)
Was This Post Helpful? 0
  • +
  • -

#25 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10376
  • View blog
  • Posts: 38,415
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:20 PM

Glad to help!
Was This Post Helpful? 0
  • +
  • -

#26 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 822
  • View blog
  • Posts: 2,529
  • Joined: 29-July 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:21 PM

View PostDrPerry, on 22 January 2013 - 02:16 AM, said:

Encapsulation! That's it!

I've asked a few people, especially those who make games and they all say they use it rarely and they are kind of pointless. What's your view and how often do you use them?

Thanks.

Ah thanks, I'll bear that in mind. I just wanted to know if you could survive without them because in my opinion I just simply don't see any point in them and I was just worried that I'd have to use them a lot.


I can't imagine game objects not communicating with another game manager object via getters and setters. Of course this just may be a failure of my imagination. :) Did any of them give you any examples?
Was This Post Helpful? 0
  • +
  • -

#27 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:25 PM

No unfortunately not. I did however ask one of them to code me a simple snake game with lots of annotations. I'm interested to see if he uses encapsulation considering he said it was pointless and he never uses it.

If you message me your email or any kind of contact detail I will provide you with the source code without setters and getters (if he doesn't use any) if you're interested at all.

He should have it done in the next few days. :-)
Was This Post Helpful? 1
  • +
  • -

#28 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,688
  • Joined: 19-March 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:26 PM

I suspect the the "smart questions" link hasn't really been digested.

Look, let's make this really simple and plain: if you want answers, you're going to have to stop just firing off questions hoping that one of them will produce an answer that obviates the need for hard work on your part. I think you're probably a smart kid, and I honestly respect your curiosity, but you have to understand that there is plenty of material out there to satisfy that curiosity if you put in the trouble to study some of it. One of the key tenets of good programming style is "Don't repeat yourself". Or, as my advisor in college put it, "save ink". If it's already written down, go find it and read it. If you need more explanation, that's the time to ask questions.

Start with the Tutoracles. Work your way through them, and run all the code you find there, but don't stop there. If you've understood what's in a tutorial, you will be able to think of ways you can change some of the code, and you should have some ideas about what those changes will produce. Try these things - if this isn't a fun game for you, you're probably not cut out for programming.

You see, hacking is not just about curiosity - it's about applied curiosity. "What happens if I do this?" "What happens if I change this line of the code?" "What's on the inside of this padlock? How can I get it to open without using the key?" "What's this Chinese Remainder Theorem, and what does it have to do with encryption, anyway?" "That's a cool pattern, can I figure out how to knit it?" You can hack anything, but hacking is always active. Passively pelting questions at people is a sign that you're not a hacker.

So stop it. Go learn something, then come back and ask questions that show you've been learning something. Do the research, then start hacking, and come back when you have one question that you actually understand. Ask that.

This post has been edited by jon.kiparsky: 21 January 2013 - 07:32 PM

Was This Post Helpful? 4
  • +
  • -

#29 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:35 PM

I understand your frustration at my pointless questions and my need for information I could probably find on Google. The problem is I do Google them, I look through forums and I don't understand them I ask my friends. I then post the questions as a last resort and then I get people like you who think I haven't researched it already. I'm only asking here so I can maybe get other views and opinions from people who are probably more experienced than anyone I have met and I can actually ask them stuff instead of reading a tutorial and having no way of asking a million questions due to confusion.

I will look though those Tutoracles. I have read a few of them but sometimes I feel they code everything really differently to everyone else. Just completely differently. That might just be me, but that is my opinion.

Also, this isn't about hacking. This is about Java and game development.

Also, I never said someone HAD to answer them, it doesn't hurt ANYONE to ask a question. If nobody answers, that sucks. If someone is nice enough to answer then awesome. At the end of the day, I have lots more views on the question I asked and a lot more information I would have had from just one source.
Was This Post Helpful? 0
  • +
  • -

#30 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10376
  • View blog
  • Posts: 38,415
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 07:39 PM

Quote

Also, this isn't about hacking. This is about Java and game development.

What jon.kiparsky means by hacking is tinkering with code to learn something. Seriously- write some code and play around with it to see how it behaves. That's the best supplement to any online resource. Start there and play around with your code so when you do ask questions, you have a really good idea of what type of behavior to expect from the code.
Was This Post Helpful? 1
  • +
  • -

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4