Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Shaquil

Member Since 03 Aug 2011
Offline Last Active Jun 07 2013 07:31 PM
-----

Topics I've Started

What are some real world practices students should know?

07 June 2013 - 09:35 AM

I always hear from professional programmers (especially on forums) that in school, students rarely learn how to use real world tools and techniques for better code like Version Control.

 

Aside from that, what are other things you use in the real world that students generally don't learn? Maybe some things you had to learn about when you started working, but knew nothing about in school. Below is what I've heard from others already:

 

  • Version Control
  • Profiling (Don't know what this is)
  • Unit Testing (Don't know what this is)
  • Code Reviews
  • Pair Programming

The most interesting concepts are things that can be done alone to improve code, like Unit Testing and Profiling. I'd prefer concrete things like that rather than the sort of general tips you might find in a Joel Spoelsky blog. Sorry if this question has been asked before. I couldn't find it on Google.


[JAVA] Upcasted Anonymous Classes: Can You Access Unique Fields/Methods?

02 June 2013 - 09:13 AM

The book I'm reading doesn't make it clear, but I'm wondering if it's possible to access the unique fields and methods of an anonymous inner class that is upcasted to another. For example:

 

class Base{
  public int y = 10;

  public int returnStuff(){
   return y + 50;
  }//end of returnStuff

  public void printStuff(){
    returnStuff();
    System.out.println("The value: " + y );
  }//end of printStuff()

  public Base upcastAnonymous(){
    return new Base(){
       public int x = 5;
       {
         y = 30;
       }
    }//end of Anonymous Class
  }//end of upcastAnonymous

}//end of Base

public class EntryPoint{

  public static void main(){
    Base One = new Base();
    Base Two = One.upcastAnonymous();
    Two.printStuff();//I know this is gonna work, but...
    System.out.println(Two.x);//Is there any way to access Two.x here? I know this code won't compile.
  }//end of main()

}

 

I'd just like to know if there's some method of getting at Two.x that my book hasn't mentioned. I haven't found anything about it online. If you can't access the unique fields/methods once the class has been upcast, then are anonymous inner classes mostly for overloading a few methods without creating an entirely new class to do so?


[JAVA] What if I don't define the toString() method?

24 May 2013 - 06:17 AM

I'm going through a Java book, and the author mentioned that anytime I try to convert an object to a string, the compiler will call that object's toString() method. Example:

 

 

ExampleObject A = new ExampleObject();//toString() is not overridden in the class definition

System.out.println("to String = " + A);//What is going to happen now?
 

 

 

Although in his example, he did override the toString() method in his class, he never says what'll happen if I don't do that. Looking online a bit, I couldn't find an answer, but it is clear that even if toString() is not overridden it will be called, will return a string, and the compiler won't yell at me. So what exactly is going on? Also, could anyone explain why in god's name this was a good idea to build into the language?


Designing A Points/Probability System

16 May 2013 - 07:11 PM

I want to design a system that suggests books to a user based on ratings the user has provided. The user would rate genres/categories of books, and the system would use those ratings to suggest random books to the user, with the probability heavily weighted toward books in the genres the user rated highest.

 

Are there are any sort of algorithms/design patterns that already exist that sound similar to this? I'm having trouble figuring out the proper way to google for this sort of idea, but I'm sure it's been done before.

 

EDIT: The reason I don't make it a system where you just add up all the points and give each category a percentage equal to its percentage of the point total is because some categories will have 0 points, but should still at least have a chance of winning.


Ways to Get to California

14 April 2013 - 03:55 PM

At the risk of sounding as stupid as I am, I'd like to ask for some ideas, if you guys have any. My goal is to move to San Francisco and see what life is like in Silicon Valley. Not tomorrow, but as soon as I can. The barriers are pretty common: No relatives, jobs, or potential places to stay once I get there. Yet as a programmer, I can't help but think "There's definitely a solution." Off the top of my head, I know from my background in literature that some organizations will grant winners of writing contests fellowships--basically you get an expenses paid stay at some university somewhere and hang out with other writers while you create your opus. Maybe there's something similar for programmers that can send me somewhere in California? I was also thinking there might be internships? My lack of many good ideas is why I'm posting here in the first place. Off the top of your head, do you know of any programs/organizations sending people from the East Coast to the West?


PARTNERS