Overclock.net banner

Are there any fun ways to learn to code?

1K views 6 replies 6 participants last post by  Acecool 
#1 ·
Learning a programming language has been on my long list of to do things, that have a poor chance of happening... I've bought a arduino kit a week or so ago and bought a book that seems pretty nice, even though I've only read a few pages. (...Like most of my books...) It's Friday and what I plan to play with this weekend. It's supposed to run using C and C++. So I'm hoping I will learn a fair amount to spike more of a serious interest in programming. I wanted to make my own website but I got burnt out and don't remember what kind of website I wanted to make anyways or how useful it would have been.

I hope this will be a fun and immersed way for me to get into programming. But I wonder what other ways there are and for what language?

Thanks,
Higgins909
 
#2 ·
If you have an arduino, then all you need is a project that you care about to get you involved. Do you like robots? do you like LEDs? do you want to build a little movable missile launcher that can target moving objects? Find something you want to do, then figure out how to do it with code.

Since this is a computer enthusiast forum, I assume you are into building your own. How about a fan controller with LCD readout? If you are into water cooling, fan controller + temp sensor monitor, ect.
 
#3 ·
Set smaller goals, and do something focused on something you wanted to do anyways. For work I had to learn Javascript and do a bunch of mapping stuff. I cant remember what the original project was, but I decided to change the point on the map to a symbol of a helicopter. Then i decided to be able to move and control the speed with the arrow keys. Then I converted everything to traverse in proper scale. I.e. the helicopter would move at the appropriate speed a normal helicopter would. Then i added different types like Boats, cars, and a Missile. Then we realized this would work great for another project we needed to do for disaster response drills, so I added websockets to the page so that multiple people could control their own vehicle and would send updates to everyone, so that everyone could see where everyone was in real time. I joked about adding things like making the helicopter launch missiles, but when we thought about it... there is actually a few things that would be similar to that which would help.... Like, when i press space, it could drop a node (bomb) where when you hover over it, it would show you all the metric information we had on that location and vehicle. Then we wanted to be able to automate paths and stuff, so I added something where I could give it a simple script like Speed,Direction,Duration or Speed, Lat,Long in each row, and it would go trough the script from waypoint to waypoint.

So for me... what makes things fun is to make it into a game or flashy lights. Past that, fun for me would be solving a tricky problem, kinda like the enjoyment of solving a puzzle. A project i just cancelled which would have been cool, but just wouldnt work out was to make a cluster of RaspberyPi's work on encoding 500TB worth of video . There is a bunch of ways to approach it, and the design process is fun to me.

A fun project i did with an Arduino (8 years ago) was to create a Binary Clock. I did the coding and got all the lighting to work, I just didnt get around to building the enclosure. The way i wanted it would require me to get a 1/16in stainless steel place lazer\water cut and I just never got around to getting it fabricated.

Learning var x = Math.Round(BLAH BLAH BLAH); is a bit boring. If you need to learn about arrays and classes, make a game of blackjack. ♣ A With ascii its pretty easy to do in console. In highschool that was my final project I did in Java. I was going to code a different card game and add an AI... but I was lazy and didn't.
 
#4 ·
There are also several 'challenge' websites out there.
For example: CodinGame.

I know what you mean about making a website but letting it go halfway through.
What helps is to make up imaginary purposes for the site, like "a website about my appartment".
This could single page static website, where you list the contents of each room or it could be a single page application with some framework behind it, where you can map out a clickable layout of the place. And everything in between.

Also, if you know what language you want to program in (like that isn't hard enough on its own), you can just put challenge after the language name. "python challenge, C++ challenge", etc. And look it up on google, there are multiple challenges, mostly with forums behind them where hints are given. That way you already have a goal and by researching what they are asking you to do, you get to learn different parts of a programming language.

I haven't done that much with an arduino so I can't really help you with that, we made a buzzer game at college, but that involved multiple boards linked between eachother and I made a parking sensor that communicated using the LoRa protocol, but with the latter the arduino was more in the background as it was centered around LoRa.

I hope you find your drive to make something nice.
 
#5 ·
I'd start out with a friendlier language than C, and also maybe stick to making a simple program for the desktop, rather than going for an unfamiliar platform like the arduino.

I've found Java to be quite a friendly language, and when written with a good IDE like Eclipse or Netbeans, you get all sorts of help (erroneous code is highlighted, better ways to write code are suggested, etc).
If you downloaded the Netbeans + Java8 sdk from the Oracle website and installed it, then found a few tutorials online, you could follow them through and learn some of the basic principles of the language, and how to structure code and your overall application.

There are tutorials out there that you could follow through in an hour or so that will build you a simple note taking app, or a diary-type app, or other simple things like that. Quickly putting something like that together and seeing how the parts interconnect should give some basic understanding of whats going on, better than following tutorials on how to access the GPIO pins on the arduino and reading signals from sensors.

A language like java should also give you easier access to more complex programming concepts like multi-threading over a language like C.

eg,
create thread in C

Code:

Code:
void *my_function(void *param) {
  //// code to run ////
  return NULL;
}

pthread_t thread0;

pthread_create(&thread0, NULL, my_function, &parameter);
create thread in Java

Code:

Code:
Runnable task = () -> {
  //// code to run ////
};

Thread thread = new Thread(task);
thread.start();
 
#6 ·
Quote:
Originally Posted by spinFX View Post

I'd start out with a friendlier language than C, and also maybe stick to making a simple program for the desktop, rather than going for an unfamiliar platform like the arduino.

I've found Java to be quite a friendly language, and when written with a good IDE like Eclipse or Netbeans, you get all sorts of help (erroneous code is highlighted, better ways to write code are suggested, etc).
If you downloaded the Netbeans + Java8 sdk from the Oracle website and installed it, then found a few tutorials online, you could follow them through and learn some of the basic principles of the language, and how to structure code and your overall application.

There are tutorials out there that you could follow through in an hour or so that will build you a simple note taking app, or a diary-type app, or other simple things like that. Quickly putting something like that together and seeing how the parts interconnect should give some basic understanding of whats going on, better than following tutorials on how to access the GPIO pins on the arduino and reading signals from sensors.

A language like java should also give you easier access to more complex programming concepts like multi-threading over a language like C.

eg,
create thread in C

Code:

Code:
void *my_function(void *param) {
  //// code to run ////
  return NULL;
}

pthread_t thread0;

pthread_create(&thread0, NULL, my_function, &parameter);
create thread in Java

Code:

Code:
Runnable task = () -> {
  //// code to run ////
};

Thread thread = new Thread(task);
thread.start();
My issue with Java is the IDEs. You can download visual studio free version and code C# which is basically like java, but with an awesome IDE. There is also ups and downs with programming in C#\Java over C++. When you look at the basics, C++ is actually easier. Character IO being just cin cout instead of setting up a stream reader and blah blah blah. I personally would recommend JavaScript for a starting language.
 
#7 · (Edited)
I wouldn't recommend starting in C... It can be a difficult language to read when you first start as it is a lower level language - I'd recommend something higher such as Java which has been suggested or even higher such as Lua or Python...

I say Python because its very powerful, its easy to write code, there are a lot of libraries available so you can create cross-platform applications quickly and with very little code... It does introduce a few bad habits though, namely scope isn't as strictly as enforced as many other languages which is something I hate about it...


I suggest Lua because you asked for something fun, so I'd say go with Garry's Mod which is a game / sandbox and it uses a modified version of Lua ( GMod Lua which uses C Style operators, but you can still use Lua vanilla operators, etc.. plus continue in loops so instead of x and y you can use x && y )... I have written over 500 tutorials in GMod Lua which I offer to anyone that adds me on steam and asks for help - I tutor for free as it helps me battle depression of having a broken neck, back and severe nerve damage.

It can be fun to create game-modes, objects in a game, etc.. and the nice thing with Garry's Mod is as soon as you save the file, the files are refreshed so you get INSTANT feedback on what you just worked on and are able to see the result immediately.... This is one of the biggest benefits - there's no compile button to press, nothing else to do other than code and click save and see the changes happening in the game..

It does require a bit of work to setup - ie download the game through Steam, then set up SRCDS ( best way to test games, etc.. as proper realms are used which are client and server which are 100% isolated except for the ability to network data between them, there is a shared realm too but that just means the code is included on client and server but they're still separate ), download a few maps, and play around...

You can start small from editing weapon files in TTT, to adding new items to use in the game by copying others and changing the effects, to creating your own weapons, items, etc... and beyond... You really can build up your knowledge while jumping right in and playing around and getting comfortable with the language... It is amongst my top picks for first language to learn as it treats scope properly, it has a loose data-type variable definitions system, so it has data-types but you don't need to specify what a variable will contain and one of the reasons for this is everything in Lua is stored in tables and because of this the table operations are also incredibly fast for indexing any type of value as a key... There are special tables which can be cloned and behave quite similar to objects but a bit of extra code is required if you want full inheritance to work.... But with all of these things included, it is powerful but it is also very friendly and easy to get to know while instilling confidence because you can immediately see progress when you save a file... I love teaching it and I love using it to teach more advanced models such as using Big O to give you a rough idea of how costly your code is to run but also giving you the tools you need to go through an examine it in a more thorough manner .. optimization, which is also very important for game programming as you can feel slow code in gameplay... and important skill-sets required if you want to be an excellent programmer / developer such as how to debug, how to debug even faster by using a code standard, how to recognize code standards used by companies to easily jump in and emulate that standard ( something required if you want to work in a team otherwise code looks like it was written by hundreds of people instead of a single person or well-oiled team ), and more... I have close to 3 decades of expertise in dozens of languages.
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top