Sheph's Profile User Rating: -----

Reputation: 432 Architect
Active Posts:
1,018 (0.88 per day)
12-October 11
Profile Views:
Last Active:
User is offline May 07 2014 11:49 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Icon   Sheph is probably programming.

Posts I've Made

  1. In Topic: What is the difference, if any, between an element and an index?

    Posted 17 Apr 2014

    I like the library analogy. A bookshelf would be a good metaphor for an array. Each book would be an element and the index would be the location of the book. The book at index 0 would be the book furthest to one end, and you reference books further towards the other end by increasing the index.

    Book[] shelf = new Book[100]; // make a shelf with slots for 100 books
    // Next, loop through all the slots and place a book
    for(int i = 0; i < shelf.length; i++) {
        // the variable i is used as the index
        shelf[i] = new Book("Green Eggs and Ham"); // place a new book at the location (or index) i on the shelf
    System.out.println(shelf[99]); // print the last book on the shelf.
  2. In Topic: Best way to access images that I use in 2 classes.

    Posted 12 Apr 2014

    That would be adding static to them... Consider looking into some of the other things I said unless you are happy with this. (imagine taking away the static modifiers and passing an Images object into both areas of the program that need access to the images. That might be a way to avoid static.) You should experiment a little bit and see what you prefer.
  3. In Topic: Best way to access images that I use in 2 classes.

    Posted 12 Apr 2014

    static is one solution. There are others. Consider the singleton pattern (still uses static, though less likely to get points taken off as it is a recognized design pattern), or simply put them in one object and pass that object around to anyone who needs the images. Make sure you don't create more than one object with the images (see singleton pattern)

    If you do end up putting static modifiers on anything, since you nearly always get marked down... just put a comment near every instance of the word static explaining why you used it. In this case, I would put something above the block of static image declarations saying that you made them static to avoid recreation of images when a new object is made. This will at least show that you know what you did and that there is a reason behind it. After all, that is what a good teacher should be looking for... that you can think on your own.
  4. In Topic: need help with text based game

    Posted 12 Apr 2014

    So just for the sake of everybody reading, were you able to clear up your first problem with the null pointer exception?

    You are storing multiple items, and you are returning 1 item. There is obviously a discrepancy, but there are a couple ways to fix it. Either store just 1 and return 1, store multiple and return multiple (let game handle dividing them), or store multiple and choose 1 to return (the first one, the last one, a random one, etc.) I say for now, if one room can only have one item, you should just store one, until you decide to change it at some later point.
  5. In Topic: Form with 3 SubForms - Design pattern help

    Posted 12 Apr 2014

    If Form is actually going to provide a useful interface or functionality in practice (ie handle interface elements), then I would say go ahead and extend like you are. But if Form is only providing processForm method, why do you need that method at all? I would have something like this:
    public class SubForm1 {
    	ImmutableData1 data;
    	public void processData() {
    		// validate Data
    		// send data to next Form
    public class SubForm2 {
    	ImmutableData2 data;
    	void init(ImmutableData1 prevData) {
    		// merge prevData into data;
    	void processData() {
    		// validate Data
    		// send data to next Form
    public class SubForm3 {
    	ImmutableData3 data;
    	void init(ImmutableData2 prevData) {
    		// merge prevData into data;
    	void processData() {
    		// validate Data
    		// close form?

    If Form did provide some special functionality, like a GUI, you could move processData to the Form class, and have them all extend Form, and have that be the default method for when the user hits the submit button. If this is the case, you could move init as well and use double dispatch like you did for that method. But take what I'm saying with a grain of salt. I have no idea the specifics of the project, so I might be overlooking an important detail or over complicating it. Hope I could help.

My Information

Member Title:
D.I.C Lover
23 years old
January 7, 1991
Tennis, Karate, Board & Card Games, Fantasy Novels
Full Name:
Richard Shepherd
Years Programming:
Programming Languages:
Java, C++, html, CSS and javascript.

Contact Information

AIM  Sheph1220
Yahoo  Richjm12


Page 1 of 1
  1. Photo

    helppp Icon

    09 Feb 2013 - 21:48
    Can someone answer this for me Ill rep you
    sorry fro spamming
  2. Photo

    Sheph Icon

    07 Dec 2012 - 03:59
    Why, thank you! :)
  3. Photo

    raghav.naganathan Icon

    07 Dec 2012 - 03:44
    Congrats on the 400 :)
  4. Photo

    .Aaron Icon

    12 Jul 2012 - 23:24
    "It's printLn() (lowercase L) - not printIn. Why would an OutputStream have an IN function? :)"
    [Insert the thumbs up emoticon here]
  5. Photo

    fromTheSprawl Icon

    18 Apr 2012 - 19:10
    Oh, hey there, wasn't intentional, not trying to do a "Club 27" there. Things just got too much, I found something I want to do, rode a unicorn, found out there was no candy on top of Mt. Everest, and hitchhiked the way back here. So... sup? Hahaha.
  6. Photo

    Sheph Icon

    04 Mar 2012 - 22:11
    Thanks, Mylo. You are actually the reason I made it. I saw your suggestion in the tutorial suggestions thing when i was looking to become a contributor.
  7. Photo

    Mylo Icon

    29 Dec 2011 - 21:06
    The bitwise tutorial is appreciated =) I may learn a few more things from it
  8. Photo

    Sheph Icon

    10 Dec 2011 - 19:58
    Oh nice. Yeah I answered like 3 of those questions in 30 minutes one day, and after a while you start wondering why it isn't common sense.
    Side note. You are a creeper to come by that quickly. What do you have my profile monitored? jk
  9. Photo

    Sho Ke Icon

    09 Dec 2011 - 09:27
    " It's printLn() (lowercase L) - not printIn. Why would an OutputStream have an IN function? :) "
  10. Photo

    Sheph Icon

    08 Dec 2011 - 21:32
    I just changed it. Which part? the random order?
  11. Photo

    Sho Ke Icon

    08 Dec 2011 - 15:58
    Your signature made me giggle. *goes back to lurking*
  12. Photo

    Sheph Icon

    06 Nov 2011 - 17:00
    Yeah! Thanks for noticing! :)
  13. Photo

    DimitriV Icon

    06 Nov 2011 - 12:57
    You're a stalwart!
Page 1 of 1