180 points · by fogus · 16y ago · 200 comments
I don't have a clue how pointer arithmetic works. I'm vaguely aware of it, but it just never comes up in my professional life. I'm absolutely fine with that, just as I'm fine with the idea that a cardiac surgeon may be vaguely aware of how to perform a kidney transplant but doesn't know the details.
Let's be realistic. The days of wizard programmers single-handedly designing an operating system are gone. We're all specialists now. An embedded systems programmer has absolutely no need to understand the intricacies of XML schema or the finer points of CSS parser bugs. Beyond a broad sketch, I have no real need to know the fine details of memory management.
I'm happy to call myself an ECMAScript programmer because that's what I do, that's what I have done for some time and that is what I expect to do in the future. I know other languages, though none well enough to produce work I would be happy to put my name to (apart from Scheme, but who's going to hire me to do that?). Like it or not, I'm not a computer scientist. I'm a working programmer and my view of the world is inevitably coloured by the raw material I work with every day. The way I think about code, the way I design problems is an imprint of the capabilities and limitations of my usual languages. I imagine a sufficiently literate computer scientist could smell it on my breath, or at least infer it from the way I might sketch out a diagram or pseudocode solution.
It's not rocket science, really, it has more to do with the "I don't know what it is and I'm absolutely fine with that" kind of attitude.
As an electronic-engineer-turned-embedded-C-programmer I never had anything to do (and likely will in the immediate future) with things like closures, prototypal inheritance or web frameworks, but at least I should be able to know what they are and the concepts they are based upon.
By willingly limit your toolbox to one tool you limit your possibilities and usefulness. Maybe you'll come up with a problem that an other tool solves better than the one you are used to, and you'll never know.
Correct me if I am wrong, but any one of these "toolbox"es will take enormous effort to master fully. Some person may really want to do web development for his/her whole life, nothing wrong with that. But to do that they will have to master many many skills to even say "I know everything about web development".
A stupid parking attendant might count cars by asking: "what car is in space 4?" "An RV." "What is in space 5?" "The same RV."
But a smart parking attendant would obviously just ask "what care is in space 4?" "An RV." "Ok, so what car is in space 6?"
There, now you don't have a toolbox but at least it's a squeaky toy hammer.
Kurtz isn't talking about those. He's talking about basic knowledge about programming. Even if he only does C, he at least has an escape hatch when he needs more powerful thoughts than what C alone can give him.
But by being afraid of dabbling outside your comfort zone (because mastering things fully is "hard"), you inherently restrict the solutions you can possibly even conceive of to an incredibly limited set.
It's a sort-of Dunning-Kruger: You don't even have the basic knowledge to evaluate how often a better solution than "throw more javascript at it" was available to you and you didn't know it.
Programming languages are tools, in the sense that they are mostly means to ends. But they are not ordinary tools, because they have a tremendous influence over the way you think. I reckon The sentence "PLs are tools" is improperly used most of the time, but not here.
As a side note, if you actually don't have a clue how pointer arithmetic works, check if you really understand plain ordinary variables. Pointers are just a second level of indirection away.
And there will always be a market for helicopter pilots.
Plus, I bet I bet many pilots would get a kick out of learning a new aircraft, but can't afford it.
I know so many people who've just done basic CRUD business programming. Smart people, really smart people, but they limit themselves; don't try to do anything deep and interesting, and it's sad.
I don't know much about CRUD business programming, but I do know in every field there are many levels of difficulties. Maybe these smart people are trying to solve those problems? If a system has simple atomic parts, it does not mean that every problem will be easy.
Edit: "Specialization is for Insects.", wow if you believe that, why do you live in an society. If you know every general thing, then you must be able to make your meal right? It will include farming, harvesting, cleaning of wheat, making your own bread (with equipments that you make on your own) and then slicing it and serving it. And that is just bread ;)
The other day, for example, I patched a hole in my own tire, rather than taking it to a shop. What if (a hypothetical) I, a self-proclaimed C programmer, needed a bugfix in a tool written in python? I can get my job done much quicker if I make a quick patch on my own, rather than wait for someone else to fix it for me.
Specialization is great; it is nice to have experts. Knowing many things is great; it is nice to have people who can do more than one thing effectively.
Just as a basic life survival thing, btw, you probably want to learn the basics of hunting, gathering, and farming. Some things are more important to know than others. :) Insects survive well as a species and much less well as individuals.
They may not have a need, but they should be able to dig through all that because it's all just functions + data + dealing with some other idiot's code.
Take the following code for example:
/** BEGIN **/
var f = new Array(3000000);
console.time(1);
for (var i = 0; i < f.length; i++) {
if (f[i] === 'foobar' ||
f[i] === 'foobaz' ||
f[i] === 'baz' ||
f[i] === 'barfoo') {
// Do something
}
}
console.timeEnd(1);
/** END **/
On my comp, in Firefox, this executes in 7478 ms.Now, if there is one thing that pointer arithmetic has taught me to be especially aware of is that array index lookups are expensive, usually regardless of the language. With this knowledge, I am empowered to refactor my code to look like this:
/** BEGIN **/
var f = new Array(3000000);
console.time(1);
for (var i = 0, _i = f.length; i < _i; i++) {
x = f[i];
if (x === 'foobar' ||
x === 'foobaz' ||
x === 'baz' ||
x === 'barfoo') {
// Do something
}
}
console.timeEnd(1);
/** END **/
On my comp, in Firefox, this runs in 6235 ms. Now, I have achieved almost a 20% performance increase due to my expanded world view.This is a very simple example, but the list goes on. One certainly should not limit themself to one language.
More ideomatic JavaScript would look like this:
Array.prototype.foreach = function (f) {
for (var i = 0, _i = this.length; i < _i; i++) f(this[i])
}
/** BEGIN **/
var f = new Array(3000000);
console.time(1);
f.foreach( function (el) {
if (el === 'foobar' ||
el === 'foobaz' ||
el === 'baz' ||
el === 'barfoo') // Do something
})
console.timeEnd(1);
/** END **/A basic message of CS is that most general-purpose programming languages are to a large extent isomorphic in their expressive power, and that many computing problems can be solved efficiently in the mathematical language of sets, matrices, or abstract nodes sending each other abstract messages. The translation to a real language is then the easier step (though it still can be time-consuming and error-prone, for sure).
If only we all worked this way - there would be fewer language wars, and less terrible code resulting from "thinking in the language" rather than "thinking about the problem".
People build all kinds of complete things with just "C" -- where by this term, I mean the compiler, standard library, build and debug system (make/gdb, say).
There are few things of interest you can build with just a hammer. The evidence for this is that no craftsman builds with just a hammer.
The better analogy to the concept of "C" above is "wood shop" (as opposed to, say, "metal shop", "polymer shop", "electronics shop"). You still get the point, which is that everything out of the wood shop to some degree "looks the same" but it's not so clearly leading the reader to the hoped-for conclusion ("the statement is stupid").
It's impossible to evaluate the utility and applicability of knowledge you don't have.
You always have the option of dropping down into straight HTML. This is one of the things I love about Rails. Also, he forgot all the other things these frameworks handle, which constitute 95% of what they do.
Yes, there are people out there who couldn't write straight HTML if they had to, and have never heard of an inner join. We call them bad programmers. Guess what: they're everywhere.
EDIT: Obviously this only applies to people who work in web development, or other domains where SQL and HTML are important parts of their domain. If you do low level systems development, write device drivers, do kernel development, etc, you're not a bad programmer cause you don't know HTML.
Outputting something that looks like HTML enough to please a browser is easy. Outputting correct HTML that isn't a CERT entry waiting to happen is actually very hard.
Though this still boils down to an argument that you ought to know what you're doing at the base level of what's going on, when I see people just slamming out HTML in string concatenations and variable insertions I generally consider that evidence that they only think they know what's going on, not that they actually do. If you aren't using some sort of safe+sane HTML generation wrapper you're suicidally betting on having superhuman levels of discipline if you expect to not write security holes.
Interesting.
The obvious domain generalization is a much harder (but hardly impossible) statement to argue:
Yes, there are people out there who couldn't <use basic building block of their field> if they had to, and have never heard of <some atomic concept they implicitly use every day>. We call them bad programmers. Guess what: they're everywhere.
So the question becomes "if you only know how to function within some high level of abstraction are you effective at what you do?" I'd suggest that this holds pretty well if the level of abstraction you're using is too leaky. I don't have the slightest idea how to time an HD seek operation, but I can write to a file with a great deal of robustness. I think the op has a point though that if you operate mostly with RoR you might be ignorant to a non-trivial amount of detail which will relegate your work to being lower quality.
My personal belief is that "web frameworks" aren't a sufficiently compartmentalized level of abstraction. RoR holds the opposite philosophy (evidenced by marketing and the opaqueness of Active Record, for instance) which causes a great deal of impedance when you have to dive into lower level concepts which were supposed to have vanished via RoR. So I agree with the op in that if you can only create things using RoR abstractions, you'll probably be in trouble before too long.
But they've never written a web page, never bothered to look behind web pages, and don't know the syntax. I'm sure they'd be great if they chose to learn the syntax, grammar and elements, but they've no need.
They certainly know about mathematical logic, and almost certainly know the concept of an inner-join, but they've never dealt with relational databases, and certainly not SQL.
I'm pretty sure you can't be a good web developer without being about to write at least a little straight HTML, and without knowing the differences in use and performance of the different types of join, but even then I'm not convinced.
Just speaking from my experience. It seems to me that sweeping generalisations such as "Can't write HTML => bad programmer" says more about the speaker than the subject.
Hmm. I write safety-critical software for embedded processes and distributed systems. Perhaps I should be concerned at your judgement.
I think you're letting your experience of development cloud your view over what software development involves.
Go ahead, judge my work.
There is a very strong difference in signal from someone telling me "I am an expert C programmer" compared to "I am an expert PHP programmer."
Leaving out the name of the programming language all together removes salient content without adding anything else of value. If I want to make your of your programming skills, I'll still need to ask "Okay, what languages?"
So, saying that "Calling oneself a C Programmer is like saying you're a Hammer Carpenter" is like saying when there is a choice between tool sets, the choice doesn't matter.
Saying you're a C programmer is more like saying you're a carpenter specialising in furniture, as opposed to say a carpenter that specialises in houses.
Sounds like one of those "round manhole" interview questions.
As far as frameworks go: I use frameworks because I don't want to re-write the same shit over and over again. Yes, I can write an <a> tag, and I can do complex JOINs. Now I use Haml and ActiveRecord so I don't have to spend time hand-crafting every SQL statement I need.
I've never understood the whole "frameworks bad" ideology. Just because some folks don't learn anything outside of their framework doesn't mean all frameworks are bad. (See: US Supreme Court, Baby v. Bathwater)
Programming languages are like hammers in that they often end up in metaphors.
Hammers are like C in that they are bad metaphors for women.
Programming languages are not tools, they're MEDIA. They're a notation for thought, so they are the material you work, not the tool you use. Therefore, if you must compare programming to carpentry:
Calling yourself a C Programmer is like calling yourself a carpenter.
Calling yourself a polyglot programmer is like calling yourself a construction contractor.
Calling yourself a Visual Studio programmer is like calling yourself a Hammer Carpenter.
I wouldn't use any of these expressions, I think that the examples I give suck less than comparing a language to a hammer, but they are still terrible metaphors and easy to dispute. Remember:
Programming is an unnatural act.
http://www.cs.yale.edu/homes/perlis-alan/quotes.htmlIts impossible to do any kind of real carpentry job to completion using only a hammer. Thus, a 'hammer carpenter' is derogatory because you would not expect them to produce anything useful. C developers produce, and continue to produce complete, useful software.
There are also things like "A hammer carpenter doesn't have to spend a significant amount of career development time keeping up with the state of the art in nail compilers or wood instruction sets." C programming is a specialisation in a complex field, and such specialisations often deserve their own title.
Calling someone a neurosurgeon is like calling them a hammer carpenter. Everyone should be a GP.
A previous commenter mentioned 'helicopter pilot'. You wouldn't see a topic saying "Calling someone a helicopter pilot is like calling them a hammer carpenter." It's likely that a helicopter pilot has experience flying fixed-wing planes, but their _value_ comes from specialising in a particular craft, so they're likely better at it, and that's what they advertise themselves as.
If I were to attempt another tortured analogy I'd say C to a programmer is more like a router to a carpenter. You can do a whole lot of carpentry without using a router, but for certain tasks you absolutely need one. Not to mention the blade is sticking out the bottom and totally scary, ready to bite your hand off at the slightest provocation, and the slightest deviation from true carves a big dent in what you were trying to do. Using a router requires a steady hand and some thinking beforehand, but if you know what you are doing you can make short work of many tasks.
Calling yourself an Emacs Programmer is like saying you're a Hammer Carpenter.
Calling yourself a C programmer is like saying you're a framer. Calling yourself a Ruby developer is like saying you're a brick layer.
Both can be used to build a house and it's usually better to work with what you know.
So apparently I'm ruining the universe by employing tools I don't fully understand. I must admit this particular complaint I find a bit perplexing. I'll drop down a level of abstraction if I find the universe demands it of me. Otherwise - I really don't care about what's going on in bowels beneath me. Maybe Gandalf is getting it on with a Balrog for all I know... but for my needs, it just doesn't matter.
I mean - I'll learn assembler if I come up against a use case that demands it of me. But that's just not likely to happen for the silly little things I'm working on.
I also happen to believe that it's a waste of time to teach kids the algorithm that you work through on paper for long division. Give the tykes a calculator and let society progress at the faster pace that technology allows. I mean - claiming that you need to use an abacas to do basic sums because that's how we old folk did it, is just ridiculous. All algorithms are just effective procedures which depend on a certain level of technological sophistication to be employed. The introduction of arabic numerals meant that we didn't have to use abacuses any more. Hooray!
Besides that - I actually know people whose applications I have aped for learning purposes - and I notice that I wrote them in about the tenth of the time, with less than a tenth of the experience, and they also seem to the run at ten times the speed with similar functionality. I hear yarns about how they were doing dumb things like not setting primary keys, or making loads of unnecessary calls on the database etc... and I think about how Django really helps me to steer clear of many of the basic mistakes. I learn about these as I go because I continue to read the awesome documentation as well as digging into the guts of how Django works. Through this I get a lesson on how at least one group of professionals think web development should be done.
I personally feel much better placed going forward than all the folks who've had to roll their own over the past 10 years. When I feel more comfortable with Django, probably the next thing I'll do is learn another framework - so as to get another perspective from the professionals.
I think it's a great way to learn - personally... and folks who think otherwise I'm going to keep ignoring.
That's assuming they even remember how the algorithm works. Which they don't, as a rule.
ROI-wise, there are far better places to spend time learning the relationships between numbers than long division.
There are zillion of different algorithms that could be applied to do long division. I could for instance, apply an algorithm that works for first order classical logic extended with the set of peano axiom and a successor function. Certainly someone who knows THAT algorithm understands something more about division than folk who just use paper and pen with arabic numerals. But do most people need to see the relationships between the two algorithms to do all the stuff in life that they need to? Clearly not.
So to be convinced of your position I'd need to see why the particular knowledge of the particular algorithm you think is so important is really necessary to the work that most people go on to do with long division.
I'm not saying the issue is completely cut and dried - but I personally can't see what your argument might be.
- edit - I might just add... that it's ALL technological reliance to some degree. I mean - what if they don't have pencil and paper? What if they don't have arabic numerals? These both were important technological advances that made long division as we know it possible. It simply couldn't be done with an abacus in any way that wasn't horribly time consuming. Technological reliance doesn't hold as an argument against employing new and faster algorithms except where it may still be difficult for many to get access to that tech. In the case of calculators in the western world - that's clearly not an issue.
I rely on technology to cook my food for me. Personally, I think that should be a little more alarming than relying on a calculator. My point being: embrace technology, don't fear it.
> these kinds of exercises are way of teaching the relationships between numbers, which is INCREDIBLY important.
One could learn about relationships between numbers without knowing long division.
Honestly, the only time I do non-trivial division by hand is when I'm doing napkin math to entertain myself. If I didn't know how, I'd just rely on my phone. It's fairly unlikely that I'm going to be in a situation where I need to do long division and don't have access to a computer/phone/calculator.
Now, I'm not sure that I agree with not teaching long division but, at the same time, I'm not convinced that it's terrifically important.
Also, the range of things you can do with C likely exceeds what you generally utilize a given hammer for.
Programming languages are not like hand tools.
Firstly, "C" is not a difficult language. When you compare it to the difficulty of say elementary calculus, you will notice that the concepts are simple.
Any person who studied computer science and do not know how a pointer works (or how to represent an access an array with a pointer) is grossly incompetent. C does not hide the basic programming concepts behind a nice IDE which you double click to type your portion of code.
I recently had another problem (with one person who was busy with a Masters degree at a fairly prestigious technology university). The project involved having video updates. I wrote a demonstration that performed the computation in a “while(1)” loop (i.e. fetch frame, do processing, display frame). The person was involved in writing a simple GUI program.
I tried to explain to him that he cannot use a “while (1)” loop in the event handler of the button that should start the event. Even drew nice graphs on a board explaining all about the thread of execution and how event handling usually works (e.g. a loop that handles events and call functions).
After 30 minutes of explanation the person came up with a very bright idea. He said that “Maybe we should set a sleep(1000) command in the loop to give the program time to react”. WTF?
I, for one, enjoy languages (and even frameworks) with sensible defaults, so the normal case is handled for you, but that let you override that default behavior or even drop down into a lower level language when needed.
I understand that the utility of C is low when we are talking about web-applications. But the fact is that the concepts should be known. Everyone who writes event-based programs should at least have a rudimentary idea of how it works.
Maybe so, but such folks exist in droves. C isn't hard, but it looks simpler than it is, and this clever disguise catches a lot of people off guard. And even so, there seems to be a practical difference between understanding C and having the discipline to use it correctly in the midst of a real project.
Compared to other programming languages - most of which are significantly more complex than hammers. My 2 and a half year old daughter knows what a hammer is and has an idea of how to use it. I'm proud that she can point and say "C for cat!", but that's about the extent of her knowledge of the C programming language.
Also, yes, C is a fairly simple language, but that doesn't mean that it's necessarily easy to use compared to other languages, that do nice things like GC.
UPDATE: After rereading it... you guys are actually implmenting the button. Although surely you're not implementing the whole mouse stack... so I'm still confused :-)
So the event handler goes into a while(1) loop instead of starting a new thread/process to do the video processing.
That will lock the GUI and make the app unusable.
I'm beginning to suspect that the willful incompetence on their part is maybe just a scheme of many to get others to do the work. Suspected a bit of professionalism from people who are about to graduate with master degrees.
Particularly when you consider how much different languages' capabilities overlap.
Instead, you want -- particularly as a consultant -- to be the guy giving measurable, predictable, huge impacts either to costs or, ideally, to driving revenue. If you cannot quantify your worth to the company, it will be quantified for you, and the default guess is going to be -1.5 * $YOUR_SALARY. If you can quantify the value of your work for the company -- by being the guy who makes them money using his bag of magic tricks that management frankly does not understand and does not give a shit about -- your market value will be far, far higher, whether you choose to take it in terms of dollars, flexibility, working conditions, or what have you.
You just have to add that: you are a programmer that is able to handle a project from requirements gathering to deployment in an agile fashion, provide help with SEO, copy-writing and scalability issues :)
And what about running on multiple databases. What happens if I need to be able to support MySql and Postgres? Really hard without a framework.
There are certain instances (i.e., full-blown web applications) that benefit a lot from employing abstraction tools such as RoR or Django. Equally, whenever there's a lot of variation in the underlying technology, give me a framework! jQuery is a wonderful example for this.
However, there's a time and place for such frameworks, and that is not "always, everywhere". Really simple CRUD stuff doesn't require Rails. CSS grid frameworks are a ridiculously inefficient mess. (Aye; even in prototyping.) Most template languages are silly and unnecessary. Et cetera.
Sure, it's a rant. But the man has a point. Web frameworks are enabling a whole generation who can't even use a scripting language without relying on plenty of magic. A modicum of abstraction, when sensible? Bring it on. Relentless black box programming? That has its limits.
I don't really think people program like this. When I tried using rails 2 years ago, all the magic it was doing behind the scenes actually made it impossible for me to use it, as I had no idea what magic was there and how it related to the underlying system. After some time of writing web apps "by hand", then trying out sinatra and padrino, I just recently looked at Rails again and suddenly understood how to use it.
What I want to say is that I don't think that the magic Rails does leads to stupid programmers. It will only help those that actually know what they want to do and make the repetitive parts easier. Honestly, I don't want to write a login system with hashing etc. ever again. I don't want to think about how to save old versions of the entries in the database. I don't want to write my own form helpers. I am happy that Rails does this for me and I can spend time thinking about the interesting parts of my program.
On the other hand, with full-blown web applications that do something out of the ordinary (long-running requests, etc) it might be better to drop down a level of abstraction.
Sure, I could use stored procedures, but then it's database-specific. What happens when I need to move from MySQL to postgres, or from AppEngine to my own server?
The poster just ignores a million things frameworks are good for. Sure, if your project is large enough you'll eventually grow out of them and need to do more complicated stuff than what they make simple, but for 90% of projects they are a godsend.
1. You have to keep the schema and the associations in sync. I simply do not understand why in RoR the associations are not derived from the schema using foreign key relationships.
2. You end up knowing how to do something simply in SQL and then having to translate that on to the Rails way. This Rails way seems like a useless translation of a perfectly workable underlying system.
Put 1 and 2 together and I end up with the frustration of "Oh, I have to keep the schema in sync. with all this association stuff so that I can use Rails method to access the schema". It feels circular and I'd be much happier with reverse engineered methods.
Also, I find the Rails magic functions where you can just make up a function name find_by_nozzle_color() to be infuriating. I'd be really happy if the reverse engineering component spat out something like a header file containing sensible methods I can call.
Perhaps I lack imagination. Or experience. Or both.
Also, while I'm moaning. I wish Rails had proper support for database views. It's as if no one has any real experience with databases. Doing that would eliminate a lot of my troubles because I could keep a view (even an updateable view) in the schema and have a handy object accessor for it.
2) All that has_many :through does is simplify the syntax of accessing objects through many-to-many join tables. If you know how to use many-to-many joins, has_many :through is just a simpler syntax that enables you to explicitly mention the join table only once, and have it used implicitly thereafter. Nothing all that complicated about that, and there's nothing that needs to be "kept in sync" any more than it would if you were doing pure SQL.
3) find_by_* methods are hardly complicated. Have a read through the source of ActiveRecord::Base's method_missing and you should get the idea of how they work pretty quickly. Give yourself half an hour, because it is pretty tight code that does a lot and does it efficiently, but it's not difficult to follow if you know ruby:
if match = DynamicFinderMatch.match(method_id)
attribute_names = match.attribute_names
super unless all_attributes_exists?(attribute_names)
if match.finder?
options = arguments.extract_options!
relation = options.any? ? construct_finder_arel(options, current_scoped_methods) : scoped
relation.send :find_by_attributes, match, attribute_names, *arguments
elsif match.instantiator?
scoped.send :find_or_instantiator_by_attributes, match, attribute_names, *arguments, &block
end
From: http://github.com/rails/rails/blob/master/activerecord/lib/a......
> I wish Rails had proper support for database views. It's as if no one has any real experience with databases.
Recall that Rails was created, originally, for use with Mysql, which is the sort of environment where concepts like foreign keys were, perhaps, a bit foreign to some users.
I think your complaints are valid ones, but on the whole, I think Rails has been very good for web applications, because you can do more with less code, and yet keep it fairly clean. Once you've got things set up, it becomes pleasantly simple to interact with the database in straight up Ruby, while still being possible to do more complex things should the need arise.
Mind you, prior to Rails 3 this was a heinous world of pain, so it's understandable to overlook it.
+1 on the lack of support for views. You can kludge things together, but its not pleasant.
You're making the associations sound much more complex than they are. Once an association relationship becomes too complex, you always have the option of just declaring simpler association and stitching together the complexity manually. Maybe I'm completely wrong, but in most places i do feel that Rails degrades reasonably, so that you always have the option of doing something the more verbose/manual way. In something like asp.net, I find that it either just works, or you're up st creek.
Compare
DM: Article.first(:author => person)
AR: Article.first(:conditions => {:author_id => person.id})
AR shortcut: Article.find_by_author_id(person.id)
AREL: Article.where(:author => person).first # not sure about thatYou are investing in learning a specific library/framework rather than the low level details that are on average what you'll need more because in practice you don't get to use the same framework all the time if you switch companies or projects as they tend to have entirely different frameworks or even languages on the backend.
I like how Marcin Wichiary though in this ajaxian.com article: http://ajaxian.com/archives/web-ninja-interview-marcin-wicha...
He basically builds all his libraries from scratch for each project which he can do quickly because he knows what he's doing and can of course leverage his other code for reference. Each iteration simplifies what turns out to be bloated and creates a new code base more matched to the problem he's trying to solve.
"Calling oneself a C programmer is like saying you're a finish carpenter."
As in, it means you normally work in a particular set of circumstances, which is all we're aiming to say when we denote the language we work in (because language is often closely allied with the type of project). Does it define you as a person, or even state that you don't work in other types of projects, no, it doesn't.
Can we move on from this now?
Buffer overflows would be a problem of course, at least for large buildings with lots of traffic-- after the 4,294,967,296th person the whole thing would just collapse.
Today it might be useful to do SQL queries and Form handling via OO and tomorrow it might be more useful to go hack some raw HTML. The answer is, almost as always, "it depends".
One could take his argument to ridiculous levels and say if you don't fully understand Machine Code and every layer of Abstraction above it, you are doing something wrong. Clearly a ridiculous argument although I have no doubt that if you did understand all these layers you probably could safetly call yourself a good programmer :)
There is much more of this type of discourse in the programming community than I can bear. I think it happens when a young programmer gets just enough experience to gain confidence but not enough experience to gain perspective.
Specifically speaking, what made me a better programmer was making my own game engines from scratch using DirectX, SDL, and OpenGL. Yup, I wrote 3 different engines on three different technologies (even though SDL uses DirectDraw underneath). What made me a better web developer was writing my own MVC framework for PHP, and then I moved to Rails to be productive.
Hiding those details helps certainly, but only if you know them. You still need to know them, which is where a lot of Rails programmers get it wrong, but hiding it will still help you be productive.
I do want to address specifically the idea of abstracting out things like HTML or SQL. These are my two pet peeves. I look at something like HAML, and I can't understand why anyone would consider that to be a good idea, even putting aside the fact that your designer will have to learn a whole new syntax, but the idea that markup should look like programming language defeats the point of a markup language.
Here's how I did it with Appleseed, using the simple_html_dom library. Views are dumb, very dumb. You create a view which is only markup, for instance:
http://github.com/appleseedproj/appleseed/blob/master/compon...
So you properly class and id your markup, and in the controller, you populate the data, repeating elements for lists or tables, by targetting the dom.
If I want to set the title on this view, I do:
$View = $this->GetView ( 'friends');
$View->Find ( '.profile-friends-title', 0 )->innertext = "New Title";
That's it. No template pseudo-code, designers only have to care about the markup itself. On the front-end, I do the same with Javascript. Think of it as unobtrusive PHP.
I also stay away from ORM's. I understand all the arguments in favor, but in the end, I'd much prefer writing complex joins than using an ORM.
Separation of concerns is so important, and yet, sometimes I think frameworks, which are supposed to facilitate that, actually can make it worse, by trying to reinvent the wheel in abstract ways.
When I decided I wanted to learn more, I started to learn what the abstractions did, and hacked and changed it to be better for my particular use. Then I moved on to lower level languages, and now I have a decent understanding of how to write my own abstractions, yet I still use abstractions because they let me focus more on what I am wanting to do, instead of how to do the things that let me do it.
This post could be changed to say that anyone that learns a higher level language is harming themselves. The skills and syntax you learn from Python cannot be used in C# or Java, so you should just learn assembly. It is all machine code in the end and these languages are just facades. Only real men program by moving bits to registers.
Regardless of the means of transport, we're achieving the same goal. How we achieve this is usually personal preference. And for that reason rants like this will always come and go, just as responses like mine.
The details beneath the abstractions are indeed simple, and likely more simple than the abstractions themselves.
Why do we use abstractions if they are so goddamn complicated?
You know the answer.
A programming language is a tool. Each one fits it's own problem-set.
And what would that "problem-set" be, exactly?
The boundaries between the utility of a hammer and utility of a saw are quite clear. The boundaries between the utility of PHP and Ruby are very blurry. Strictly speaking, both languages are turing-complete and are equally capable of solving the same "problem-sets".
And for bonus points, you have to use it by toggling ones and zeroes manually, since all those wrappers hide things and get in your way.
A few things that web frameworks/libraries help with:
Forms:
- Validation & displaying errors & input sanitization.
- CSRF checks.
- Safe file upload handling.
- HTML generation is useful for removing a bunch of boilerplate.
ORMs: - Default SQL injection protection.
- Query objects help you construct complex queries without having to do a bunch of
string manipulation.
- Database abstraction (e.g. moving from MySQL to PostgreSQL is a lot easier).
- Database migration tools to help you upgrade your schema.
Templates: - Inheritance & replaceable blocks reduce a lot of boilerplate code.
- Tools to help you safely escape user generated content & transform it for web
presentation.
Misc: - User authentication. Rolling a secure implementation on your own is no small task.
- Secure cookie and session management.
- Providing an organized architecture with sensible separation of concerns.
Now, to be a solid web developer I agree that at some point you're really going to need to understand the fundamentals of how each of these things works under the hood, but you're crazy if you'd rather write all that code by hand instead of using solid, well-tested, existing libraries for it.Note: That's not to say that using a web framework will automatically make your code secure (the recent Diaspora debacle clearly demonstrates otherwise). However, you've already got so much code to worry about securing in your own application, why would you want to have to hand roll everything else too?
Despite all the problems with PHP, it still gives you a middle of the road approach. You have all the tools to do the stuff you need to do, but at the same time you have access at how things really are done. For example, you can handle SQL by hand or create your own objects to do what is necessary. I think this is really useful, and would like to have something like this in other languages as well. I realize, however, that the reason PHP allows this operation mode is that it was created as a web language itself, not a set of libraries on top of an existing language.
Amen. Insight of the century with regard to Rails, J2EE, BPEL, and a number of other boondoggles.
A pity that for many in HR it´s not that obvious.
I kind of agree with him. But I bet he wrapped his "select count(*) from ..." in some sort of function like get_row_count(table). Add a few more and before you know it, you're half way to a new framework that concatentates HTML fragments built from SQL queries.
But to assume the argument has merit, lets follow it to its natural conclusions: since when was SQL a low level language?! SQL servers are vastly more complicated than Rails.
Another assumption the author makes is that, for any programmer, SQL is the constant, and time spent learning Rails is wasted if one has to switch to Django. This just shows the limited world view of the author. For many, Rails is the constant, and SQL, Couch, or Mongo are the choices.
To stick with the tool analogy, C is the giant processing equipment that skilled operators used to print my photos in an hour (http://bit.ly/aCoA0K), while Rails is the little Canon Selphy sitting on my desk. Both produce identical results. One of them does it a lot faster, for a lot less money, and a lot less failures and maintenance.
Fify?