Jump to content

Learning to program C "the hard way" - a unique way I am going to try for my unique brain

jaqiefox

I taught myself tandy TRS-DOS (for the old TRS-80 computers, you know those antiques that had 48KB ram and two 360KB floppy drives?) and learned apple BASIC (you know, for the apple 2 line?) and later, in high school, took the only non-typing computer class they had (Microsoft Q-Basic) and to date that has been the only programming languages I have been able to learn despite trying to learn a whole slew of them from a whole slew of different techniques and places.

 

I am rather unique in how I think and learn, so everything has failed so far.  I have spent a long time trying to figure out why I could learn those I mentioned above so easily and had so much trouble with anything newer.  I think the answer, after years of trial and error and rumination is several fold.... IDEs screwing me up, the horrible amount of abstraction from the guts of the language and the guts of the computer, and the total lack of conformity across different sub-types of the language, ways it is taught, and compilers and such.

 

The answer, I think, for me anyway, is to go to something that is still usable nowadays but is still like those olden type languages in several very important aspects...

 

I found an old post somewhere about how the book I link to below being designed for a console / command line environment and not an IDE, and what code written in it still being compatible with new x86 systems... so I decided to gnab the book. spent just over $9 shipped for a used copy.  I found what is in the second link, so I can actually use a free command line compiler and environment instead of having to find/buy an old version of MS visual C, which itself is an IDE anyway, even though a very rudimentary old type.

 

http://www.charlespetzold.com/pw5/index.html

 

http://www.computersciencelab.com/Petzold.htm

 

Another advantage to learning C itself is that many microcontrollers can be programmed in it, and that is another interest of mine.

 

For those concerned about how old they are, I don't mind, I want to use this as a base to learn C and then work up to C++ from there, which I *KNOW* is still a very valid and used language to this date.  It has another huge advantage to me, the now GPL quake 1 engine quake 1 source code is written in pure C so I will be able to begin working with that, as well, after a lot of practice in this and this book.  I also have windows 95 CD and VM and even have an old 386 and 486 and pentium and all sorts of old computers (I collect and build them) should that prove necessary to learn through this book efficiently.

 

Questions? Comments?

Be gentle, please.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

Why don't use gcc? it is availible for windows in the Mingw package, which is kind of compicated set it up but from there you have a working c compiler.

you'll need "gcc-objc" and the basic stuff of Mingw 

I use Komodo as an editor, so i can use makros to exucute:

gcc -Wall -o exapmle.exe example.c

and to run the program.

but you can run it also from the comandline.

i am not a native speaker of the english language

[spoiler=My Rig: ]CPU: i7-3770k@Stock | Ram: 3x4GB@1600Mhz | Graka: 660TI@Stock | Storage: 250GB 840Evo, 1x1TB,2x2TB,2x640GB,1x500GB (JBOD) + NAS: DLINK DNS-320 2x3TB Raid1

 
Link to comment
Share on other sites

Link to post
Share on other sites

Why don't use gcc? it is availible for windows in the Mingw package, which is kind of compicated set it up but from there you have a working c compiler.

you'll need "gcc-objc" and the basic stuff of Mingw 

I use Komodo as an editor, so i can use makros to exucute:

gcc -Wall -o exapmle.exe example.c

and to run the program.

but you can run it also from the comandline.

 

That's what I am talking about doing... didja not check the links?

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

maybe you just never had a good teacher, and maybe a well-written book could show you how those abstractions work

 

the only thing i have to critique is the C ---> C++ step, which will be hard anyway, and you will have to be careful not to learn it the bad way: C style written in C++ is often valid code (it compiles), but it's bad code as well. You will need to use abstractions likeaboss to use C++ and benefit from its strength

(C won't help you much with C++)

 

also, OOP is based on abstraction and it's the future of programming, so it's really worth it to learn it, sooner or later

 

good luck tho

Link to comment
Share on other sites

Link to post
Share on other sites

. . . . OOP is based on abstraction and it's the future of programming, so it's really worth it to learn it, sooner or later

 

good luck tho

 

If that implies sickening levels of inefficiency and bloat in code (like java) then I'll take my non OOP and abstraction free programming any old day of the week.

 

 

Thanks for the good luck :)

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

That's what I am talking about doing... didja not check the links?

 

Yes i have not checked the liks because you were talking aboaut a rudimentary old type.

Mingw is not realy that old i have it runnig on a win8.1x64 system.

by the way the latest gcc version is from 2014, and is used in most if not all linux distros.

I wish you luck with learning c.

i am not a native speaker of the english language

[spoiler=My Rig: ]CPU: i7-3770k@Stock | Ram: 3x4GB@1600Mhz | Graka: 660TI@Stock | Storage: 250GB 840Evo, 1x1TB,2x2TB,2x640GB,1x500GB (JBOD) + NAS: DLINK DNS-320 2x3TB Raid1

 
Link to comment
Share on other sites

Link to post
Share on other sites

If that implies sickening levels of inefficiency and bloat in code (like java) then I'll take my non OOP and abstraction free programming any old day of the week.

a good implementation of an OOP code (i'm thinking of C++) will be just as efficient as C, don't think that abstraction will take away performance, those languages are carefully crafted

i personally don't like java either, but i gotta say that it's still astoundingly fast, the JVM makes miracles, it's very fascinating and admirable imo

it's very very cool that they can give you many many layers of abstractions at such a low (if any) price

Link to comment
Share on other sites

Link to post
Share on other sites

i personally don't like java either, but i gotta say that it's still astoundingly fast, the JVM makes miracles, it's very fascinating and admirable imo

it's very very cool that they can give you many many layers of abstractions at such a low (if any) price

 

case in point: minecraft.  That and many, many, many more examples out there prove how horribly inefficient java is.  If you call that level of bloat a miracle, I'm sorry to say that makes me think all of your advice and input are....that incorrect.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

http://en.m.wikipedia.org/wiki/Java_performance

"Java is in some cases equal to C++ on low-level and numeric benchmarks [...] In some real-life programs, Java out-performs C."

you just have to use it the right way, for the right purposes

anyway performance is not an issue for java anymore, but the time it saves you (fast and easy to code) and its portability (cross-os compatibility) are its selling points

minecraft and bad programs can be poorly written in any language

forgot to quote your post @jaqiefox

Link to comment
Share on other sites

Link to post
Share on other sites

anyway performance is not an issue for java anymore,

 

I'll let the astounding falsity of that statement stand on it's own.

 

 

 its portability (cross-os compatibility)

 

never hear of these little devices called microcontrollers?

no?

how about linux? bsd?

mingw?

no?

 

 

 

Ever hear of flipping the bozo bit?

 

 

What you say is so screwed up and patently false that I can't help but do it for you.

 

Goodbye.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

-things-

there are applications in which performance is the main point, and applications in which it isn't

if you keep thinking that extreme performance is the only thing in the world, that microcontrollers rule the world of programming, and that your brain is so different and special because you can think at low level and you can do anything with setting bits, then good luck with it, have fun wasting time, you will end up writing long complex programs with worse performance than the equivalent program developed with a high level language

 

and what do you mean with linux? bsd? do you think that any C code that compiled under linux with GCC will work under windows with mingw? heh

Link to comment
Share on other sites

Link to post
Share on other sites

Based on what you have said, I'd say vi and gcc are the way to go as far as IDEs go (IE: don't use one :P). Don't get me wrong, I have used Visual Studio in the past and it *can* make things easier. But when it comes to configuring the compiler I personally find it SOOOO much easier to memorize a few GCC flags than to go digging through the menus for them in VS.

 

As far as abstraction goes, you are correct. Low-level calls like read() and write() still go, more or less, directly into the kernel for handling, but anyone who codes in C++ or java will be using streams, which add a buffer (on top of what the OS / hardware does for you already) and a few other 'goodies'. You could absolutely write your own streaming IO library in C and benchmark it against C++'s built-in streaming library.

 

Ciccioo is, amazingly, not wrong. OOP *can* be faster than functional C. But, almost 0 programmers are taught in which cases OOP can be faster. I was one of the lucky few who was taught. Oh, and the best part? "Anything OOP can do C can do better!" "No it can't! "Yes it can!"

 

*THE* single thing that OOP beats the pants off functional C for is when you have a function, let's say...'increment', for 60 different kinds of objects, and inside that increment function you need to first figure out what type of object you are increment, then increment it. So, essentially, you'd have 60 if-statements (a switch/case statement is just a different way of writing IFs, they all turn into branch-trees when we get to the assembly level) to pick how to increment. The number 60 is important, as...I think it's actually after about 10 IFs the OOP becomes faster, but anyway, it's an economy of scale. After a certain number OOP starts to outrun giant IF blocks. Why?

 

Well, first, how would OOP solve this problem? OOP would solve this problem by having the 'increment' function be part of each object. So you'd just call object.increment() and you'd let the compiler figure out which one of the 60 increment functions was the correct one to call.

 

If blocks take forever because branches on the CPU take a long time to execute for various reasons. In OOP, they use a binary tree of pointers to the various versions of 'increment' in order to pick the right one in O(lg(n)) time, whereas the C-style takes O(n) time, which is slower. However...

 

There's a thing you can do in C. It's called a function pointer. See, in C, you specify the 'type' of a pointer, but really, that is for you and the compiler's benefit. At the end of the day, to C, all pointers are created equal, and they are all just addresses either in the Heap, or on the Stack. It is completely possible in C (re: I've done it, and seen it done) to write an OOP-style binary tree function selector using function pointers, thus bypassing the need for the giant IF-statements of doom, and also granting you as much, if not more, performance than OOP would give you.

 

OOP is a great crutch for both bad programmers, and good programmers who need to get something that works thrown out the door quickly. C is wonderful for code that has to always work, work perfectly, and have as little waste as possible. One is a sledgehammer, the other is a jeweler's ball-peen hammer. They are built for two totally different kinds of nails. :)

Link to comment
Share on other sites

Link to post
Share on other sites

@asquirrel

 

oh so true.  You really put it well - thank you.

 

As for the other poster you speak of - they are already on ignore.  They resorted to ad-hominem attacks and even calling me a boy (something very wrong with someone incapable of telling a boy from a girl ;) )....anyways, my point is that the obvious is there, and some refuse to see the forest for the trees (too many nowadays) that slob programming and overpowered hardware are not the future, they are a fad just like overconsumption of the USA (25% of the world's resources used up by this tiny slice of the world's population).... as moore's law breaks down, as power efficiency and resource responsibility becomes more pronounced, as the true cost of resources even including computing resources becomes clear, things will go back to being more efficient and things like those will go the way of the dodo.

 

Two different kinds of nails indeed. And two different worlds.  I challenged a world view, and got flamed for it, when I was only trying to show how false the statements were.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

-snip-

flame? i'm here to express my opinion and to argue about yours

you called my post worthless, my ideas screwed up and acted like i was the last of the noobs, then you moved on to put me on the ignore list, talking of me indirectly like kids

you are coherent at least: your actions reflect your thoughts, and your thoughts are close-minded

 

your thoughts can't change direction because you like bits so much, that your thoughts travel on binaries

*badum tss*

Link to comment
Share on other sites

Link to post
Share on other sites

OK I think I have MingW installed. I'll play with it later, time to take a break, maybe get some shut eye, do other stuff.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

In uni we used C to program Arduino and a custom made ARM board, and it did some quite amazing things. Especially combined with some FPGAs. 

 

Spoiler

CPU:Intel Xeon X5660 @ 4.2 GHz RAM:6x2 GB 1600MHz DDR3 MB:Asus P6T Deluxe GPU:Asus GTX 660 TI OC Cooler:Akasa Nero 3


SSD:OCZ Vertex 3 120 GB HDD:2x640 GB WD Black Fans:2xCorsair AF 120 PSU:Seasonic 450 W 80+ Case:Thermaltake Xaser VI MX OS:Windows 10
Speakers:Altec Lansing MX5021 Keyboard:Razer Blackwidow 2013 Mouse:Logitech MX Master Monitor:Dell U2412M Headphones: Logitech G430

Big thanks to Damikiller37 for making me an awesome Intel 4004 out of trixels!

Link to comment
Share on other sites

Link to post
Share on other sites

apparently my book does not come with the companion CD.... hunting it down has been a nightmare. anyone have any ideas? already tried the usual suspects like TPB.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

wrote the author, also found oreily archive of *SOME* of the files that were on the CD... hoping the author is kind enough to take the trouble to point me at a URL containing an ISO or something...

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

In uni we used C to program Arduino and a custom made ARM board, and it did some quite amazing things. Especially combined with some FPGAs. 

 

That's one of many things I really hope to do with this knowledge.

 

I have one of the adafruit.com boarduinos, and an FTDI friend to program it with from USB.

I am a female pc hardware expert and enthusiast, over 170 IQ, been in the tech scene since the 80s. get over it.  This message brought to you by me being tired of people which have problems with any of those things.   ~Jaqie Fox

-=|Fighting computer ignorance since 1995|=-

Link to comment
Share on other sites

Link to post
Share on other sites

case in point: minecraft.  That and many, many, many more examples out there prove how horribly inefficient java is.  If you call that level of bloat a miracle, I'm sorry to say that makes me think all of your advice and input are....that incorrect.

 

It's not efficient in terms of memory use, but speed isn't really a concern. Thinking that C is significantly faster than Java, is just pure ignorance.

 

If you really care for efficency and speed, why not try Fortran or start writing in Assembler?!

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

You said you have a unique way of learning or perhaps it is the teacher. There's a Youtuber named thenewboston he has videos detailing various languages and programs from C++ to Adobe After Effects. He has videos on both C and C++.

 

I'm sure you can find each of these yourself but I thought it might be more pleasant if I just listed them all.

 

Here is his tutorial on C++: 

His tutorial on C: 

As well as his channel" https://www.youtube.com/user/thenewboston

You gotta do you girl. I always say you gotta do you. And if he's doing him, then who's doing you? Because right now, it seems like no one's doing you.

- Stefani Stilton (she / her) 🏳️‍🌈🏳️‍⚧️

Link to comment
Share on other sites

Link to post
Share on other sites

-snip- thenewboston -snip-

i never tried one myself so i could be seriously wrong, but when i see people suggest thenewboston i can't help thinking that videotutorials are better suited for things like "how to craft a rocket with coke and M&Ms" rather than teaching a programming language (and how to program)

Link to comment
Share on other sites

Link to post
Share on other sites

i never tried one myself so i could be seriously wrong, but when i see people suggest thenewboston i can't help thinking that videotutorials are better suited for things like "how to craft a rocket with coke and M&Ms" rather than teaching a programming language (and how to program)

It depends on the learner on my opinion. To me the video is not much different from me learning this in a classroom setting even books like the For Dummies series does a similar job in teaching basic and intermediate coding. What would you recommend? Also why do you believe it's less suited to such things? For that matter even if its less suited that doesn't necessarily translate into it being significantly worse than other options. 

You gotta do you girl. I always say you gotta do you. And if he's doing him, then who's doing you? Because right now, it seems like no one's doing you.

- Stefani Stilton (she / her) 🏳️‍🌈🏳️‍⚧️

Link to comment
Share on other sites

Link to post
Share on other sites

It depends on the learner on my opinion. To me the video is not much different from me learning this in a classroom setting even books like the For Dummies series does a similar job in teaching basic and intermediate coding. What would you recommend? Also why do you believe it's less suited to such things? For that matter even if its less suited that doesn't necessarily translate into it being significantly worse than other options. 

you have a good point saying that at the end of the day it's almost the same as a lesson at school/uni

i don't know, i'm more used to reading things when i want to have a real knowledge about the thing, especially when the thing can be hard to understand so i have to read it again over and over and think about it taking my time, while videos may be good for having a general understanding of the subject, but i don't think they give you the time to understand, to learn

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×