Originally posted by: SuperFungus
Ok, so i guess what i'm hearing is that C# is as good a move as any. It'll allow me to ease into the C style syntax and OO mindset without worrying about pointers and such. As far as my target platform goes, thats a good question. I got into programming for the BSII (way back in like 6th or 7th grade, i believe the exact version is called Pbasic?) and i want to learn C so eventually i can maybe get into C based pic compilers/microprocessors for projects and such, or at the very least understand other's projects better to begin with. I don't have a problem with everything i develop being stuck in PC's with .NET as long as what i learn working under .NET isn't going to spoil me for the cooler stuff later.
I was going through some of the msdn site's library and hit an article where the guy described the difference between thinking about a problem "procedurally" vs. "Object Oriented...uh..ly". Can't remember the exact terms he used i guess

but it did seem to make some sense; languages like basic make you think of the problem in terms of the steps towards solving the problem while OO make you think of the problem in terms of what the basic components that need to be completed in order to solve the problem. Am i understanding this distinction correctly? Please feel free to set me strait, i want to 'get' this. I also read the introductory chapter of "thinking in C++" by Bruce Eckel, but that was more geared to existing developers so i didn't a whole bunch out of that.
Also i just tried a "hello world" program in C# and i have trouble when i try to get the program to loop. I want to start main over again, but i can't call main. Do i hit these difficulties because i'm still approaching this with the wrong mindset? How would an OO thinker approach this?
Anyways, thanks for all your input everyone I really do appreciate your help.
I don't know C#, but OO is all about classes, inheritance, and methods (terms may vary depending on who you ask).
Classes: A class is a collection of blocks of code know as "methods". Each method is defined separately (although they can interact with each other if you wish), and accomplishes whatever the user wants.
Think of a class as a keypad. Each key does something that you define, and there is no set required number of keys.
Ex: (This is in Java so don't copy this verbatim)
public class Dog
{
//Variables and methods go here
}
Lets say there is a "method" called "bark" in the above class. From the main, you first need to "instantiate" (aka create) an "instance" of the class Dog (think of it as waving a wand and summoning a dog into existence)
In Java, this is done via a line of code similar to the following (C# syntax is slightly different IIRC):
Dog dog = new Dog();
Then you can "call" any of "dog's" methods via a command such as
dog.bark();
dog.sit();
dog.run();
etc.
The "." allows you to access code within the "Dog" class.
Deciphering this statement:
"Dog" is the "type" of "object" (as in "Object" Oriented) that we are instantiating. In this case, we are trying to make a Dog come into existence.
"dog" is the name that the class is referred to WITHIN THE MAIN (or wherever else you instantiate it). Think of it as naming a dog: "dog" in Real Life.
"= new" just tells Java that the object we are referring to is "equal to" a "new" object. "We are not referring to an object that already exists, but creating a new one."
"Dog()" is a "method" known as a constructor. It is this statement that "brings the dog into existence." More on these further down.
METHODS:
In short, a "method" is a block of code that does something. This code is "called" from the main after it's containing class is Instantiated. The command used to "call" it is defined when the method is made.
Ex of a method: (This is in Java, so don't copy the code verbatim)
public int add(int a, int b)
{
//Code goes here
}
What everything means:
"public" is a feature that you don't really care about at this stage (although you will soon). Basically, it sets permissions on what can access the method and how it can be accessed ("public" means anything can access it, but there's also "private", "protected" and other parameters which mean different things).
"int" (short for integer) is what the method "returns" (this can be replaced with double, float, char, anything. Even user made types when you learn how to do those)
Ex: If I made a method that added two numbers together, I would want to obtain the result right? This result would be "returned" by the method via a statement known as "return".
Ex" (the code within this method (between { & }) is universal to all C based languages):
public int thisFunctionReturns1()
{
return 1;
}
"1" is of type int. When this method is called, it will "spit out" one.
How this is useful:
Going back the addition method above:
Let's say I made a "int" variable in the main called "result". I would then call the addition method to add the two numbers together, and set "result" equal to whatever the method "returned". If a method doesn't return anything, the "return type" of the method would be "void", and while this is sometimes useful, any given method is more likely to return something then not.
Continuing from before:
"add(int a, int b)" is the good stuff. This is the actual command that gets the code working. The stuff within the parenthesis is known as "parameters". These parameters are user defined and can be practically anything (you can have as many parameters as you want when you define a method). They can also be used within the method.
An example of the addition method would be (once again, in Java)
public int add(int a, int b)
{
return (a + b);
}
If there are multiple parameters, they must be separated by a comma. Each parameter type must also be specified (as we are add integers, each parameter is of type "int")
Now let's say that the method "add" is inside a class "Calculator"
In Java, the main method would look something like this:
public static void main(String[] args) //Java's way of declaring the main
{
Calculator calc = new Calculator(); //Instantiate a new "Calculator" object named "calc"
int result = 0; //Declares a new integer Variable "result" that is initially set to zero.
result = calc.add(1, 1); //Set's result equal to the addition of 1 and 1 (2)
}
Hope this helped. Sorry if it seems rushed toward the end, but I've got a Chem lecture in 5 min. Feel free to ask any questions.