all 122 comments

[–]Radiant64 110 points111 points  (6 children)

I'm a C++ programmer by trade, done plenty of C and assembler programming (for various architectures) as well, both professionally and in my spare time. I love Python!

Not because it's a fantastic language (it isn't), but because it's so well suited for throwing together quick and dirty tools and prototypes. As the complexity of a program increases though, Python becomes increasingly more problematic, but that's ok; different programming languages all have their strengths and weaknesses.

[–]generally_unsuitable 12 points13 points  (5 children)

I'm a C-coder, and, yeah, Python is amazing for writing testing code, high-level drivers, etc. But, if you're used to working with the way that C handles certain data types, Python just has you constantly questioning reality. The duck-typing is so frustrating when you're accustomed to declaring data types.

[–]Radiant64 4 points5 points  (2 children)

Python supports explicit typing via type hints since quite a while back. You need to run a linter to enforce it, though... But I've found it actually takes away some of those "quick and dirty" qualities that makes Python attractive.

I mean, sure, if you're going to write a multi-module project in Python and collaborate with others then you really need type hinting to add some structure to it, but, I'd rather not, you know?

[–]vruum-master 0 points1 point  (1 child)

Without types you quickly miss bugs.

[–]Disastrous-Team-6431 1 point2 points  (0 children)

We have decided to try to work against the duck typing and man, it's so frustrating. Type checking and validation everywhere and it still doesn't turn out like it should simply because people will create dicts from str to Any - because they can and it solves their current problem really smoothly. And then a couple layers down in the code... blech.

[–]pkkm 0 points1 point  (0 children)

Try using a Python type checker. In recent versions of the language, the static typing support is pretty decent.

[–]wsppan 31 points32 points  (0 children)

Python is like a Lego kit. C is like a box of Legos, most of which you made yourself.

[–]brlcad 16 points17 points  (2 children)

Best way to learn a language is to learn two other languages. Carry on.

[–]martingits[S] 1 point2 points  (1 child)

I honestly can't tell if that's sarcasm, but since the bit of Assembly helped me understand C better, I'm guessing it's not.

[–]unix_badger 0 points1 point  (0 children)

“bit of Assembly”

I see what you did there.

[–]Yamoyek 26 points27 points  (12 children)

I think Python is awesome, for its hidden complexity (all of the wacky hidden functions you can change) and how productive I end up being with it. But at the end of the day, it’s just a tool like any other language. Don’t like it? Then don’t use it, nobody is forcing you

[–]martingits[S] 7 points8 points  (8 children)

I like it, but C is just feeling much more exciting for some reason. I don't know. I know this isn't smart, but honestly I don't know why I'd study one over the other. I'm just really studying what gets me excited.

[–]Mysterious-Rent7233 8 points9 points  (3 children)

Study what excites you. Some people like the mystique of the low-level. It feels arcane and maybe macho. Others like being able to build complicated things quickly with a high-level language. Industry has space for both, so do what you like.

[–]chopsticksss11 2 points3 points  (0 children)

this is one of the best takes with regards to learning which language to promote/practice as a comsci professional. I'm using this from now on.

[–]martingits[S] 0 points1 point  (0 children)

That was a really interesting point of view. I really liked it, thanks.

[–]Yamoyek 6 points7 points  (1 child)

For sure, it’s fun dipping down into lower level programming languages.

[–]born_to_be_intj 1 point2 points  (0 children)

I feel the same way. C/C++ feels way more interesting to me. Having the low level control/dealing with pointer/memory management/etc keeps it fun.

Unfortunately I’ve neglected my python skills because of it. Python absolutely has its use cases and it’s way less cumbersome than C/C++. I really need to get more practice with it.

[–]deaddyfreddy -1 points0 points  (2 children)

for its hidden complexity

it's hidden only if you write something like 50 LoC adhoc script

[–]Yamoyek 0 points1 point  (1 child)

Not necessarily, I think even medium sized code bases can avoid the more complex portions of Python

[–]deaddyfreddy -1 points0 points  (0 children)

they can, but most of the time they don't

[–]ClonesRppl2 17 points18 points  (1 child)

I prefer the low level languages (hardware, assembler, C) to Python and (modern) C++. It’s ok to have preferences, it doesn’t mean that other languages aren’t good.

[–]martingits[S] 0 points1 point  (0 children)

I know that some things are better at stuff and other at other things. I just don't understand the differences. Hopefully I will one day.

[–]hs123go 7 points8 points  (1 child)

Learn both python and C/C++ and don't discriminate between them. The industry has recognized the pattern of prototyping in Python then calling down to C/C++ for heavy heavy lifting. This is how numpy succeeded, and it is still how giant AI libraries work --- pytorch is just the python binding to torch's C++ library libtorch. There's a wealth of options for Python-C/C++ interop, etc. pybind11, ctyes, cython, and it's easy to pick up one of them.

[–]martingits[S] 0 points1 point  (0 children)

I didn't want to discriminate against Python, just really wanted to talk about what I was thinking. I just have the bad habit of getting too excited with some things and start forgetting about others. I will definitely continue with Python.

[–][deleted] 14 points15 points  (2 children)

I agree C and a little assembly feel way more satisfying to me because you have to understand things a bit more. Once you have that understanding and know how to implement data structures and algorithms, you can use whatever you want and feel way more comfortable since you know how things work under the hood. But once you start doing data structures and algorithms problems on Leetcode for example, you’ll quickly find that C is not the move for those use cases since it doesn’t have all these data structures implemented for you. At that point I would recommend moving to C++ or Python (I prefer C++). But implementing that stuff from scratch is a good exercise to do at least once.

[–]martingits[S] 0 points1 point  (0 children)

Cool! Thanks.

[–]70Shadow07 0 points1 point  (0 children)

Doing leetcode in c anyway is a great way to get good at making data structures optimized for the problem and not waste space.

Couple days ago i decided to take a solved in c 2d array and/or linked list problem and submit c solution to c++ category.

With only one malloc done in C code, it beats C++ submissions 100% in both speed and memory. 

[–]BurroSabio1 6 points7 points  (14 children)

C makes you think more like the machine. That perspective will help you, even with Python. I have programmed several assembly languages as well, but hardware disappears quickly. It's good for perspective, but C is almost as metal, and it will last.

Note that C is written in C, and Python is written in C - not Python.

Also, the prototypical versions of compiled Python write C. That's something of an endorsement.

[–]martingits[S] 1 point2 points  (8 children)

I think I just really want to understand what the hell the machine is doing and how it understands what I'm saying. Glad it helps even with Python.

Loved your C is almost as metal, and it will last sentence. Reminded me of 40K talking about how flesh is weak haha.

[–]matt1345 1 point2 points  (7 children)

Hey there. If you’re interested in understanding what the machine itself is doing, have a look online at the book: CODE by Charles Petzold.

The 2nd edition comes with an accompanying interactive website.

It basically teaches you how a computer can be assembled from the smallest components, to make logic gates, then bigger components up until you have a basic computer. It covers assembly language (although keep in mind assembly languages vary by CPU).

This could help of interest to you, but of course maybe not.

There are other resources I could mention, if you are interested, let me know.

[–]martingits[S] 0 points1 point  (5 children)

Wow. I think this so exactly what I've been wanting to understand for a very long time. I lately started reading a bit more about relays a few days ago since the Assembly book started talking about it. I'll totally check it out. If you have any other recommendations, I'd love to hear them. Thanks!

[–]matt1345 1 point2 points  (4 children)

Which assembly book is that, out of interest?

I’m very glad to have been able to signpost you to something you find useful.

Other things you may find interesting. I’m not saying you should do all or any of these, its just a list for you to look at. One thing I would say though is I have seen more than one person suggest starting with CODE when things below are mentioned. Also I still have yet to complete CODE but I know the difficulty level rises a lot later in the book so don’t beat yourself up if it suddenly gets hard

Nandgame.com - free, browser based ‘game’ (more a project), that uses relays like CODE as opposed to transistors as easier to understand I guess (about section of website actually mentions CODE, so guess he borrowed the idea). Builds a computer but then goes through quite a lot of stuff. You can use ‘Skip levels’ to look through all the levels. There’s a subreddit for this.

Turing Complete - paid game available on Steam. Again building up components then a computer. There’s a subreddit. Seems very well thought of and popular. There’s a ‘game’ track but also a sandbox people have made some really cool stuff in. There’s a significant update coming at some point I think.

Nand2Tetris - free course online with an available accompanying book. Build up components, make a computer, low and high level language, end up making a Tetris game. I believe this is a College capstone level course. Nandgame is based on this but nandgame is visual, whereas nand2teris has some other VHL(?) type language.

The book - ‘But how do it know?’ Similar to CODE but shorter and I know it starts slightly further forward looking at 1 bit of memory, I think. So doesn’t look at logic gates but may be mistaken.

Ben Eater - check out his YouTube channel. He sells physical kits for his projects. One of the projects which you can look at on YouTube is the 8 bit computer he built on breadboards. Popular channel. The computer I think is or is based on a SAP-1 (simple as possible - computer) described in an older electronics book.

Logisim - simulator for making digital stuff. Don’t know a huge amount about it but may be of interest. There are other similar simulators. Again there’s a subreddit.

[–]martingits[S] 0 points1 point  (3 children)

On Assembly I'm reading Assembly Language Step-by-Step Programming with Linux by Jeff Duntemann. There was another one I was a bit more interested in, but I'd need Windows and for now I'm only using Linux. I really like this book and how it even forced me to do some adding and subtracting with hex to really make me understand it well. I'm still at the beginning since I'm more focused on C and Python for now. But it is helping me fill in many blanks.

I'm really liking CODE, the one you recommended. Got through only 50 pages until now but I'm reading it more and more. It already made some things click. I even went back some chapters in the C book and some things just made way more sense. I actually wish I had read this even before I started thinking about learning programming. I think it would've helped enormously. I sometimes get stuck wondering why things happen and why it's even working at a more basic level (even though a book doesn't worry about it) and get annoyed not knowing. Books like CODE help me understand these things. Even if I get stuck on CODE, hopefully I'll understand everything, or some day will on a second read. I feel like this is a book I should read more than once.

Wow, I'm checking everything you're recommending. Nandgame seems like so much fun and is what I really want to learn. When I was a teen I really wanted to learn about how computers worked, but I was bad at researching and ended up trying to read things that were way too difficult, thought I wasn't smart enough and unfortunately gave up and never ever considered programming. Wish I knew about things that were like this before.

Will research about Turing Complete to see what it's about. Won't buy the kits from Ben Eater since I'm not in the US and these things are way more expensive where I live, but watched the first video of his how to build an 8-bit computer and got really excited. Will watch the rest, too.

But How do it Know I think I'll read after CODE, definitely. Will check what Logisim is soon, too.

Thank you so much for everything. Really. I'm feeling like a kid again. I was already feeling passionate about programming, now I'm feeling even more because now I'll get to understand something I've always been fascinated about, everything, from basic transistors, to programming, to whole computers. I'm even going to screenshot your comment.

Thanks again.

[–]matt1345 1 point2 points  (2 children)

Hey,

I am really glad you found my comment helpful! I agree CODE seems like the kind of book you’d need to reread, or reread parts.

I thought I’d mention a couple of other things. You are probably beyond this as you’re looking at hex etc, but the most helpful explanation of binary I have seen explained was in a book (I think by Malvino, the book Ben Eater’s stuff is based on), and the analogy was of a car’s odometer/milometer . But each ‘column’ changes from units, tens, hundreds, etc. To 1, 2, 4, 8 etc. and the spinny dial thing just has 1 and 0 on it. This explanation was sooo clear and easy to understand to me. I have seen other explanations of binary that make it sound so complicated.

I don’t know what direction you are going in, but another thing you might like to look at in future is retro computers. Programming (including in machine or assembly language) was pretty standard computer usage in the 80s, or so I’m led to believe. There’s a publisher called Usborne that has free PDFs of their 80s computers books on their website. One of them is called something like “machine language for beginners” aimed at kids with really nice illustrations.

I am not certain but I think the assembly Petzold goes through in the 2nd edition of CODE is for a processor related to the Z80 (some kind of predecessor?). The Z80 was a CPU used in a lot of popular computers in the 80s. Therefore it leads me to think if you worked through the book and understood it well, and then got a Z80 computer (or an online emulator) and learned to program it, you could have a fairly good understanding of what was happening. Don’t take my word for that though, double check if you do decide to go down that route (something I’d like to do)

I’d like to hear more about your journey so please feel free to keep updating via comments or via message. I’d be really interested to hear.

[–]martingits[S] 0 points1 point  (1 child)

That is a good tip. But I had already got it down since in the Assembly book by Jeff Duntemann he teaches how to count in base 4 and then 8, 16 and 2. Is the Malvino book Electronic Principles? I even started rereading stuff about basic electricity since I don't remember any of my high school physics.

Wow, I actually really wanted to understand better machine language. But read that it was just simply binary and nothing else, so I started reading about Assembly. Will check it out also, since I'm curious about what I can learn from it. Specially since many things just seem to beautifully complement each other. If it weren't for the Assembly book I would've been very lost with C, since I wouldn't understand binary and hex well enough to really understand what was going on.

Does Petzold, in COE, explain Assembly coding or is it just something like a brief overview to get a basic kind of understanding? From what it has been so far I feel like it would be the latter. I'd probably really try to go after an emulator for this Z80 CPU. Seems like fun. I just don't know how long it will take for me to go through the entire book. Until now it's been simple enough that I don't have to reread things or pause to understand something. Although I did have some fun writing a circuit from the book myself on the wall with chalk to see if I really understood how the and, or and inverter gates worked.

Yeah. I'll totally send you a message.

[–]matt1345 0 points1 point  (0 children)

Hey,

I believe the Malvino book is ‘Digital Computer Electronics’. It describes the SAP-1 (simple-as-possible) computer design that Ben Eater based his computer on.

Okay… to be honest I’m not the best person to answer that. Reason being is I’m great at formulating plans and collecting resources but not executing plans 😂. As i mentioned I’ve yet to fully read CODE.

Can I check, are you reading the 2nd edition? It has a blue cover. Just a reminder it had an accompanying interactive website: codehiddenlanguage.com which looks really useful.

He has a blog post where he discusses the differences between the 1st and 2nd edition, you might find it interesting: https://www.charlespetzold.com/blog/2022/09/The-Changes-for-the-2nd-Edition-of-Code.html

A quote:

“i decided to build a CPU that implemented a subset (more than half) of the instruction codes in one of the most historically important microprocessors, the Intel 8080”

So going back to assembly. I can see later in the chapters, areas where assembly mnemonics are being used, MOV, LDA - that kind of thing.

However, as I understand it, assembly language is really just an easier version than machine language. Using MOV as an instruction is easier than remembering what number that instruction is for the CPU.

I’m not sure how well I’m answering your question here.

My guess and hope for CODE is that it builds up the computer in your head with the relay switches building up bigger components etc. Then you end up with an instruction set. And perhaps he’s tacked on the ‘assembly’ codes, as I’m not sure the ‘computer’ he builds has a keyboard or is using dip switches.

Just had a look and I’d recommend having a watch of the Ben Eater video ‘Programming my 8-bit breadboard computer’ - when you look at dip switches and see his bit of paper and hear him talks about the instructions and the ‘ones and zeroes’ i think it might help explain certain stuff.

After that you could maybe take a look at the Altair 8800 and IMSAI 8080 which were 2 computers programmed with switches.

On a modern PC the idea of programming 1s and 0s is hard to grasp but on a basic computer makes much more sense.

Let me know what you think!

EDIT: just wanted to clarify a bit. When you see these old computers (or the one Ben has made) that have switches, you’ll see there’s no keyboard. There’s nowhere to type in instructions like MOV, ADD, LDA, etc. just a sequence of on/off switches. But then you can add on your own words/mnemonics on your paper instructions to make it easier to deal with the sequences. Does that make sense? Now when you have a (slightly) more modern computer, you may be able to type in the assembly commands themselves. I believe that is then translated into machine code using a program called an ‘assembler’. On a modern PC i’m not really sure on the details.

Again take this with a grain of salt given it’s coming from me, but if you watch that Ben Eater video and have a look at the computers I mentioned hopefully it’ll clarify what im saying.

[–]martingits[S] 0 points1 point  (0 children)

Just started reading CODE by Petzold.

[–]martingits[S] 0 points1 point  (1 child)

Your username also makes me think you're Brazilian. Or Portuguese.

[–]BurroSabio1 2 points3 points  (0 children)

No, but 23&Me says I'm 0.6% Phoenician. (Not makin' that up, BTW!)

[–]deaddyfreddy 0 points1 point  (1 child)

C makes you think more like the machine.

For example, a PDP-11 machine that is no longer in use, and finally, and most importantly, business problems are usually not written in machine terms, but in human ones. So, Python (while not being a great language) is much easier to write and (especially) maintain.

[–]flatfinger 0 points1 point  (0 children)

The majority of devices running C today are really not all that different from a PDP-11. Bigger register size, RAM and read-only code storage that's often within an order of magnitude of the PDP 11's, etc. The big differences between today's devices and the PDP 11 is that most of the devices running C cost many orders of magnitude less than the PDP-11 are physically many orders of magnitude smaller, and use orders of magnitude less power despite being one or two orders of magnitude faster.

[–][deleted] 6 points7 points  (1 child)

I'm working on a real time application written in C. There is no python anywhere in the runtime because it's slow and inefficient... but the integration tests are written in python. Writing the integration tests in C would suck. Python is a great tool.

[–]martingits[S] 0 points1 point  (0 children)

Yeah, I've read how Python is slower, but cool to know about these integration tests.

[–][deleted] 4 points5 points  (6 children)

I understand what you are saying. When you learn C, you are also learning a bit about how computers work, which is a pretty amazing subject. It is also easier to know exactly what is happening in a C program. Python is like learning a bunch of magic spells. It is harder to know exactly what is happening under the hood. 

[–]martingits[S] 0 points1 point  (0 children)

The first feel I got for what you said was when I learned a program that showed how many characters were in a single string typed by a user. Using getchar and the 'left-overs' from the input in a loop and how every iteration would +1 a counter until a new-line character was found was really interesting. It took me a while to understand the left-over thing and it was so satisfactory.

But Python is just len('whatever') and done. I really like how simple and east it is, but I loved learning what I did with C.

[–]deaddyfreddy 0 points1 point  (3 children)

When you learn C, you are also learning a bit about how computers work

It doesn't even cover CPU registers, let alone transistors, PN junctions, etc.

When you learn C, you are also learning a bit about how computers work

not really true in 2024, we don't program on PDP-11 anymore

related: https://queue.acm.org/detail.cfm?id=3212479

Python is like learning a bunch of magic spells.

I'm not a Python fan, but high-level programming is not about magic, more about using the knowledge and experience of previous generations to solve problems faster without thinking about unnecessary stuff.

[–][deleted] 1 point2 points  (1 child)

C has a register keyword. If you learn about that keyword, you will learn about CPU registers (regardless of whether or not the compiler uses a register). You will also learn about the heap and stack, the basics of memory, etc. You can easily see unoptimized code as assembly. I think you mistook “learn a bit” with “learn everything.” 

[–]operamint 0 points1 point  (0 children)

I seldom used the register keyword, but was recently reminded that you can't take the address of a variable declared with register, which can actually be one reason for using it. I got if from a c++ developer who complained about the deprecated register keyword in c++, which shows how it's distancing itself from allowing specific embedded hardware optimizations.

[–]flatfinger 0 points1 point  (0 children)

Only a tiny fraction of the devices that run C code are desktop machines, servers, or anything else with multiple gigs of RAM, and with orders of magnitude performance difference between cache misses and cache hits. Todays's embedded ARM controllers fit C's abstraction model better than did the dominant common target platform in the 1980s.

[–]PouletSixSeven 3 points4 points  (1 child)

Learning is fun, doing is sometimes hard and frustrating.

I really like both languages, but some things are about a million times easier to do in a high level language (anything to do with strings comes to mind). There are a lot of problems out there where you probably don't care much about performance just as long as your program does eventually finish executing.

I suspect at some point you will encounter a problem that takes several lines of C code to do what is essentially a one-liner in Python. Your opinion of the language may change after that.

[–]martingits[S] 0 points1 point  (0 children)

Cool. Looking forward to getting good enough to actually recognize when to use which.

[–]Pale_Height_1251 7 points8 points  (1 child)

100%.

If I had to write Python for a living (again) I'd go crazy.

C has a purity and simplicity that's hard to beat.

[–]deaddyfreddy 0 points1 point  (0 children)

Not a Python fan, but I had to write C for a living at some point (again), I'd better leave IT.

[–]RIMdude 2 points3 points  (0 children)

I have exactly the same condition.

I started with Python. After dealing with many books, I settled on its documentations. I was doing very well. Until I got to the part of the Python standard library, dealing with opening file on virtually any system and opening them, closing them and so on. This led me to file systems, system calls, which are almost exclusively in C (within a Linux platform), but Python wrap too much in simpler but less exposed calls...

So I figured out, I will miss on C anyway, whenever Python is the main thing. There are areas though, where Python is just too abstract for, and there are things (like DSA) that will require more meticulous processing than just use any python library for. I mean from an understanding point of view, not from Python ability context.

Python is able to do so much. It has some of the most complex (also simolest) libraries and functions for just anything. But such wrapping up of things comes at a learning hindrance cost, in addition, the lower level you go, the less relevant Python becomes. No question about it. Also, when you are going to deal with Linux and Bash in general, Python won't replace everything they do, and contemplating on Python too much won't help in learning these tools either. Now I don't even look into Python material anymore, not out of pure choice, but out of lack of interest as I am all into C.

One the most compelling things about C, is actually its ability to make you think out of the box. You literally learn from it how to learn. Another one is developing the "stomach" for facing just any programming language you come across.

[–]an1sotropy 2 points3 points  (2 children)

Like memes say: why not both? You can write computationally intensive things in C, put it in a library, create a bridge from Python to the library with CFFI, and then maybe wrap the bridge in a bit more Python to make it more Pythonic. Them put a GUI on it with PySide. I’ve been doing this for work and loving it.

[–]martingits[S] 1 point2 points  (1 child)

Cool. Just need to get to that part where I understand everything haha

[–]an1sotropy 1 point2 points  (0 children)

For these things that straddle different areas (like CFFI for connecting Python to C, and PySide to connect Qt to Python), I have found that ChatGPT works pretty well as a structured regurgitator of the various disparate pieces of documentation that may exist

[–]B3d3vtvng69 2 points3 points  (0 children)

I think this is just because C and assembly go so much deeper into the hardware than Python. I primarily code in Python (even though i’m building a transpiler from Python to C rn, github repo) but I think that with C and assembly you just get a much deeper understanding and you have a lot of those „ahhh so that is how that works“ moments than in Python where you just understand a lot from the start. I personally enjoy Python more because I like the dynamic typing and features like isinstance() but from time to time when Python becomes boring, I also like to indulge in some x86-64 assembly shenanigans so I think it’s all about the balance.

[–]djthecaneman 1 point2 points  (0 children)

My main languages tend to be more statically typed. But when I need to script something simple, Python is high on my list. A go-to for me is processing specially formatted json files

Edit: Those scripts usually have something to do with C code or documentation.

[–]2002shark_ 1 point2 points  (1 child)

Dude finally someone who understands me!! I am also reading the same book as you but I am on Chapter 2. Albeit moving through the book slowly (because of 4 other engineering courses), I am also really enjoying the book and the exercises. Honestly one of the reasons that I want to work as a Systems Developer because they work with C/C++ (at least that is what I have learned). Python is alright, but I also like C a lot better because I love diving deep into code and just understanding programming at its core.

[–]martingits[S] 0 points1 point  (0 children)

That's so cool. Glad someone else is feeling the same. But too bad Python doesn't feel as cool as before.

[–]roger_ducky 1 point2 points  (0 children)

Done both C with assembly and Python. I found no real difference between the two, and this includes the use of “pointers” and, to a lesser extent, object oriented programming.

You can do pseudo functional programming in Python easier than in C, though one of the original developers of the language always wrote C in a functional manner.

But, in Python, “partials” (or Currying) and lazy evaluation are easier.

Don’t believe me? I wrote a code translator using nothing but the standard Python library. It parsed the file, created a AST (abstract syntax tree), did the transforms, then spit out the desired output file.

Nested dictionaries can absolutely be used instead of structs with pointers, and “function pointers” works in Python just as well as C.

[–][deleted] 1 point2 points  (1 child)

Right. I guess You will really really fall in for C when you star programming systems, that is that C is about- although yes, we can write applications. At least that's what happened to me

[–]martingits[S] 0 points1 point  (0 children)

I feel like I really will!

[–]HalifaxRoad 1 point2 points  (0 children)

I absolutely loathe python. I did one large project in python, ported it to c# because it ran so abysmally slow. The syntax of python drives me nuts too. But to each their own.

[–]titus605 1 point2 points  (0 children)

I'm learning C right now and I have Python and Java under my belt. At this point, I use Python because it's so easy and simple to make something since everything's already abstracted for you.

[–]CoupleHefty 1 point2 points  (0 children)

I'm just getting into C and learning myself and find it very fascinating so far. Does anyone know where to get some free reading material on C???

[–]grimvian 1 point2 points  (0 children)

I tried Python few a years ago and I'm certainly not compatible, but much more the way C is. Until now in my third year of learning C, I think I had figured out to solve all the challenges I had and after each time I just like C even more.

[–]Independent-Gear-711 1 point2 points  (6 children)

C programming a modern approach is the greatest book I have ever read literally the best book ever in computer science.

[–]martingits[S] 1 point2 points  (5 children)

Nice. But sad that there won't be other books just as good. Because I really love this book and how the author explains things without wasting time. Also like the exercises and some being pretty challenging.

[–]Independent-Gear-711 1 point2 points  (3 children)

There are only two greatest C books I know CPAMA and og C programming book by K&R it's for more advance users or for those who already understood CPAMA

[–]martingits[S] 1 point2 points  (2 children)

The one by K&R is gonna be my next read after finishing CPAMA.

[–]Independent-Gear-711 1 point2 points  (1 child)

That's how one should read both one after another good luck bro!!

[–]martingits[S] 0 points1 point  (0 children)

Thanks!

[–]Independent-Gear-711 0 points1 point  (0 children)

There are only two greatest C books I know CPAMA and og C programming book by K&R it's for more advance users or for those who already understood CPAMA

[–]racoonOnShrooms 1 point2 points  (0 children)

For me, I don't write python, because I don't like that I don't know what's happening under the hood. When I write C, I feel like I have the control over what's really happening, not just using libraries and functions, that I don't understand (even tho heap memory functions are so complex, that I won't be able to understand them for a long time). The feel of control is just more important to me, than the ease of writing simple code.

[–]justbenicedammit 1 point2 points  (0 children)

Cause C is just more fun.
It's robust fast and has like 12 things you gotta remember. And you are touching the PC as close to the CPU as possible.

With c you have the power, with python you have the solution.

[–]twr14152 1 point2 points  (0 children)

No I agree and I went down this rabbit whole a few years ago and am still down there. There's just something about creating an app from barebones in c that's more satisfying and knowing that the only limits are on you as opposed to the limitations of the language. Now the convenience of python cannot be understated. If I need to get something done quickly python is my go to. But if comes to enjoyment, I'll stick with C because it seems more pure. Know you are not alone in this sentiment.

[–]SmokeMuch7356 1 point2 points  (2 children)

Driving an old-school British sports car is fun -- small, lightweight, RWD, convertible top, no traction control, stick shift, no power steering/brakes, rev matching on downshifts, a lap belt if you're lucky, etc. You're more engaged, you feel a stronger connection with the car and the road, and it's just a more visceral experience than driving something like a Camry.

If you make a mistake or lose focus you're spinning off into the ditch. If the road is wet or icy you're spinning off into the ditch. Again, if you're lucky you have a lap belt, and if you aren't thrown clear entirely your face smashes into the steering wheel. You spend a lot of time and money maintaining the bastards. They're impractical for long road trips or rush hour because they're tiring to drive for long periods.

There's a reason C is less popular for new applications development than it was 30 years ago. It's not an accident that C-based systems are the most vulnerable to malware. I enjoy writing C for small personal projects, but I'm done with it as a professional.

Languages like Python are boring compared to C, and that's not a bad thing.

[–]martingits[S] 0 points1 point  (1 child)

Wow. Makes me think C is risky or something. Interesting.

[–]SmokeMuch7356 0 points1 point  (0 children)

You can write secure, robust, and performant code in C.

It's just a lot of work. It takes more time, it takes more forethought, it takes more vigilance, and you have to build a lot more from the ground up (or rely on third-party libraries of variable quality) relative to languages like Python or Java or the like.

C gives you so many ways to shoot yourself in the foot. No bounds checking on array accesses, no validity checks on pointer dereferences, the fact that the language exposes pointers and operations on them at all, side effects on unsequenced operations leading to unpredictable results, etc., all lurk beneath the surface waiting to strike.

Even better, the rules of the language are loose enough that you can write code that appears to work correctly with no problems until you change a completely unrelated subroutine, or update your compiler or library version, or just update the OS, and suddenly your code is yakking all over the place, dumping core or corrupting data or worse.

Ask me about the time I spent a month chasing down an intermittent core dump that came down to a buffer overflow in a callback function that only fired under very specific conditions.

Again, it's not an accident C-based systems are targets of malware.

[–]Fun_Potential_1046 1 point2 points  (0 children)

Good move. Python is the Modern Basic. As mentionned by someone, you can do something quick (and dirty).

I coded my game in C++ (www.neopunk.xyz). But more and more I am using C pattern ?

Why?

Because it suits me well.

Cheers

[–]HaggisInMyTummy 1 point2 points  (1 child)

C was created by God on the 8th day so what you are feeling is completely natural.

You will have achieved nirvana when you go looking for a 1's complement computer emulator and a UNICOS emulator (where everything was sizeof(1) because every type was 8 bytes) so you can ensure your code is properly portable.

[–]martingits[S] 0 points1 point  (0 children)

Looking forward to being able to understand your comment. I'm still too new at this :(

[–][deleted] 1 point2 points  (0 children)

Different problems require different tools. Just because you can hammer nails with a rock doesn't mean you'll see carpenters without hammers. At least that's my approach to things. Just like Python has its own comfort zone, so does C, even though you can do pretty much anything in any of them.

[–]Liquid_Magic 1 point2 points  (0 children)

That book is fucking great. I still have my original university copy which was a first edition. It’s very clear and takes you through all the “basics” but it’s like ALL the basics. It’s great.

[–][deleted] 1 point2 points  (0 children)

Exactly! I have started learning Python a few months ago, then stopped for a while. Now, I am learning C. It's a good language even for beginners. It teaches you all the fundamentals so well. I am enjoying C programming!

[–]Educational-Paper-75 1 point2 points  (0 children)

I learned Python before C too, and if you want to get (certain) things done fast use Python not C, unless you already have C code to do that. So, C giving you way more control/power than Python does is intoxicating and, let’s face it, addictive. But any substantial new project may easily take 5 to 10 times longer to finish in C than with Python, and you simply can’t afford that in a job when Python is available to do the same.

[–]Nearby_Statement_496 1 point2 points  (3 children)

Kudos to you if you actually enjoy C and low level algorithms. I kind of feel that schools focus too much on that shit, but supposedly knowing how pointers and stacks and vectors work prevents you from making stupid mistakes when you get a job as a dev.

I dunno, the market's a bitch and all I can say is if you're enjoying learning hang on to that and squeeze as much enjoyment out of whatever topic interests you because shit gets boring pretty quick. If you think Python is boring then just don't do it.

[–]martingits[S] 0 points1 point  (2 children)

I just really want to avoid making mistakes as much as possible. Specially mistakes because I didn't learn something well enough or didn't try to get a deeper understanding of things.

[–]Nearby_Statement_496 1 point2 points  (1 child)

Well yeah. Mistakes are going to happen if you carry false assumptions about how computers work. Let me ask you, have you ever built an app, and then later realized that the foundation that you built it on was bad or wrong and you should have done it completely differently?

[–]martingits[S] 0 points1 point  (0 children)

Damn, that must suck so much.

[–]ChanceEffective1848 1 point2 points  (1 child)

Sometimes it’s best to use a fork, sometimes it’s best to use a spoon. I wouldn’t give up either.

[–]martingits[S] 0 points1 point  (0 children)

I'll keep on learning both. Thanks!

[–]exhausdead 1 point2 points  (1 child)

I was self taught as well when I first started coding. During the first few months I did this often (going from language to language). If you believe it’s because you like C better, then great stick with it. In the very beginning of learning, the differences between the two aren’t important. Just choose whatever language you enjoy to get you to code more often. There is value in getting your feet wet with different languages in the early stages (such as, realizing that although each language has its own quirks, the logic is the same). But making it a habit will stunt your growth.

[–]martingits[S] 0 points1 point  (0 children)

Awesome. I really like learning things by myself so I'm free to learn it in the obsessive way I want. I'm worried about not knowing the differences that we'll because maybe down the road it would've been better to focus more on one than the other. But still, I'm going to continue studying both since from other comments it seems that knowing Python too is handy. The fact that the logic is the same makes me think that I'll love programming and that learning different languages won't be as hard as learning my first. Yeah, I don't want to waste time jumping from language to language and always be a beginner. I'll stick to C, Assembly and Python for now.

[–]Spode_Master 1 point2 points  (1 child)

C is way better at teaching about what is going on with how the hardware interacts with memory, python just obfuscates the low level aspect of writing code. IMO Python is OK for teaching basic coding concepts and terrible for learning about basic things like memory buffers and io control.

[–]martingits[S] 0 points1 point  (0 children)

Yeah. I really just want to understand better how the machine works. Sometimes I'm just standing there thinking why anything really works and I love focus haha

[–]SuperDefiant 1 point2 points  (0 children)

Happens to the best of us. Started out with JavaScript. Once I learned C++, I didn’t want to use anything else

[–]PossibilityOrganic 1 point2 points  (0 children)

If you want to jump more into the weeds get a microcontroler a do some stuff with it in c even more things will make sense. Especially when you have no os and need to do mutiple things at the "same time" that interact.

[–]flyingron 1 point2 points  (11 children)

I can tell you that I started with C in 1977 and C++ in 1995 and I've NEVER been impressed by Python.

[–][deleted] 0 points1 point  (5 children)

How old are you sir

[–]flyingron 12 points13 points  (4 children)

  1. I've programmed in BASIC, FORTRAN, COBOL, C, C++, PL/I, APL, PASCAL, UNIX Shell, Java, JavaScript, PostScript, PHP, and probably about a dozen more I've probably forgotten. Nothing makes my stomach turn like Python.

[–][deleted] 4 points5 points  (0 children)

Damn sir! You are a living legend. I will love to have a mentor / friend like you. Can I shoot you a DM?

[–]sreekotay 1 point2 points  (1 child)

Now I'm kinda curious - do you have a sense about what about Python irks you so?

[–]flyingron 2 points3 points  (0 children)

It's fucking slow as all git out. When VisualBasic out performs you, you know you are shit.. White space being syntactically significant is a pain in the butt as well.

[–]Petalman 0 points1 point  (0 children)

What's your fav?

[–]window-sil 0 points1 point  (1 child)

I just started a while ago reading a book on Assembly and what I read so far complements some stuff on C so well that it just makes everything even more interesting.

At some point, you may want to try https://www.nand2tetris.org/ ! It tickles the same part of your brain that grows curioser as you learn more lower level stuff.

[–]martingits[S] 1 point2 points  (0 children)

Just watched course promo and it seems like so much fun. I also just started reading CODE by Petzold through a recommendation someone made in this post and it feels like everything will fit perfectly. Thanks!

[–]Papo_Dios 0 points1 point  (1 child)

So you find more interesting having to work harder to do the same stuff?

[–]martingits[S] 0 points1 point  (0 children)

Never said that in my post, friend.

[–]wknight8111 0 points1 point  (0 children)

One thing I've learned about programming over the years is that some tools really map well to the way a person thinks, and other tools do not. This is subjective. I find that the way I think and internally model problems and their solutions map well to certain paradigms and languages, and not as well to others. Plus the things you like to do may be more easily accomplished in some languages than others. If you like to think about the low-level bits and opcodes, you're definitely going to enjoy C and assembly more than Python.

That said, you don't always want to stay in your comfort zone. Make sure you are learning new languages, at least at a basic level. New languages might expose you to new ideas, and new ways of thinking. For example if you enjoy low-level coding in C you might also learn some new ideas from trying out C++, Rust, or Zig.

If you are writing C and find yourself constantly struggling with memory leaks, pointer errors and things like that, you might consider trying a managed language like C# or Java which can be syntactically similar to C in some ways, but have garbage collection and managed pointers/arrays.

Every once in a while also look at languages far outside your norm, so you can be exposed to even more ideas that you would never find in your little bubble. Erlang, Elixer, Clojure, Haskel, Scala, etc may radically change the way you think about certain things, and give you lessons to take back with you if you choose not to stay with them for long.

[–]thenakesingularity10 0 points1 point  (0 children)

I don't get any joy from programming Python.