10 Replies - 4734 Views - Last Post: 31 May 2012 - 09:36 PM

#1 aczwicker  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 23-May 12

What (in your opinion) is the most efficient way to learn c#?

Posted 23 May 2012 - 06:49 PM

Hello all.

I am a Java Programmer but I want to switch over to C# to try out the new Unity3d game engine. But Instead of poking at buttons and trying to script in a language that I'm not extremely familiar with, (c#), I wanted to see if anyone had any suggestions on an efficient way to learn C# with a decent learning curve. Ive programmed in other languages and I have a solid grasp of Methods and Functions, but the commands themselves are not incredibly easy to memorize unless I take random tutorials that basically do the code for me (which doesn't make me "think" about the solution so it makes it easy to miss a few things. I want to understand this language to the greatest extend possible so I thought id ask you guys here at Dream.In.Code to see what you suggest.

Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: What (in your opinion) is the most efficient way to learn c#?

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5540
  • View blog
  • Posts: 11,868
  • Joined: 02-June 10

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 23 May 2012 - 07:42 PM

java and C# syntax are so very similar you will feel very comfortable.

Quote

I have a solid grasp of Methods and Functions, but the commands themselves are not incredibly easy to memorize


Well - not really. You won't have a grasp on the actual methods because the biggest shift will be getting used to having the entire .NET framework at your disposal. That's a good half million methods or more. So you aren't going to memorize them. The best you can do is get comfortable with the feel of the namespaces and let them lead you to the exact method you want. It does become natural after a while. For example, if you want to get a list of the file names in a given folder..

string[] AllTheFilePaths = System.IO.Directory.GetFiles(@"C:\SomeDirectory\");


So the method is GetFiles
Drilling down it just makes sense...
From the most vague: System
You reason that you are doing an IO operation: System.IO
You narrow it down further to a Directory operation: System.IO.Directory

The important thing here is that Visual Studio has a feature called Intellisense that will help you LOTS. Accept the help. Use the tool. In this case as you type System. at the . Intellisense will pop up a menu of all the items within System that you could pick. Same after IO. and after Directory.

I strongly suggest a proper Learn C# book or tutorial series. What's the worst that could happen: You understand all the concepts of OOP and can do 5 days of exercises in 1 day?


There are three routes people seem to take when learning programming.
  • Just start trying to create programs
  • Start taking apart other programs and try to figure out the language by reverse engineering
  • Follow a guided learning course (school or self-teaching books)


For the life of me I can't figure out why people try 1 & 2.
Sure, 35 years ago the only way I could learn BASIC as a kid was to type programs from a book into a TRS-80 model 1 or Commodore VIC-20, then figure out the commands and syntax by watching the results as the program ran. There simply wasn't any courses for a kid back then.

But now, you can't help but to trip over "Learn {coding language} in 3 weeks" type books and the entire internet is at your disposal for tutorials.

I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.

Quote

Where do I start?


You start by learning a coding language FIRST.
Learn to plan before you type.
THEN you start designing software with a purpose.


If this sounds like you

Newbie/Rookie said:

I have a little programming experience but I need to write ...
read this section
Spoiler


Otherwise, you can just jump to the resources here:
Some of the tutorials below are for C# or Java not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.



Resources, references and suggestions for new programmers. - Updated Mar 2012
Spoiler

This post has been edited by tlhIn`toq: 23 May 2012 - 07:43 PM

Was This Post Helpful? 2
  • +
  • -

#3 aczwicker  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 23-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 24 May 2012 - 09:30 AM

Thank you very much for the advice. That is probably the most well-thought-out answer that I have ever had for a question. I looked up the .NET framework and you're right, it HUGE. I surely won't memorize it but the Intellisense seems to give hope.

I've been an intermediate independant game developer for a while now and I've been looking to create a new basic game engine with C#. Now that I have some insight, I think I am ready to learn as much as possible by starting small and progressing with time.

The best way to get used to it is by doing it, right?

Are there any books you suggest?

P.S

and one last related question if you have time. I understand the direct importance of Pseudo-Code, but i plan on creating a expanding game engine. (where updates are added each week, adding something small but noticeable.)

Since I am basing the game updates on user input and polls, I don't know how I would go about creating something that evolves without having to re-script something major?

I guess I'm more paranoid of spending hundreds of hours on something that has a "dead-end" if I don't prepare my code correctly....
Was This Post Helpful? 0
  • +
  • -

#4 negligible  Icon User is offline

  • D.I.C Regular

Reputation: 62
  • View blog
  • Posts: 302
  • Joined: 02-December 10

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 25 May 2012 - 04:10 AM

Object orientated principals and abstraction should reduce that problem. Classes should perform a task without requiring "knowledge" of anything else happening in the program.
It means when you make a small change you don't have to reflect it in everything else that interacts with it.

C# has some great tools for this such as "Delegates" and implicitly typed code.

"Clean Code: A Handbook of Agile Software Craftmanship" is a great book goes over this, the examples are in Java but it applies to C# to. (I have never programmed in Java)

There's a thread around here somewhere with a list of decent C# books, personally I rated "C Sharp in Depth" and "C#4.0 in a Nutshell" highly.

This post has been edited by negligible: 25 May 2012 - 04:17 AM

Was This Post Helpful? 1
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2264
  • View blog
  • Posts: 9,470
  • Joined: 29-May 08

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 25 May 2012 - 04:30 AM

I'm a firm believer of starting with Console based applications first, to get a grasp of the language's grammar and syntax. Console Applications also focus you more towards the design of your objects with you the distraction of the GUI, separating out the core logic of your problem from the display and input.

Look for commonalities and repetition. Utilize inheritance and interfaces. Don't reinvent the wheel, use existing libraries. Focus on the specifics that are unique to your problem.
Was This Post Helpful? 3
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3590
  • View blog
  • Posts: 11,168
  • Joined: 05-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 25 May 2012 - 01:40 PM

View Postaczwicker, on 24 May 2012 - 09:30 AM, said:

Thank you very much for the advice. That is probably the most well-thought-out answer that I have ever had for a question. I looked up the .NET framework and you're right, it HUGE. I surely won't memorize it but the Intellisense seems to give hope.

I've been an intermediate independant game developer for a while now and I've been looking to create a new basic game engine with C#. Now that I have some insight, I think I am ready to learn as much as possible by starting small and progressing with time.

The best way to get used to it is by doing it, right?

Are there any books you suggest?

P.S

and one last related question if you have time. I understand the direct importance of Pseudo-Code, but i plan on creating a expanding game engine. (where updates are added each week, adding something small but noticeable.)

Since I am basing the game updates on user input and polls, I don't know how I would go about creating something that evolves without having to re-script something major?

I guess I'm more paranoid of spending hundreds of hours on something that has a "dead-end" if I don't prepare my code correctly....


I felt that Lynn Harrison's "Introduction to 3D Game Engine Design Using DirectX 9 and C#" book was great for intermediate programmers getting into game programming as well as explaining the important aspects of a game engine and game engine design: http://www.apress.com/9781590590812

I used the word "was" because Managed DirectX that he uses in the book has been abandoned by Microsoft, and XNA is the only way to go if you want any write something with relevance and hope of foreward compatibility. It's that or go with the SlimDX if you want to stay as close to DirectX as possible without committing to the XBox and other XNA targets. (http://slimdx.org/)

I still recommend reading the book because I felt that he had the right balance of how depth vs. breadth is the game engine design. The author had pretty modular code that prevents dead ending, or being stuck in a particular framework or approach. (The only mistake was choosing to use MDX, but then one has to pick a base API. Alas, MDX is different enough from DirectX that a quick translation to SlimDX or XNA or OpenGL or DirectX is not possible.) As you progress through the book you add more stuff to the engine to get more features. Sounds exactly like what you are planning. Maybe collaborate with the author to get a new edition published interactively online. :-)

This post has been edited by Skydiver: 25 May 2012 - 01:43 PM

Was This Post Helpful? 1
  • +
  • -

#7 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3590
  • View blog
  • Posts: 11,168
  • Joined: 05-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 25 May 2012 - 01:56 PM

On a side note about Intellisense...

Use it to get your program going. Take time though to go back and read the documentation about the APIs that you chose from the offerings given to you by Intellisense. More and more now, I've been running into code on the Internet where people don't realize that a resource should/must be Dispose()'d; or that there is a better method or approach that is suggested in the documentation; or that the method has been deprecated; etc.

I know that it can be a drag since the program already works well enough, but it will give you some insight into why your program behaves the way it does.

A classic example is people who always instantiate a new instance of an XmlSerializer. They get a program running and their are happy. Later they are wondering why they are running out of memory and why their program is so slow. Reading the "Dynamic Generated Assemblies" of XmlSerializer will tell them. Hopefully they wrote their code such that an easy refactoring is possible.
Was This Post Helpful? 1
  • +
  • -

#8 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 26 May 2012 - 08:27 PM

I can't imagine anyone "memorizing" an entire framework, even yourself; I doubt you have the entire Java framework memorized.

Since you have previous experience in other languages, it'll be easier than if you were a complete newbie. Just Google whatever it is you want to do, and 10 times out of 10 you will find information.

This post has been edited by Sergio Tapia: 26 May 2012 - 09:03 PM

Was This Post Helpful? 1
  • +
  • -

#9 aczwicker  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 23-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 29 May 2012 - 09:31 AM

I got a couple books that I will buzz through and read in within the nest two months.

I also looked into various game engines for creating what I want. Unity3d uses c# for its primary language but i don't know how customizable it is.

Any thoughts on the unity3d engine?
Was This Post Helpful? 0
  • +
  • -

#10 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3590
  • View blog
  • Posts: 11,168
  • Joined: 05-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 29 May 2012 - 12:33 PM

When I first looked at Unity in their earlier versions, to use their engine, all my classes had to derive from their base class. (GameObject as I recall.) Since C# doesn't have multiple inheritance, if I wanted to create domain specific classes, but still be able to interact with their game engine, I had to keep applying the Bridge design pattern so as to keep game logic in my classes, and game rendering in their classes. This tends to become a mess when dealing with physics and collisions.

As for how easy it is to customize the engine, my little bits of poking around with it then gave me confidence that if I needed to change something it wouldn't be too hard a task as the code was pretty well written and organized even in its early incarnation.

(Now you made me want to go download the latest version and look around at the game engine again.)
Was This Post Helpful? 1
  • +
  • -

#11 FascistBasilisk  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 2
  • Joined: 31-May 12

Re: What (in your opinion) is the most efficient way to learn c#?

Posted 31 May 2012 - 09:36 PM

I use C# quite a bit and having started out with Java myself I found it a fairly easy transition. If you have used other .NET languages that would also be a great help. I think you will find it is not as hard to pick up as you think it will be. I used a book called C#: How to program by Deitel as a reference when I was first learning.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1