3 Misunderstood Basics for New Developers

Hey guys! We're excited for this one, as we get a lot about these three questions. We're hoping if they get asked, you can just drop them this video and clear it up. Rather than bother you guys with tons of information, I've dropped the video below. Below the video is the transcript if you prefer to read!


Thanks for watching, and if you're new here and you're a developer - Consider taking a look into GameDevHQ.com further for a place to build your portfolio, manage dev logs of your projects, show off your work, and further your education or network with other developers all in one place and one community.


You can do it alone, or you could do it with all of us. We're ready to see you turn your passion for game development in Unity, to a career. Later!



---------------------
TRANSCRIPT:

---------------------


Hey everyone! It’s Ryan with GameDevHQ.com.


Today we’re talking about 3 misunderstood concepts in the C# language. We’ve noticed a few trends with starting developers and wanted to simply clear up some of the confusion and hopefully help you guys out. Some of these are pretty basic, but for anything you don’t understand we’ve left some links in the description to dig deeper, and of course feel free to ask questions in the comments or in our forums at GameDevHQ.com.


Let’s get started!



FUNCTIONS AND METHODS



The first one on our list is actually a very common misunderstanding, and that is determining the difference between functions and methods.


The difference between functions and methods seems to have some issues with clarity for beginners. When it comes specifically to C#, all functions are in fact methods. There is not a difference! So again, that is that all functions are methods in C#.


In other languages however, this is not the case. In other languages a method is a function that might be an attribute or property of a class.. While functions simply return information. This isn't applicable to C# though, so you don't have to worry about those differences because they don't exist in this case.



SWITCH STATEMENTS

For If and Else statements, it’s super common when starting out to solely rely on them for checking conditions or checking if something happens. There is something better though that helps with larger requests and that is the switch statement.


Knowing when to use one over the other however can come done to one simple understanding.

Anytime you are checking on a condition more than twice, you should consider the use of a switch statement. A switch statement lets you apply cases that a variable will go through and check.


If you don’t know how to apply the use a switch statement, we’ve left some links in the description to direct you to them. This video isn't to define them, but we have content in the description to help you with that.



SINGLETONS

Another common misunderstanding is simply the use of Singletons, and what they’re used for. Singletons should be used on things that only require a single instance.


By this we mean only once will the object appear or be used, never to be recreated because only one can exist. An example of when to use a singleton would be in a type of manager class, such as a script that manages other components of your project like a game manager or ui manager script.


Something to note is that Singletons will not actually communicate back when spoken too. Manager classes using singletons, should only expect a one way conversation such as a Player asking the Game Manager singleton for stats, but the Game Manager shouldn’t ask the player something.


Additionally singletons can answer the following questions you may be trying to resolve:

---

How can it be ensured that a class has only one instance?

How can the sole instance of a class be accessed easily?

How can a class control its instantiation?

How can the number of instances of a class be restricted?

---


If you want to know how to make a singleton, you can find the video in the description.


While C# continues to grow in popularity it’s important to take hold of the core concepts of the language and really drill them into your brain.


When it’s hard to remember things, always try and have notes nearby to help you out. We know there is a lot of struggles out there for self taught developers, and we hope these three key points helped you out in some way. If you need a deeper understanding of each component, we actually cover them in great detail in our newly released Unity C# Survival Guide.


We cover every component of C# and provide challenges to help master what the fundamentals mean, and you can use the lessons as a reference for when you get stuck or need to brush up.


There is no other course out there that focuses simply on the coding concepts in this type of format and we hope you give it a quick look. We’ve left a link to the survival guide in the description.


This concludes or top 3 misunderstandings of C#. Now a question for you - What things do you feel you don't grasp yet?


Leave your answer in the comments, and we’d love to help you out. Thanks for watching, and don't forget to subscribe to our channel for more tutorials, and other game development content, and join us in our community at GameDevHQ.com for awesome events to help critique your development path. Later Dudes!

    Comments 2

    • Another great topic. Always helps to hear things put plainly and to be able to decipher which tool is right for the job. Thanks team!