Spot the bug quiz.

Started by
37 comments, last by Stefan Fischlschweiger 8 years, 11 months ago

But presumably if they're at the point that they want to do it professionally then they're already invested and motivated to learn.

You are making the unwarranted assumption that he has the necessary tools to learn at that point. He has no reason to go learn how caches and pointers work, because they aren't relevant to his experience.

And that's kind of my point. 5 years down the line he's going to end up at a shop that works in both Python and C++, management will have him start pitching in to write low-level code, and then he and his uneducated hacking become my problem...


If management is stupid enough to put a high-level coder into a low-level job without letting them train and without allocating time for a senior developer to shepherd them, then there isn't much you can do anyway besides try to correct issues as they come up and make them aware of issues.

And cache is a horrible example. No language I know of ever exposes it or brings it up. Not even assembly. It's a thing the CPU does that you have zero control over and can only arrange your data in a way that you hope works better and won't completely break when the next CPU revision comes out.

It's just a thing you have to learn as you profile your code, and while C++ gives you more control over it then, say, Python, they aren't going to learn it just by switching languages.

A better example would be memory management which a lot of higher level languages handle for you - but even then, most high level languages do NOT manage other resources like files, handles, network connections, or a myriad of other things which the programmer has to manually manage anyway. So if they already know how to properly handle non-memory resources, it's not going to be too hard to teach them to do memory too.

But I feel we're getting off topic - apologies for the derail.
Advertisement


Writing code in C++ does not automatically mean the coder is even aware of what cache coherency is.

That isn't my point. You are correct that learning C or C++ does not magically make you aware of how to optimise cache usage.

But the sad truth is that learning Java pretty much guarantees that you will not be aware, as the language doesn't have the necessary mechanisms to do anything about it.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


Writing code in C++ does not automatically mean the coder is even aware of what cache coherency is.

That isn't my point. You are correct that learning C or C++ does not magically make you aware of how to optimise cache usage.

But the sad truth is that learning Java pretty much guarantees that you will not be aware, as the language doesn't have the necessary mechanisms to do anything about it.

Oh yeah, I'm aware, that's why I removed the quote as it wasn't really on-point.

Yo dawg, don't even trip.

Like giving someone Legos to build with. [...] Is their lack of understanding how injection molding works really causing you problems?

That's a false analogy. The difference is that you don't do injection molding by playing with legos. In programming you are doing the low level stuff even if you're oblivious to it. Your example is not comparable.

For that matter, would someone claiming they know everything about injection molding by just playing with legos bother you?

--- SmkViper said but damn quote block wont work because fuck this editor ---

Is a hobbyist programmer content with working in Python going to really bother you so much?

--- end of quote ---

Since when we're talking exclusively about hobbyists? And why you're restricting the argument to the only corner it might make sense immediatly? Yeah if someone codes with Python, shares his code with nobody and if I never have to know anything about him, yeah it doesn't bothers me at all. I'll give you that much.

For that matter, doesn't a professional programmer not understanding why their array of mutable MyFloat object is slow as fuck and big as fuck bothers you at all?

This isn't about knowing how the 10 million lines of code you're building on top of works, which is what your example was aiming at. I don't know a shit about kernels, I couldn't possibly demand of someone else to know about them. This is just about knowing what all that syntax sugar boils down to, which aren't really complex subjects to be fair and can be summed up in a couple of concrete things (which I already mentioned) that you should know you're giving up when using, say Java vs C.

Because that's part of choosing the right tool for the job. You should understand not only how easy is to say, use a dictionary in Python compared to C, but also what you're giving up by using Python instead of C. That's why languages like C# are popular, they allow you to write a method in a completely managed environment and then just slap 'unsafe' in another and go (reasonably) crazy with pointers.

That's where things like D or Rust come from, they allow you not to give up anything, they allow you to take an informed decision.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Since when we're talking exclusively about hobbyists?


Apparently I misunderstood what "teaching" means. If you're teaching someone how to do something, chances are they aren't a professional at it... because they don't know how to do it yet.

I'm not disagreeing with you that a professional should know how their tools work. Even if you don't know how to write a kernel, you probably know how the OS thread scheduler, disk cache, and other subsystems can affect your code.

And if the person learning asks about how or why things work, or why his little Mario clone is slow, then yeah, that's when you should start talking about lower-level things that can help.

All I'm trying to say is if you're teaching someone how to program - get them interested first. They aren't professional yet, they may not ever be professional at it, and that's ok. But if they aren't interested, they will be much harder to teach.

But once they do want to do it for a living, then sure, they're going to need to understand more of what's going on under the hood, if for no other reason then they are not going to be able to produce a competing product with those that do.


All I'm trying to say is if you're teaching someone how to program - get them interested first. They aren't professional yet, they may not ever be professional at it, and that's ok. But if they aren't interested, they will be much harder to teach.

If your aim is to engage a bunch of people who aren't interested in programming to start with, then I guess that's a reasonable approach.

But if your students are already interested, then mucking around with pointers isn't going to phase them one little bit.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

16/15

got a bonus point for spotting an Easter Egg :)

9/15

I'm not a good enough C+ monkey * goes back to typing Java *

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

A lot of people naively think that absorbing the contents of a CS degree makes them a decent programmer. As far as I'm concerned, coming out of school with that mindset the student does a great disservice to himself. At my university, the CS students start with Intro to C and move on to Comp Sci which is taught in C++. None of those classes ever mentioned cache, or the inner workings of virtual functions.

Where I went to university, those things DID come up... but not until 3rd and 4th year, and there was almost no exploration of how utilizing the cache well affects software design. I wish I'd had a course in something like data-oriented design available when I was in school.

In my university we started with Prolog in the first semester (*puke*), which quickly reduced our numbers, before moving to C# from there on.

This topic is closed to new replies.

Advertisement