6 ms·
I disagree. There is always value in learning something simple and master it than learning something complex and barely scratching the surface. It teaches you
by spectramax 8y ago
I disagree. There is always value in learning something simple and master it than learning something complex and barely scratching the surface.
It teaches you fundamentals, especially on an embedded system such as R-Pi.
The first language I learned was C on an ARM processor. Learning about registers, bit manipulation, seeing how compiler optimizes the code based on GCC flags, understanding pointers, memory management, the whole thing is difficult for a beginner but to me, it was immensely helpful. I also love Python/Julia/Java/JavaScript but man it makes you appreciate neat things higher languages offer.
One day I want to build my own 8-bit computer from discrete gates. I’m sure it won’t be a waste of time.
- Allower 8y agoLol you really went all in on the sunk cost fallacy there huh
- sdegutis 8y agoThe embedded environment is what makes this setup make sense. But in the general case, C is less than ideal for GUI programming compared to what's available in other languages, because of lack of first class closures and more complex data types (or at least classes). Otherwise you are basically in the 80s doing Win32 GUI programming all over again.
- terryschiavo22 8y agoWhat do first-class closures have to do with anything?
- sdegutis 8y agoBeing able to pass a closure (lexically scoped anonymous function) as an event handler is invaluable in GUI programming.
- sureaboutthis 8y agoSo you think C can't do that? Of course it can. Anything you want to create, C can handle it just as well if not better.
- icedchai 8y agoC doesn't support closures natively, so have fun building it up yourself. You can pass a function pointer. That's it.
- sureaboutthis 8y agoMy point is, that in C, you can do anything, including creating closures and passing them however you wish.
- icedchai 8y agoWith enough coding, you can "do anything" in any Turing complete language. This is meaningless. It doesn't mean it is advisable (simple, maintainable) to do so. C does not support a syntax for closures, so you'll really just be calling functions with an 'environment' arg or something similar. What's the point?
- sureaboutthis 8y agoMy point is that he claims C can't do closures or pass them either. Follow the thread. As far as being turing complete, CSS is supposedly that, also, so good luck with that.
- icedchai 8y agoWhen people say a language supports closures, they are generally talking about syntax. C does not support a convenient syntax for closures, period. Here's a guy who developed a closure "library" for C: https://nullprogram.com/blog/2017/01/08/ https://nullprogram.com/blog/2017/01/08/ It's clever, but he actually had to resort to assembly...
- freshm087 8y agoThere's a school of thought which considers complex data types to be more a part of problem then a solution. You may disagree with it, but nevertheless one certainly doesn't need complex data types to write GUI (or anything) effectively. Also, in this universe Win32 API was released in 90s, not 80s.
- sdegutis 8y agoThe complexity should be the same no matter what language you use, but how you structure and organize that complexity changes drastically. Hence in Ruby it takes only 2-3 lines of code to accomplish what in Java requires a few ItemFactories.
- Rerarom 8y ago#MandelaEffect
- badsectoracula 8y ago> Win32 API was released in 90s, not 80s. Yeah, well, kinda... technically you are correct but Win32 is 99.998% backwards compatible (as an API, not ABI) with Win16 which was first released in the 80s.
- kbumsik 8y agoI agree with you if you are talking about Python vs C. But a new GTK2 book sounds like teaching Python 2 for beginners.
- satysin 8y agoThe author does touch on this on page 76 of the book (quoted below) GTK 2 and GTK 3 One thing worth mentioning at this point is that there are two versions of GTK in use. The current version is GTK 3, and this is still under active development – it changes quite a bit between releases. For this reason, many people prefer to use the older version, GTK 2. This offers most of the same functionality, but it is stable code which doesn’t change very much any more. Some say that it is always better to use the latest and greatest version of anything, but more cautious old engineers (like your author…) tend to prefer the older version that has had a lot more testing and with which people have stopped fiddling about! In terms of the examples we are looking at here, there aren’t that many significant differences between the two, but just to be clear, the examples in this book will use GTK 2.
- megous 8y agoGTK+ 3 is stabilized now. GTK 4 sees active development, and hopefully a first release this year.
- badsectoracula 8y agoWhich, like Gtk 3 to Gtk 2, is also backwards incompatible so using Gtk 3 also wont be future proof (and Gtk4 wont be either, for that matter, unless the Gtk developers stop breaking their library every major version and decide to provide a stable API people can target - but considering they cant even decide on a stable way to make themes, i have little hope for that).
- jononor 8y agoGTK2.0.0 was released 17 years ago. GTK3.0.0 was released 7 years ago. GTK2.24 got its last patch release 2.24.32 about 1 year ago. 10 years being the mainline version, and having a supported compatible version for 16 years is pretty darn impressive! If GTK4.0.0 comes out next year, then GTK3 will have had 8 years being the mainline version. Its not quite win32 levels of stability, but it is not like they break this stuff every year or something...
- wrycoder 8y agohttps://www.nand2tetris.org/copy-of-cool-stuff https://www.nand2tetris.org/copy-of-cool-stuff This is definitely not a waste of time. But though building a physical ALU from TTL is feasible, constructing a reasonable amount of memory would be a waste of time and money. Once you have written the nand2tetris HDL for the hardware, you could translate it to Verilog and burn an FPGA quite easily.
- spectramax 8y agoThis is the coolest thing ever, thank you!
- mayankkaizen 8y agoThis is exactly what I wanted to learn. I really wanted to 'see' C in action at lowest level. This aspect of programming is what I am curious about. But I never found a decent beginner friendly resources. Anyone reading this comment, please chime in with your suggestions.
- deaddodo 8y agoIf you want to see C at it's lowest level and understand where it shines, I'd recommend the embedded and bare-metal realms. This Raspberry Pi tutorial set, for instance: https://github.com/bztsrc/raspi3-tutorial https://github.com/bztsrc/raspi3-tutorial It's also fairly popular for emulators, since it's types are orthogonal and it's low level design is well suited to designing a pseudo-machine. It's definitely being displaced in that realm by C++/Rust/Nim/etc though.
- mayankkaizen 8y agoThank you very much!!!
- s_m_t 8y agoIf I may add my two cents... I highly recommend reading through the standard library and then looking at how they are implemented in actual C. The string library is probably the most important, this is where most people mess up! If you can figure out pointers and how to actually get the size of things (sizeof(*char) doesn't get you the size of what it is pointing at... it gets you the size of a pointer which varies depending on the architecture. sizeof(myArray) doesn't give you the number of elements in an array, it gives you the number of bytes your array can hold, to get the number of elements you must do sizeof(myarray)/sizeof(myarray[0]). sizeof() is a compile-time operator, it knows nothing of runtime) you will be pretty much 99% of the way there. https://en.cppreference.com/w/c/string/byte https://en.cppreference.com/w/c/string/byte https://github.com/lattera/glibc/tree/master/string https://github.com/lattera/glibc/tree/master/string
- samt430 8y agoIts possible you may have come across this but if you havent already it speaks to what you just said https://www.evanmiller.org/you-cant-dig-upwards.html https://www.evanmiller.org/you-cant-dig-upwards.html
- teddyh 8y agoHasn’t it always been the case that the current generation skips learning about useless lower layers used by older generations? How could it be that the layers you grew up with and learned are the special ones which are still useful, when all the layers which came before, which people at the time thought essential, have turned out not to be so? I.e. why is it that C and assembler is “fundamental”, but electronics is not? (I have written about this before: https://news.ycombinator.com/item?id=19106922#19113359 https://news.ycombinator.com/item?id=19106922#19113359 )
- jack_h 8y agoI mean when I went to university we absolutely went over the electronics side of things. Certainly not to the same depth as an electrical engineer would have, but it was covered.
- jononor 8y agoI'm an electronics engineer who started to learn programming Assembler on PIC16 micro-controllers. My arguments is not against learning the fundamentals. I just know from teaching that the primary problem people have when learning is that they get stuck and stop. Making GUIs in Python (given good educational resources, like a book) will give results much faster, and more quickly become a practical skillset for GUI programming and other useful tasks. For learning C and starting to poke at low-level embedded stuff I would recommend starting with Arduino (and then into plain AVR) - and not go anywhere near a GUI toolkit. There is a reason we don't actually throw kids into the deep end when teaching them to swim. Most of them would just drown...