View unanswered posts | View active topics It is currently Thu Mar 28, 2024 10:17 pm



Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3  Next
 On the very raw basics of programming... 
Author Message
User avatar

Joined: Tue Oct 30, 2007 4:02 pm
Posts: 1434
Reply with quote
Post Re: On the very raw basics of programming...
Usually you don't get to binary in university until about the third semester. Mind you, they do teach the raw basics of binary, as in the possible states, how to convert it to decimal and so on, but on a programming point of view it comes much later.

Like an engineer at the university I went to once said "no one really uses low level for anything anymore, but it's a required skill to have".


Mon Apr 09, 2012 3:54 pm
Profile

Joined: Thu Jan 20, 2011 12:19 am
Posts: 396
Reply with quote
Post Re: On the very raw basics of programming...
TheLastBanana wrote:
Homophanim wrote:
You don't need to know binary to program in the same way you don't need a car to get around. Not learning it is taking a shortcut. There are no shortcuts when it comes to learning something. Learn from the ground up, don't jump right in to "Hello, world!" without knowing what you're doing.

I'd argue that, currently, "Hello, world!" is starting from the ground up. Understanding how binary works is pretty unnecessary for a functional understanding of computer languages. Plenty of people use scripting languages to automate things (like with batch files or Excel scripts), and the concept of binary isn't needed for those cases. Correct me if I'm wrong here, but in my experience, most college-level courses in computer science don't even start with binary -- it's usually things like variables, functions and loops that they introduce you to first.
For that very reason, C++ is probably a terrible place to start. It involves much more complexity than a higher-level language like Lua. It's a bit like learning to drive by hopping into an 18-wheeler right off the bat. Yes, you get closer to the actual mechanics of the vehicle, and you arguably learn faster as a result, but there's a reason that you start in a smaller vehicle and then graduate to something bigger.

Having learned in a Suburban, I'm very, very glad I did because now I can drive ♥♥♥♥ anything and I'm convinced that lack of confidence and willingness to double check myself at all times is why I've never been in any sort of accident. The reason given that you should start in a smaller vehicle and then graduate to something bigger is because vehicles are dangerous and you can hurt yourself if you try to use something powerful in the wrong way. This does not apply to programming languages. You gain a bedrock of understanding and work up. The backwards learning process you are recommending will have you writing programs faster, but certainly not better. And anyway, everyone is straw-manning anyway. Binary was just an example, my point was that every programming book ever starts by teaching you how to write "Hello, world!" which is utterly useless for teaching you programming concepts and only useful for teaching you the specific syntax of a language. Carl Herold's approach is much easier, gives you a much more complete understanding of what you are doing, and does not take a sink-or-swim approach to teaching someone something. He explains every bit of everything so that you actually understand what you are doing. He even says this:
Quote:
http://www.highercomputingforeveryone.com/Course_1/Unit_2/Lesson_2/
It may seem like binary is something you will never have to use in programming. The truth is, if all you planned to do was learn a language or make simple applications, this is probably true.

Trust Mr. Herold. He knows what he's doing, far more than you or I do.
Quote:
I didn't say it was a programming language, you ♥♥♥♥ idiot.
I just suggested him to learn Lua++. Stop being stupid

Now now, there's no reason to get aggressive just because I know more than you do. You most certainly did not "just suggested him to learn Lua++", as that would have been acceptable. What you said was:
Quote:
It's important to learn the integration of Lua (which is a programming language and not a form of magic) within C++.

Which is an utter falsehood. It is not, in the slightest, important that he learn how to integrate a scripting language into a programming language.

As for "I didn't say it was a programming language, you ♥♥♥♥ idiot."
Quote:
Lua (which is a programming language and not a form of magic)

I get that I've been gone a while and you new kids think you own the place but you would do well to remember I was tearing holes in arguments long before you came here, bud. Respect your elders. Or I will make you look like an idiot. Again.
Quote:
I'm not really seeing why you need to know binary to write good programs, unless you're going to be dealing with binary representations at your level of abstraction. Then it would be essential, or you'd just ♥♥♥♥ up your data. Perhaps if you're going to be looking to optimize data as much as possible (perhaps to shuttle a lot of it around), then I could see that. Otherwise, it's not so much the binary that's important, it's knowing how using binary affects the way computers do calculations that's more important. Floating point precision difficulties, integer size limits, converting characters to shorts, that sort of thing. Counting in binary and converting from binary to decimal is useful when you're having troubles with debugging, but in most debuggers I've seen you can have the computer do that for you.

That aside, starting with a good tutorial is very important, and the one Oph linked looks quite competent. It's a bit more difficult to learn through a tutorial without people to ask, but I'm sure you can find a forum that deals specifically with the language you're using and have a go at asking them.

Again, knowing binary is not necessary at all, but starting with the lowest concept and working up will give you a much more complete understanding of what you are doing. This applies to everything. When the apprentice learns to forge metal, he doesn't get a hammer and a hot rod day one. He carries tools around for a year. Jumping RIGHT IN will give you functional knowledge faster, but will hurt you in the long run when you start making bad habits for yourself without knowing they are bad habits.


P.S. This is an interactive course, you know. He actively responds to questions and etc, there's a subreddit for it at http://www.reddit.com/r/carlhprogramming


Wed Apr 11, 2012 10:34 pm
Profile
User avatar

Joined: Fri Apr 04, 2008 12:06 am
Posts: 196
Location: In front of keyboard, staring at monitor. (WA, Oz)
Reply with quote
Post Re: On the very raw basics of programming...
I don't even know why I am going to do this. I must be a really helpful person or something.

1) Lua, not 'LUA', is used for scripting, not programming. Look up the difference.
2) The "Hello, world" lesson is used to teach the SYNTAX of the language and as the first step to learning proper. And very rarely anything else.

11) Binary. Close to no-one uses it, per se, but EVERY SINGLE THING YOU DO on any computer boils down to binary. If you don't know or understand it, chances are that you're not missing much. If you do know it, good for you. Electronics, on the other hand, would need binary know-how in some advanced situations.


Thu Apr 12, 2012 3:12 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: On the very raw basics of programming...
fwiw first year uni they started with hello world, then broke it down into what everything meant, then spent 4 weeks going over how ints and floats exist in memory as binary. Second semester you do ASM stuff and do boring things like hand-assembling some code, or turning some machine code into some ASM.

I think its pretty useful to know about if you're wanting to do C++ dev, or even java i guess. Seems that otherwise you'd just be thinking of ints, floats, (and their shorter/longer equivalents) as "numbers" in memory and likely treat them vaguely interchangably. That'd be retarded.

"Noone uses binary" is a falsehood. Heck, I use it for checking various enumerated states routinely. An example with keys would be
Code:
if(player.keys1 & KEY_UP) { /*jumping code*/ }
if(player.keys2 & (KEY_CHAT | KEY_TEAMCHAT)) { /*bring up chat interface*/ }
Bitshifting requires an understanding of how numbers are stored as binary too. Its fairly fundamental - its not hard or groundbreaking, but you're limited without it because you dont know what's going on under the hood.


Thu Apr 12, 2012 4:44 am
Profile WWW

Joined: Sat Oct 22, 2011 8:07 pm
Posts: 149
Reply with quote
Post Re: On the very raw basics of programming...
@all:
Are you talking about programming in binary or knowing the binary numeral system and bitwise operators?


Thu Apr 12, 2012 10:58 am
Profile
User avatar

Joined: Fri Apr 04, 2008 12:06 am
Posts: 196
Location: In front of keyboard, staring at monitor. (WA, Oz)
Reply with quote
Post Re: On the very raw basics of programming...
Both. I was, at least.


Thu Apr 12, 2012 11:52 am
Profile

Joined: Thu Jan 20, 2011 12:19 am
Posts: 396
Reply with quote
Post Re: On the very raw basics of programming...
They are the same thing. Just read through the lessons, you will immediately understand why it is valuable once you go through them, and anyone can learn from Mr. Herold.


Thu Apr 12, 2012 8:48 pm
Profile
User avatar

Joined: Fri May 11, 2007 4:30 pm
Posts: 1040
Location: England
Reply with quote
Post Re: On the very raw basics of programming...
I read all these "learn to program" lessons by Carl Herold and I have to say that it's oddly organized and sometimes confusingly worded, although in the end he does wrap things up and clear up the confusion. There were frequently people asking questions in the comments which should have obvious answers, because he always split it up and answered in the next section. I feel like the information could be presented in a much more condensed and comprehensible manner.

Bitwise OR and AND is common in C since it's used in many libraries SDL, WinAPI and OpenGL I believe all use OR in some common function or other (example SDL: http://sdl.beuc.net/sdl.wiki/SDL_SetVideoMode -SDL_SetVideoMode which creates the program window). However it's essentially used in the same way a number of variables would be used.

Essentially though you can use your nice bitwise stuff like this:
Code:
unsigned char inventory = 0;
enum Possible_Inventory {HAS_KEY=0x1, HAS_JETPACK=0x2, HAS_POTION=0x4, HAS_PISTOL=0x8, HAS_MACHINEGUN=0x10, HAS_FLAMETHROWER=0x20, HAS_RPG=0x40, HAS_GRENADES=0x80};
if (inventory & (HAS_JETPACK | HAS_KEY)){}
if (inventory & HAS_GRENADES){}

But it could still be done like this:
Code:
bool inventory[8] = 0;
enum Possible_Inventory {HAS_KEY=0, HAS_JETPACK, HAS_POTION, HAS_PISTOL, HAS_MACHINEGUN, HAS_FLAMETHROWER, HAS_RPG, HAS_GRENADES};
if (inventory[HAS_JETPACK] && inventory[HAS_KEY]){}
if (inventory[HAS_GRENADES]){}

Though a noob would probably use a load of individual bools or use either manually typed array positions or defines.

You might think that they are both almost identical but a bool will still take up a byte of memory as it is the smallest memory space that you can allocate (aka 7 bits of the byte will be redundant). So the bool array is taking up 8 bytes whilst the char is essentially storing those 8 bools in one byte. Obviously you can use other data types to store your data so you could use 64bit variable to contain 64 boolean values and it would only take up 8 bytes whilst obviously 64 bools would take up 64 bytes. But the storage isn't "free", there's a catch: the bitwise operators will add extra computation time, though really it's pretty much negligible on modern hardware.


Last edited by robolee on Fri Apr 13, 2012 8:44 pm, edited 1 time in total.



Thu Apr 12, 2012 10:13 pm
Profile

Joined: Thu Jan 20, 2011 12:19 am
Posts: 396
Reply with quote
Post Re: On the very raw basics of programming...
robolee wrote:
I read all these "learn to program" lessons by Carl Herold and I have to say that it's oddly organized and sometimes confusingly worded, although in the end he does wrap things up and clear up the confusion. There were frequently people asking questions in the comments which should have obvious answers, because he always split it up and answered in the next section. I feel like the information could be presented in a much more condensed and comprehensible manner.

That's actually what makes it great in my opinion, he gives you all sorts of information and you're going "What? Why am I learning this oh great and wise Carl Herold?" Then he ties it all up and hands you a revelation wrapped up with a bow. It's the perfect balance between sink-or-swim and learn-nothing-spoon-feeding.


Thu Apr 12, 2012 10:46 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: On the very raw basics of programming...
Homophanim wrote:
Quote:
Lua (which is a programming language and not a form of magic)

This isn't actually what he said. It's the word filter, which filters the term "sparkle magic" to that sentence because people were complaining about everybody using the term instead of just calling it Lua. I think that joke has run its course, though.
Even so, I'm not really sure what the point is of arguing whether it's a programming language or not. You can make programs with it, regardless of whether or not it's actually compiled. Even the Lua site refers to it as a "programming language." I'd argue that a scripting language is a subset of programming languages, not a different thing altogether. Is it really necessary to make that distinction?

Anyway, I can see why you'd feel it's a better approach. Personally, I don't think forcing the hard parts on somebody right off the bat is best way to do it, because it can be really discouraging with stuff that is, frankly, difficult to understand, especially when you can't see a tangible reason for why you're learning it other than that you've been told it'll help. If you can get a simple script running -- actually get some sort of output, and feel like you've created something, no matter how useless it may be -- it can make it more exciting and relatable. In the same way, we don't teach kids to count by telling them "2 plus 3 is 5," we start them off with objects and show the relationship to how it actually works. Still, your suggestions and explanation are equally reasonable, so I think it's more a matter of personal preference more than anything. If you're willing to work without any immediate feedback for a while, then your way could be better. After a few years of practice, how you started off won't really matter anyway.


Thu Apr 12, 2012 11:28 pm
Profile WWW

Joined: Thu Jan 20, 2011 12:19 am
Posts: 396
Reply with quote
Post Re: On the very raw basics of programming...
TheLastBanana wrote:
Homophanim wrote:
Quote:
Lua (which is a programming language and not a form of magic)

This isn't actually what he said. It's the word filter, which filters the term "sparkle magic" to that sentence because people were complaining about everybody using the term instead of just calling it Lua. I think that joke has run its course, though.
Even so, I'm not really sure what the point is of arguing whether it's a programming language or not. You can make programs with it, regardless of whether or not it's actually compiled. Even the Lua site refers to it as a "programming language." I'd argue that a scripting language is a subset of programming languages, not a different thing altogether. Is it really necessary to make that distinction?


Oh it's not, he just got a little too big for his britches is all. I mentioned it in passing and he got all insulting and acted like he knew better than me so I had to knock him down a peg. Even if it is a word filter, it's in his post so he effectively said it. His own fault for using a stupid meme. Otherwise, I agree with you.


Fri Apr 13, 2012 3:08 am
Profile
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post Re: On the very raw basics of programming...
So um... I'm just going to read over the tutorials provided and maybe take a quick look at how binary coding works.

@Homophanim
How would you make "hello world" pop up in the console through binary coding?


Fri Apr 13, 2012 11:26 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: On the very raw basics of programming...
ryry1237 wrote:
@Homophanim
How would you make "hello world" pop up in the console through binary coding?

Ahahahahaa oh god my lungs...


Fri Apr 13, 2012 4:19 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: On the very raw basics of programming...
http://code.google.com/p/pep8-1/
Download this assembler, there's an instruction set that you can also download and take a look at. Fake ISA for a fake CPU, but you can see what a high level language gets compiled down to.
All of the keywords have direct translations to binary, as do the ascii characters, it's a simple matter of find and replace once you have your assembly program working.


Fri Apr 13, 2012 5:04 pm
Profile
User avatar

Joined: Tue Oct 30, 2007 4:02 pm
Posts: 1434
Reply with quote
Post Re: On the very raw basics of programming...
Yeah, good luck with your three and a half pages of code to do it.


Fri Apr 13, 2012 6:28 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 39 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.072s | 15 Queries | GZIP : Off ]