|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
Hyrule19167 Posts
On September 28 2013 22:16 3FFA wrote: What are some good colleges/universities for Computer Science/Game Development in the New Jersey area?
Any good questions I can ask said colleges/universities about their CS/Game Development program? I'm kind of at a loss here.
At the moment I'm a Junior in HS and am investigating Rutgers, Ramapo, Bloomfield, Fairleigh Dickinson, Lincoln Technical Institute, and am looking to try and find some more to help narrow down my search to 'the right fit'. Any comments/experiences of these colleges/universities would also help me. I'm just starting my journey into searching for the right college(I've been to 2 college fairs). I'm grateful for any additional information. Drexel has an excellent CS college.
|
On September 29 2013 18:27 tofucake wrote:Show nested quote +On September 28 2013 22:16 3FFA wrote: What are some good colleges/universities for Computer Science/Game Development in the New Jersey area?
Any good questions I can ask said colleges/universities about their CS/Game Development program? I'm kind of at a loss here.
At the moment I'm a Junior in HS and am investigating Rutgers, Ramapo, Bloomfield, Fairleigh Dickinson, Lincoln Technical Institute, and am looking to try and find some more to help narrow down my search to 'the right fit'. Any comments/experiences of these colleges/universities would also help me. I'm just starting my journey into searching for the right college(I've been to 2 college fairs). I'm grateful for any additional information. Drexel has an excellent CS college.
Rutgers is good for general CS. UPenn as well, and they have a major centered around digital media design that gives you skills that you can use in game development (graphics and simulation, in particular).
|
Just found this thread and it looks really nice and comfortable in here, hi. Since I'm in my last year to school and going to go to university to either study CompSci or CompEng next year I think it's a good idea to start getting into programming already. Yet I'm unsure where to start. So far all programming related stuff I've done was in HTML, CSS, JavaScript (not exactly programming) and Pascal which I had to learn for school. What do you think is a good starting point? Should I start by learning C or is something else better? Does it entirely depend on me and my personal preferences?
|
I would learn C++ or Java. You'll probably learn one or the other in an early class in College, and having a head start will help you understand some main concepts.
Programming in college won't be easy though. You can't miss a single class without being at risk to permanently fall behind due to the fact that every single day will be built off the previous days in the course. If a student misses the first day of programming class they might as well just take the F now and get it over with.
I would learn simple things like declaring variables, understanding how to print variables, understanding how arrays work, etc. Learn the basics of Java or C++ and you'll be set. If possible, look at what the online syllabus of your first programming classes says you will be studying and learn a little bit of whatever language it is focusing on. If you don't understand the basics of the language you can ask here and one of us will attempt to explain it to you in a way that makes sense.
It is of course all up to you, but I think getting a head start on what you'll learn in college is the best strategy.
|
Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Anyway, I have a question.
Is there a way to do operations with 2 generic types? What I've found on Google is using 'Number' class. Isn't there an easier way which actually gives me errors when I try it:
public T addValues(T a, T b) { return a + b; }
The only solution I've found was using 'Number'. :/
|
United States10328 Posts
Well, there's no "+" overloading in Java, so you might have to write something like
public int plus(int a, int b) { return a+b; }
public float plus(float a, float b) { return a+b; }
etc
and then call in your generic method
return plus(a,b)
Of course, this is completely stupid and defeats your original purpose anyway 
(In fact, this probably doesn't even work: a generic T is only guaranteed to be a subclass of Object, so for all Java knows, you're trying to call plus on two Objects. So I'm just dumb)
Anyway, using "Number" is probably the best way to do what you want; e.g.
public T extends Number addValues(T a, T b) { return (T) a.floatValue() + b.floatValue(); }
or some shit like that
|
Well, what annoys me is that the solution requires specific data type. In your case, it is float:
public T extends Number addValues(T a, T b) { return (T) a.floatValue() + b.floatValue(); }
So if you need addValues() for every data type (int, double, float, String), you will have to do lots of method overloading because the above example only solves it for floats. I thought the point of generics is not to do implementation for every existing type. :/
Am I missing anything or do you indeed need to do this for int, double and so on:
public T extends Number addValues(T a, T b) { return (T) a.intValue() + b.intValue(); }
public T extends Number addValues(T a, T b) { return (T) a.doubleValue() + b.doubleValue(); }
...which is a lot of lines for one simple method.
|
|
|
On September 30 2013 06:14 darkness wrote:Well, what annoys me is that the solution requires specific data type. In your case, it is float: public T extends Number addValues(T a, T b) { return (T) a.floatValue() + b.floatValue(); }
So if you need addValues() for every data type (int, double, float, String), you will have to do lots of method overloading because the above example only solves it for floats. I thought the point of generics is not to do implementation for every existing type. :/
With a generic type, you can only use operations supported by all objects on a value of generic type. Not every object (specifically pair of objects) supports the + operator, so you cannot add two generic types together. If necessary, you can constrain generic type parameters to certain types to allow for additional behavior. In this case, "T extends Number" restricts any user of addValues to instantiations of the function with T = Number or a subtype of Number.
At this point, you should be taking a step back and review why you need to use generics in the first place. What you are describing does not seem like a case in which generics are appropriate.
|
On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in my Sophomore year of HS. This year(Junior) I'm learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc.
I will note that I'm saying my own opinion and I personally have yet to get into college but I know that it will be tough and every day of programming builds off of the past days.
I have yet to understand how different Python is from C or Java due to not knowing Python.
|
On September 30 2013 06:22 3FFA wrote:Show nested quote +On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc.
I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Why do you put C and classes in the same sentence? It makes no sense to me.
I still think starting from a higher level language as someone above said is a much better choice. Basics are easier to grasp in that case, while complex languages like C can make you confused. Yes, you'll still learn to do programming. I'm not denying that, but it may not be the easiest way. Then, if you go to C, you already have enough knowledge to have a good start.
On September 30 2013 06:20 Kambing wrote: At this point, you should be taking a step back and review why you need to use generics in the first place. What you are describing does not seem like a case in which generics are appropriate.
Well, I just think it's easier to have just 1 method to add a pair of integers/doubles/Strings/etc instead of having method overloading. So what I am talking about is homogenous addition. I'm not trying to add a string and an integer.
|
On September 30 2013 06:22 3FFA wrote:Show nested quote +On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc.
Your second language is always easier to learn than your first. There's so much language-independent programming knowledge that you need to build up, that many people find working with higher-level languages that hide low-level details to be more productive for beginner programmers.
|
On September 30 2013 06:29 darkness wrote:Show nested quote +On September 30 2013 06:22 3FFA wrote:On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Show nested quote +I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Why do you put C and classes in the same sentence? It makes no sense to me. Umm because I used classes in my programming last year? o.O
On September 30 2013 06:29 Kambing wrote:Show nested quote +On September 30 2013 06:22 3FFA wrote:On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Your second language is always easier to learn than your first. Indeed, that is what I meant when I said "I think it's only easier because I started with C originally and already understand the basics..."
There's so much language-independent programming knowledge that you need to build up, that many people find working with higher-level languages that hide low-level details to be more productive for beginner programmers. I don't know what the difference is between a higher-level language and a lower-level language. Would you please explain this to me?
|
On September 30 2013 06:31 3FFA wrote:Show nested quote +On September 30 2013 06:29 darkness wrote:On September 30 2013 06:22 3FFA wrote:On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Why do you put C and classes in the same sentence? It makes no sense to me. Umm because I used classes in my programming last year? o.O
Either I don't understand you or you imply that studying C helped you understand classes. Well, C isn't OOP. I don't know how it helped you to understand classes but it might be just me.
One of the differences between an HLL (Higher Level Language) and a lower level language is that you don't have to do some things on your own. To be specific, you manually deal with dynamic memory in C by using malloc, realloc, free, etc. While in Java, you only have to type: new Object() or new Object[5]. Then you don't even need to use free. The Garbage Collection (GC) does it for you.
Edit: So I guess it's fair to say HLL is more abstract to make things simpler. Hence, our recommendation to start with an HLL instead of C or any other lower level language.
|
On September 30 2013 06:34 darkness wrote:Show nested quote +On September 30 2013 06:31 3FFA wrote:On September 30 2013 06:29 darkness wrote:On September 30 2013 06:22 3FFA wrote:On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Why do you put C and classes in the same sentence? It makes no sense to me. Umm because I used classes in my programming last year? o.O Either I don't understand you or you imply that studying C helped you understand classes. Well, C isn't OOP. I don't know how it helped you to understand classes but it might be just me. One of the differences between a HLL (Higher Level Language) and a lower level language is that you don't have to do some things on your own. To be specific, you manually deal with dynamic memory in C by using malloc, realloc, free, etc. While in Java, you only have to type: new Object() or new Object[5]. Then you don't even need to use free. The Garbage Collection (GC) does it for you.
It's automated now though. I never had to do that. I had to alloc for classes and put weak/strong etc. on objects though. Although XCode made this process faster than it might have been otherwise. http://en.wikipedia.org/wiki/Automatic_Reference_Counting
|
I would also mention that C is a language you use only when you must.
Low level details aren't harder to learn in high level languages, there's no real advantage to starting with C that I would know of.
|
I started with C and though it was pretty challenging to learn on my own I feel like it has been very beneficial now that I've started my CS classes which use java. I didn't get very deep into it but learning how to think my way through things like basic pointer concepts and character arrays helped me get more comfortable thinking about a lot of CS concepts in general.
|
On September 30 2013 06:29 darkness wrote:Show nested quote +On September 30 2013 06:20 Kambing wrote: At this point, you should be taking a step back and review why you need to use generics in the first place. What you are describing does not seem like a case in which generics are appropriate. Well, I just think it's easier to have just 1 method to add a pair of integers/doubles/Strings/etc instead of having method overloading. So what I am talking about is homogenous addition. I'm not trying to add a string and an integer.
Yeah. Unfortunately that's not possible in Java. You need an interface that can capture what it means to be Addable, e.g.,
// Not valid Java code public interface Addable <T, R> { R operator+(T rhs); }
But you can't overload operators in Java as 343 points out. You can instead demand an "add" method:
public interface Addable<T, R> { R add(T rhs); }
And then you could constrain your generic parameters with this interface (instantiated at appropriate types)
public <T, T1 extends Addable<T2, Number, T2> addValues(T1 a, T2 b) { return a.add(b); }
But now each instantiation requires a type that provides an implementation of add, e.g.,:
public class Number implements Addable<Number, Integer> { public Number add(Number rhs) { return ...; } }
But this won't work for pre-existing classes such as Integer and String since you can't make them extend this interface post-definition. Really what you want is method overloading in this case, but you have to define all the appropriate overloads up front. The complicated generic code above hints at the reason why: you have to account for all combinations of inputs to add as well as potential return types.
|
On September 30 2013 06:47 Azerbaijan wrote: I started with C and though it was pretty challenging to learn on my own I feel like it has been very beneficial now that I've started my CS classes which use java. I didn't get very deep into it but learning how to think my way through things like basic pointer concepts and character arrays helped me get more comfortable thinking about a lot of CS concepts in general.
Perfectly logical that C knowledge made you understand Java and other stuff better. It's because you had to deal with lower level details which taught you what you know. However, your start was challenging as you said. It would have been an even easier start if you picked Java over C.
So to put in this way, not the best example though:
C = having to calculate ((a + b) * 2 + 2^8) / 5 Java = having to calculate (a + b) * 2
So you have less stuff to worry about in the 2nd case.
|
On September 30 2013 06:31 3FFA wrote:Show nested quote +On September 30 2013 06:29 Kambing wrote:On September 30 2013 06:22 3FFA wrote:On September 30 2013 05:59 darkness wrote: Don't start with C just yet, especially if your college/university teaches e.g. Java. You'd find later that Java is easier to grasp. Once you get the basics, your transition to C would be much better than if you started C first because you already have some ground.
To be specific, dynamic memory and pointers may not be an easy concept for your first semester/year.
Interesting since I started with C and transitioned to Objective C in my first year of programming, which was in HS. I'm only now learning Java and so far I think it's only easier because I started with C originally and already understand the basics of Strings, Arrays, different classes, etc. Your second language is always easier to learn than your first. Indeed, that is what I meant when I said "I think it's only easier because I started with C originally and already understand the basics..." Show nested quote +There's so much language-independent programming knowledge that you need to build up, that many people find working with higher-level languages that hide low-level details to be more productive for beginner programmers. I don't know what the difference is between a higher-level language and a lower-level language. Would you please explain this to me?
Generally speaking, all programming languages abstract away in some fashion some of the details of programming against a computer. For example, Java hides away the details of manual memory management (explicitly allocating and deallocating objects). In this respect, the "level" of a language is a spectrum where higher-level languages hide more details than lower-level languages.
The typically colloquial understanding of a higher-level language is that it is a language that specifically hides the details of manual memory management. So higher-level languages (such as Java, C#, Python, Ruby, Javascript, Haskell, etc.) stand in contrast to lower-level languages (such as C, C++, various assembly languages, Rust) in this manner.
|
|
|
|
|
|