00:00
00:00
Newgrounds Background Image Theme

markololohands just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

New to Programming?

2,141 Views | 2 Replies
New Topic Respond to this Topic

New to Programming? 2014-08-04 16:16:38


I've seen a lot of topics on this forum about how to start programming, or where to start, people getting confused on what to do and where to go. I am going to write this topic solely for the purposes of helping people find the resources they require to get started with programming. I will also do a general overview of programming to start with, understanding classes, variables and common statements.

Basic Programming Principles
Apart from web languages such as JavaScript, HTML, CSS and other like languages, the most used type of language is a programming language.

Programming languages are languages that are designed specifically to translate user readable code to binary code. They are the fundamental parts of what makes a computer work properly. Without a programming language, no other language will run or execute. Think of a programming language like an engine of a car. Without the engine, the car simply won't run.

In technical terms, without software and code, a computer won't turn on, because it does not have the functionality or the software to piece together what to do on start-up. This is where a programming language becomes handy.

HTML, unlike other languages, is a Markup language. Markup languages are used to display web content. Primarily, there are used to execute programming languages easier. A markup language will not run without an engine - this engine is like Trident, which is a web technology designed to render and display web pages through the HTML markup specification. Trident, like Chromium and other web rendering technologies, are engines specifically designed for one purpose - to make it easier for a programming language to display content.

So how does a markup language run and how does it know what to execute? The engines we spoke about just now uses a Parsing engine, or a Parser. A Parser is kind of like a library of keywords, and it identifies each keyword and converts them into user-readable content. For example, most HTML code pages will render thusly:

The engine will launch the page through a new instance of a Parser (we will talk about instances later on) and the Parser will then read the contents of the code.
For each keyword within a greater than and less than symbol (the '<' and the '>', if that doesn't render because I won't know until this is posted, you should know what I mean), the Parser will generate a new instance of the display content related to that keyword followed by the properties of that content, such as background colour and whether or not to display borders.
The engine will return the content back to the web browser. These engines can be developed in many languages, but the most common is C++.

And last but not least, is a scripting language. Like JavaScript and Lua, a scripting language is designed to extend functionality or content for an already developed application; although this is slightly different in terms of JavaScript. Scripting languages, unlike Markup languages, do not require an engine, but do require at least a Parser and the library which can be integrated into the final application.

In Lua, for example, if you created an application in C++ for Windows, and you want people to extend it and add "modifications", you would assign your classes and events that you want registered in Lua. Basically what this means is that when the Lua scripts are handled by the Parser, the parser will find the registered events or classes in your application and execute them accordingly. Scripting languages are quite difficult to understand if you are new to programming, so unless you know technical jargon there is no point in me trying to explain. I am sure there are better examples out there as well.

Want to Program?
So you want to get into programming and you don't know where to start? The best way to start is to understand the basic logical building blocks of what makes a programming language a language in first place. You need to understand: classes, variables and functions.

Let's get started by explaining classes. All programming languages will start with a class that is executed by the compiler at runtime. Firstly, the compiler will find the "Main.c" if working in C, "Main.cpp" if working in C++, or "Program.cs" if working in C#. Other languages may differ. It is crucial these files exist in your program when you compile, otherwise the compiler will start throwing errors at you. Some compilers may give you the option to choose your starting object and function, like Visual Studio's compilers.

Wait, what's a compiler? A compiler is simply another application that parses, interprets, analyses and executes source code. Without a compiler, a programming language won't function. Wait, so you need a program to run a program? Yes and no. Binary applications, applications that are written purely in Binary code, don't actually need another program, but they do need an interpreter. In short, a computer needs to interpret on and off switches (0s and 1s) to execute logic gates, boolean expressions among other things. This kind of discussion can be saved though, because I can go on for hours on how a computer works from the ground up.

For the purposes of this short tutorial, I will be using the C programming language since that is the most commonly used.

class Main
{
        int i; //this is a variable, and this is also a comment. Comments are not interpreted by the compiler
        /*
        Alternatively, you can use a comment block like so. In the example code before, you can execute a function.
        */
        int Main(string args[]) {
              return i; /*
When a function is identified with a data type (like int, which is shorthand for integer - a whole number), the function must return a value that has the same data type. 
You cannot return a uint on a function defined as an int, even when they are both whole numbers.
              */
        }
        /*You can use the keyword 'void' to tell the compiler to return 'null' when this function is executed.
        All functions need to return a value, even if you do not explicitly call it, like in the previous function.
        What the compiler notices in the below example is an implied conversion. Depending on the compiler
        will depend on whether or not you can be lazy and have the compiler automatically convert values
        to other values, this is implied conversion. Telling the compiler to convert one value to another is through
        code is explicit conversion. VB.NET is infamous for its implied nature of converting values to other values,
        or data types. The below example is not supported in C version 9, use 'void otherFunction(void)' to accept 
        no arguments. Arguments, or parameters, are basically references to variables declared when the function
        is opened, and the references can only be used within the function.
        */
        void otherFunction() {}

        //In C, you can instantiate classes into a variable, so let's take the following examples.
        public class MyClass {}

        MyClass myVar;

        /*
        Basically, what we are doing above is assigning the 'myVar' with the data class 'MyClass'. myVar will
        access the contents of this class under its new name and will be able to access exclusive methods and
        variables. Exclusive variables and properties, or types with the 'public' keyword in front of it, are declared
        as belonging to the class.
        */
}

Ignorance will become the death of us.

BBS Signature

Response to New to Programming? 2014-08-04 16:18:09


So what does all this code mean? C, unlike most languages, I would say is the first language you should learn as almost every other language derives from it and thus easier to learn once you've learned C. Unfortunately, C is not a great place to start on Windows platforms, since the libraries are not so great as they are on Unix-based systems, like Linux and Mac OS. Also, as many other experts out there will say, never use an IDE like Visual Studio, NetBeans or Eclipse to develop C programs for learning. Learning is about knowing what you're doing, and IDEs don't let you do that.

In short, the best way to learn is to get a Text editor of some sort and learn from there. If you are using Windows, you could always start learning C++, but if you have already learned higher-level languages like Visual Basic, C# or whatever it may be, C++ will very quickly alienate you due to its strange structure like it did with me.

The best way to learn any programming language is Trial and Error. If you are not willing to practice by experimenting, then there is no point in learning. You will learn much more programming through experimentation than you will following tutorials, not that I am saying tutorials are bad practice, they just don't provide the hands-on tools designed to allow you to learn faster than it otherwise would.

If you don't want to learn C, and would rather learn something else like C#, Java, Python or other like languages (which you shouldn't because it defeats the point of learning), then there is no stopping you. The reason I say you shouldn't is because C is the closest language you will get to human understandable code that executes almost directly to Binary, and thus one of the most efficient languages.

I'd say at least 80% of all programs on most Linux operating systems like Ubuntu are programmed mostly in C, simply because C is easier to understand than C++. Other factors are involved like efficiency, more support for the language - it is one of the most common languages after all.

Once you get to grips with C, you can start learning other languages. C I think is the best way to start learning as it is a very small language and very compact. C++, on the other hand, while an extension to C is arguably one of the toughest languages to learn. C is a good starting point, but developing with it expertly is not a good idea without years of training. This is because as C programs get larger, and the more you do with memory in C, the more likely you are to run into code errors and it will eventually become a nightmare to solve the problems.

Start in C, learn the basics, and then move onto whatever language you like. Ultimately, this comes down to what platform you want to develop on, and what programs you want to program.

Learning C++
So, you want to learn arguably the toughest language of all time? Good on you, because I certainly won't have the guts. I tried and gave up after a while. Still, there are huge amounts of libraries and resources online to get you started.

http://www.learncpp.com/ - possibly one of the best resources online for learning C++, and it even answered most of my questions despite the alienating nature of the language itself.
http://www.youtube.com/CodingMadeEasy - one of my favourite video tutorial resources for learning programming, in multiple languages. This person mostly has tutorials covered for C++ but does things for MonoGame in C#, some things in C and I think also does some Java.
http://www.gtk.org/ - a great toolkit (not IDE) for developing C++ applications with Graphical User Interfaces.
http://qt-project.org/ - an application framework similar to GTK+ for visual C++ applications, also comes with its own IDE.

I wouldn't recommend Visual C++ as a development tool unless you want to create CLR applications (Common Language Runtime), which is basically the global compiler for visual languages, also like C# and VB.NET. So unless you want to develop C++ apps specifically for Windows, I wouldn't use Visual Studio.

- For game development?
http://www.unrealengine.com/ - A good engine for C++ developers, although very complex and has a very high learning curve. Unless you know what you are doing, you probably want to use something else.
http://www.sfml-dev.org/ - An alternative to DirectX development which supports OpenGL as well as other open source technologies in developing games. CodingMadeEasy on youtube as resources on this.
http://www.libsdl.org/ - Another alternative to DirectX development; but I don't think this has as much support as SFML.
http://www.opengl-tutorial.org/ - If you want to go really hardcore, you can write your own engine on top of what OpenGL already offers with these tutorials, at least for the basics.

Learning C#
C# is one of the easiest languages to learn, down from Java, since it is very similar to Java. C# is almost as widely supported as Java, but can be constrained by the fact that official support for the language is Windows only, since it is Microsoft's product.

http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners - great video tutorial series by Microsoft experts, but does require website registration. You do not technically need to be an academic student to register.
http://www.homeandlearn.co.uk/csharp/csharp.html - one of my favourite learning resources for C#, since it also explains databases and file manipulation which you rarely see in "basic" tutorials.
http://www.c-sharpcorner.com/beginners/ - easily one of the best resources for C# knowledge, includes information on Windows Forms, Windows Presentation Foundation and even Siverlight which is barely ever used (unless you want to work for Netflix); Silverlight does have its strengths like DRM-enabled technologies which Flash does not offer.

http://monodevelop.com/ - An alternative C# IDE for cross-platform support and uses GTK#. GTK# is of course an alternative to GTK+ for C# developers.
http://www.visualstudio.com/ - A great IDE and arguably one of the best on the market.

- For game development?

http://www.unity3d.com/ - or Unity, arguably the best IDE for game development on the market at the moment due to its flexible payment plans, as well as offering a free version of the IDE itself for both commercial and non-commercial purposes.
http://www.youtube.com/Brackeys - possibly one of the best video resources for learning the grips of the Unity IDE and developing games in both UnityScript (very similar to JavaScript) and C#.
http://www.monogame.com/ - MonoGame is an open source derivative to XNA. Possibly best developed with MonoDevelop, but can also be developed with Visual Studio. The problem with VS is the XNA support on Windows 8 and 8.1, since 8 and 8.1 no longer officially support XNA and requires a clever DirectX trick in the name of a "DirectX wrapper". Otherwise, you can install MonoGame on Windows for MonoDevelop instead.
http://www.youtube.com/CodingMadeEasy - has some good starting tutorials for MonoGame; you might as well learn some tutorials on XNA considering the framework is almost identical. Yes, I'm pointing you to the same video resources almost all the time. He knows EVERYTHING! I'm sorry! Okay, maybe not everything, but he has a lot of knowledge!


Ignorance will become the death of us.

BBS Signature

Response to New to Programming? 2014-08-04 16:19:46


Learning Java
Java is arguably the most commonly used language, but not used often on web environments due to its security issues. If you want to develop mobile applications, then Java is a great choice. Java is also a pretty good choice for desktop applications, although the GUI it comes with is ugly IMO. Nevertheless, if you want cross-platform applications, Java is the language for you.

http://www.homeandlearn.co.uk/java/java.html - Home and Learn also does Java tutorials, and would also recommend using since they also teach you how to use databases with Java. These people are so generous.
https://www.youtube.com/watch?v=3MZIkY55fS0 - While "a bit" outdated, these video tutorials still live up to the standards of Java programming, but ignore his mentioning that companies want Java for web - that is no longer true these days. Companies more or less prefer AJAX and jQuery these days, not Java or Flash (although Flash is still good for closed source applications like video games).

http://www.eclipse.org/ - The most popular Java IDE
http://netbeans.org/ - An alternative to Eclipse.

- For game development?
http://lwjgl.org/ - Lightweight Java Game Library, the same library Minecraft uses.
http://libgdx.badlogicgames.com/ - LibGDX is actually strangely similar to XNA, I've tried this before and is rather easy to get into.

Learning ActionScript
ActionScript is a strong programming language used in conjunction with Flash. Arguably the most popular web application option, unless you count AJAX, jQuery and JavaScript (or PHP) as web development (which it technically is but open source). Depending on whether or not you want your applications on the web to be open source, this may be a very good choice.

http://tv.adobe.com/show/actionscript-11-with-doug-winnie/ - A fantastic video tutorial series by an Adobe expert, completely free-of-charge.
http://www.adobe.com/devnet/actionscript/learning.html - If you prefer reading, these are also good learning resources for getting started.
http://www.upsidelearning.com/blog/index.php/2010/04/28/22-great-free-actionscript-3-0-learning-resources/ - A list of 22 learning resources for ActionScript 3... insane.

http://www.flashdevelop.org/ - Most of you probably don't want to pay upfront, so go ahead and download this IDE because it's one of the best alternatives to Flash Pro + Flash Builder
https://creative.adobe.com/products/creative-cloud - Everything is done via Creative Cloud now if you're interested in the official IDE for Flash and ActionScript development

- For game development?
Both of the above options as just as good for game development as they are for animations, but here are some applications specifically designed for game development in mind.
http://www.stencyl.com/ - A WYSIWYG Flash editor. I've tried it and it's strong points are its flexibility and also the choice to add custom code. My problem with it personally, particularly with scene editing, is that you cannot precisely place objects or size them. I think this may be an inherent problem with Flash itself and not necessarily the Stencyl IDE, since I remember being told by MintPaw that you cannot resize objects via the width and height properties... Can't remember the exact reason now.
https://www.scirra.com/construct2 - Construct 2 is similar to Stencyl, but is not Flash. Still, it offers the same kind of functionality so decided to put it here regardless.

Other Languages
For other languages, you can search yourself. I have listed above the most popular options available and would recommend you choose those over other languages. However, it is completely up to you to decide what you want to learn and develop.

It is completely possible to make games in other languages, such as Python, Ruby, JavaScript, VB.NET and many others.

If you have your own recommendations you want to contribute to this thread, then go ahead! It will help us all out, hopefully!


Ignorance will become the death of us.

BBS Signature