5 ms·
> No, no really you don't. Perhaps to be some sort of archetypal "Real Programmer", So, are you saying that if you asked a candidate during a job interview wha
by 10098 14y ago
> No, no really you don't. Perhaps to be some sort of archetypal "Real Programmer",
So, are you saying that if you asked a candidate during a job interview what malloc is or why inserting things in a linked list is faster that inserting things into an array, and he gave you a blank stare, you'd still hire him?
- smallblacksun 14y ago>what malloc is There is no reason someone who never programmed C would (or should) know what function is used to allocate memory in C.
- 10098 14y agoFair enough, but don't you think they should at least know that memory is a resource that needs to be allocated and deallocated and how come that they never have to deallocate memory themselves when writing in python?
- Danieru 14y agoThat is not the same thing as asking about malloc.
- grey-area 14y agoNot all languages are (or should be) like C, and not all languages require manual memory management. If they are going to be programming in Python, there's probably no need for them to be familiar with memory management, or the underlying details of the language implementation - the language is there to insulate you (to a greater or lesser extent) from the machine. Later if it becomes useful to learn about memory management in other languages, they could do so if they are moderately intelligent, it's not rocket science or something that you must learn first or not at all.
- ssmoot 14y agoI don't think understanding memory mapping has anything to do with data structures. I have no solid understanding of malloc or how it might be implemented, but RedBlackTrees, TernarySearchTress, LinkedLists, Hashtables, etc are all pretty easy to grasp. Even the nature of a Struct, and how it might be more efficient than an Object, and the difference between a Stack and a Heap... All that's pretty accessible without sitting through a course on the finer workings of malloc. The memory is there. It provides my byte buckets. I don't need to care much beyond that to be a good web-developer. Asking most developers about malloc is probably about as relevant as asking about video frame-buffers. For some spaces it's make or break, but for most it's just useless trivia.
- jiggy2011 14y agoI think understanding roughly how Malloc works can be very helpful in pretty much any area where performance becomes important. Without knowing a bit about Malloc it's hard to understand the benefits of SLAB allocators and similar (which are used everywhere from game engines to OS kernels to DBMS etc). In it's most basic form Malloc basically is a linked list.
- anthonyb 14y agoThose questions would be stupid to ask for a Python position, unless there was some need for working with C APIs. Why waste your time and the developer's time? Much better to asking about relevant things; some common Python library, or why they'd use lists vs. dictionaries vs. sets, or what a generator expression is.
- 10098 14y agoAllow me do disagree. Tomorrow you're going to have a project that uses a different technology, what are you going to do then? Fire everyone and start hiring again? Of course you need at least a few people on your team who know your current technology in depth, but you probably want to make sure they're they understand the basics. And please note that those questions are not some intricate C specific questions. Memory management is a basic thing (I'm not talking about actual memory allocation algorithms, just things like how to make sure your program doesn't leak). Linked lists are also basic data structures. It's not asking what "volatile" keyword means and when to use it.
- anthonyb 14y agoSo tomorrow we're all going to go back and start programming our web apps in C? Give me a break. Ask the right questions for the position. Python also does not have memory management or allocation, linked lists or "volatile". Memory management is basic for C and C++, but that's about it.
- DeepDuh 14y agoHow about you need your people to make an iOS 4.x compatible app. Oops, suddenly they need Objective C including all its memory management nasties. This is going to be so much harder if you have never seen pure C.
- anthonyb 14y agoWell then obviously you'd want someone who can deal with C. "DeepDuh" indeed. But you're talking hypotheticals - I can do that too: if you suddenly need big data then "Oops", you're going to want someone who knows Hadoop or Erlang. If you need to launch a rocket then "Oops" you're going to want an aerospace engineer. But if you're looking for a web dev, then C/Hadoop/Erlang/Aerospace questions are largely a waste of time, and might disqualify candidates who are otherwise fine or who could figure out C given a couple of days. Bear in mind that the original topic is talking about languages for learning how to program, not languages for iOS development. If iOS apps float the beginner's boat then by all means learn Objective C; their enthusiasm for the field will probably overcome their frustration with C. But I suspect they'd be better off learning Python or similar first, then starting on C. Hence my original response: it depends. Python is a pretty good choice because it can do well in lots of different fields and is easy to pick up.
- easp 14y agoThere are legitimate reasons for people to learn to program that don't involve being interviewed by you for a job, just as there are legitimate reasons for learning to write that don't involve writing sonnets. Similarly, there are different ways to come to the knowledge of what malloc is, or why inserting things into a linked list is faster than inserting things into an array.
- 10098 14y ago> Similarly, there are different ways to come to the knowledge of what malloc is, or why inserting things into a linked list is faster than inserting things into an array. I completely agree with that. It doesn't matter, as long as the knowledge is acquired somehow. I was just pointing out one of such ways.
- TimGebhardt 14y agoWho says inserting into a linked list is faster than inserting things into an array? If the array is pre-allocated, or even crazier a c++ vector or c# list<> with an amortizing growth function that only needs to be invoked once or twice, it'll be much faster than inserting a new node in a linked list. The array/list can be pre-allocated to the size you need and have good cache locality and minimal container overhead -- the linked list will have the overhead of the pointer to the next node (2x for a doubly-linked list) + the type descriptor (if you're using a language like c#, java, python, etc.) per node and data located all over the heap with cache misses everywhere. <sameCondescendingToneAsParent> If I was asked during an interview why inserting things in a linked list is faster that [sic] inserting things into an array, and I provided an answer that made him blankly stare back at me, would I want to take the job? </sameCondescendingToneAsParent> Perhaps you're getting a guy switching careers or fields of expertise (web -> system or accounting -> embedded), or someone that just has that gap in their knowledge, or someone that's just having a plain ol' brainfart at that point in time. No need to be as rude as I responded in my third paragraph.
- 10098 14y ago> Who says inserting into a linked list is faster than inserting things into an array? If the array is pre-allocated, or even crazier a c++ vector or c# list<> with an amortizing growth function that only needs to be invoked once or twice, it'll be much faster than inserting a new node in a linked list. I said insert, not append. What made you assume the question was about inserting at the end? Even if you have a big pre-allocated array, inserting an element somewhere in the middle will still cost you the price of shifting the "tail" of the array to make space for the new element, while the list will not have that cost.
- anthonyb 14y agoNow you're just being an ass. What makes you think insert is important anyway? The typical use cases for an array/list are pop, append and indexing. Python's list implementation uses arrays, not linked lists, internally for exactly this reason: indexing being O[1] is more important for most purposes than fast inserts. (http://docs.python.org/faq/design.html#how-are-lists-implemented http://docs.python.org/faq/design.html#how-are-lists-impleme...)
- antidoh 14y agoNot because he couldn't answer these things, but because he'd only done the one intro Python course. Or the one intro C course, for that matter. Jobs where those things matter depend on much more than having got your feet wet with C and malloc learned in one intro course. You probably wouldn't have this guy to the phone screen in the first place. Right?
- dagw 14y agoDepends entirely on what the job was. If I'm hiring a programmer who is expected to write C for an embedded platform, then I probably wouldn't hire them. If I'm hiring a 3D artist whom is expected to write mel scripts, then I wouldn't care about those things and wouldn't even be asking those questions.