share
Stack OverflowWhat are some programming problems you initially get WORSE at?
[+62] [16] BlueRaja - Danny Pflughoeft
[2010-01-20 14:12:08]
[ tips-and-tricks fun common-mistakes trivia ]
[ http://stackoverflow.com/questions/2101875] [DELETED]

In programming, as many professions, there are mistakes you'll make now that you may not have made as a beginner. For instance, consider pointers:

In C++, is there any difference between arrays and pointers?

The beginner will say yes, they are two completely different concepts, and treat them as such.
The intermediate programmer (having learned that arrays are pointers internally) will tell you no, they are the same thing, and may miss some crucial bugs by interchanging them all willy-nilly.
The expert, however, will again say they are different things (ex. see here [1] or here [2]).

What other questions/mistakes are like this?

(1) Damn I had another good one too (const int* vs. int* const) - BlueRaja - Danny Pflughoeft
(1) I like this question - It's pretty interesting and not necessarily subjective. - Dario
(90) Should I use threads? The beginner will say "No! They scare me". The intermediate will say "Sure, I know how to use them". The expert will say "No! They scare me". - Marc Bernier
(1) @Marc: That should definitely be an answer :) - BlueRaja - Danny Pflughoeft
Thus spake the master programmer: canonical.org/~kragen/tao-of-programming.html - drawnonward
(2) @Marc: Oddly, hardware engineers operate in parallelism constantly and their products work. I think there's a lesson there. - Paul Nathan
(1) Arrays are not pointers internally! It just looks that way... - Thomas Padron-McCarthy
[+35] [2010-04-23 05:49:45] drawnonward

Should I read the documentation?

The beginner: yes, I know nothing.
The intermediate: no, I know it.
The expert: yes, I know how much I don't know.


(3) Also seems to apply to reading programming books in general. - BlueRaja - Danny Pflughoeft
Haha...this made me smile as I have just started devouring computer science and software engineering books lately as I have realized how little I actually know (and I want to learn more). Good answer! - JasCav
Documentation is the cyberspace fabric boredom is woven of. - Jonas Byström
1
[+34] [2010-01-28 02:14:23] Adam Liss

The young coder writes simple, straightforward code to avoid making mistakes.

The wicked coder shows his knowledge and expertise by wringing out as much functionality as possible from each character of code.

The wise coder uses the language effectively, writing code that is clear, concise, efficient, and maintainable ... generally favoring clarity and maintainablilty after supporting wicked code.


(2) Sadly, most people never get past the "wicked" stage ;) - RCIX
(9) @RCIX: In time, you can inflict wisdom on your developers by having them debug or enhance their old code. (Does that makes me a wise or a wicked manager?) - Adam Liss
(1) Well said, Adam. - ydobonmai
(5) And the coder who does not yet know how to code... uses vbscript. (Happy passover :-) - roufamatic
@roufamatic: Thank you for totally making my day! - Adam Liss
2
[+20] [2010-06-02 23:18:32] sambha

The beginner will try to google for a solution in vain

The intermediate will not google and try to code himself

The expert will google the solution in no time (but then will spend time reading stackoverflow!!)


(2) but then will spend time reading stackoverflow!! ... the new wikipedia... - FastAl
(2) +1 "but then will spend time reading StackOverflow". That's my form of procrastination. - new123456
so if im reading this first does that make me an expert :) ? - Skeith
(1) skeith: It makes you a procrastinator ;) - sambha
3
[+16] [2010-01-23 18:13:32] epatel

Not really a question, but a behavior

Over design and making ie quasi classes in OOP

The beginner try to use as little fancy design as possible, learning the ropes. Short way from A to B.

The intermediate developer will start to create more and more quasi classes [1] and over design in every new project. Believing complex is better [2]. Long way from A to B.

The expert has get to a point where most projects are re-writes of old projects and now skip the excess classes and design better knowing where to put the flexibility needed. Short way from A to B.

[1] http://www.idinews.com/quasiClass.pdf
[2] http://img.skitch.com/20090222-jd6pf1gcjx77bgdh16a5ceehyc.jpg

(5) I agreed until the expert doing projects that are rewrites. Any "expert" knows not to redo old projects (except for extreme corner cases). - Wallacoloo
@Wallacoloo not re-writes of the actual projects but i.e. when one changed company a couple of times and every time write a new configuration handler. Different projects but same structure. - epatel
4
[+14] [2010-03-18 19:53:24] Developer Art

A user calls and complains about an ugly bug he just discovered!

Junior: What? Bug? Where did it come from? Don't worry, we'll fix it quickly.

Experienced: Bug? What bug? Okay, it's a known bug, don't worry, we'll fix it soon.

Senior: What bug? All right, it's a known bug, don't worry.


(20) Jedi: What bug? That's a feature! - j_random_hacker
5
[+12] [2010-01-23 17:15:41] ElectricDialect

Should I use PHP to develop a small web application?

The beginner will say yes, since PHP is widely deployed and easy to get started with.

The intermediate programmer will say no, since the language has an inconsistent (some would say ugly) syntax, and is notorious for security issues when not configured properly.

The expert will say yes, since a PHP environment can be configured to be relatively secure and the language supports well-structured code if the developer knows how to organize it properly. Most importantly, the project can be completed quickly and deployed with minimal hassle.


(22) "the language supports well-structured code if the developer knows how to organize it properly" This is true for any language except malbolge, brainfuck, and their kin. Some languages don't require you to be an expert in order to write reasonably secure and well structured code, php is not one of those. - Justin Smith
(2) i tell other people to use php, because I don't have the time or energy to help them set up for a language that isn't "plug and play". or explain to them why their non-php app doesn't work like php. - Tor Valamo
(14) -1: The expert would not be using PHP. - Ben M
(6) Any "expert" that deliberately uses PHP is either an unknowledgable expert (see n00b) or dumb. - Jonas Byström
@Jonas, there is always a special case for any sweeping generalization. - Thorbjørn Ravn Andersen
6
[+8] [2010-03-19 05:59:43] dan04

Dynamical memory allocation in C++.

The beginner won't know about it.

The intermediate will write code with memory leaks or without exception safety.

The expert will know the proper use of smart pointers.


(23) The expert will know not to use C++! ;) - Mason Wheeler
(3) It seems like the "intermediate" has been becoming more and more like the beginner D: - Wallacoloo
so when will someone know how to write a memory pool? - rwong
7
[+8] [2010-05-05 21:04:06] BlueRaja - Danny Pflughoeft

The beginner knows nothing of design patterns, so never uses them.

The intermediate can name every design pattern there is to know, and will suggest one of them as a solution to any problem - he thinks in terms of design patterns.

The expert will use a design pattern when it is called for, but this is the (fairly rare) exception rather than the rule - he thinks in terms of coherent units (such as modules and classes).


(11) I would say that the expert will never build to a design pattern, but will notice them when they appear. - dash-tom-bang
(2) +1 for understanding how people use design patterns! stackoverflow.com/questions/1820106/… - Patrick Karcher
8
[+6] [2010-01-23 17:53:26] Dario

Take a look at this code:

x = x + 1

As a beginner, I said that this is mathematical nonsense since there is no x which is it's own successor.

Afterwards, I got used to this notation and intuitively interpreted it as an assignment (x becomes x + 1)

Now I'll again say it's mathematical nonsense and therefore stick to functional programming [1], where immutability counts.

[1] http://en.wikipedia.org/wiki/Functional_programming

(14) Programming is not pure math, don't treat it as if it was. (I'm not saying that functional programming is bad!) - Wallacoloo
@wallacoloo: It is. Just because it has a succinct notation for emulating unpure operations, don't treat it as if it wasn't ;) - Dario
(1) @Dario: In a sense you are right, programming is built upon math. Unfortunately, my definition of math has been highly mutilated by school, so it's not as obvious to me as it should be :( But in a way you're saying you should treat something like Python as if it were really C, just because it's built upon it. A major point of abstraction is to allow the user to think in a different, more relevant manner. So my suggestion to you is to think of programming as programming, and not anything else. - Wallacoloo
(1) @wallacoloo: Yes, in a sense, you are right too. Abstraction is absolutely cool. But often, the different, more relevant manner is actually distracting from the true core of the problem, which is, most of the times, pure. - Dario
This is not defining x to be equal to the expression "x+1" at all times, like x=x+1 would in math. There is a difference. - Cam
(3) an expert will realize that this is equivalent to x++ and save two chars - Jason
@Jason: Or x += 1 in some languages, which still saves you one character. - JAB
@dario @wallacoloo - EVERYTHING everything everything EV. ER. Y. THING. is pure math. There is nothing that exists that is not pure math. - Jason
(1) @Jason Can you define a set that contains all sets. Would it contain sets that are defined to not be members of other sets? - csj
This proves again how good is Pascal for educational purposes. In Pascal you would have written the above code as x := x + 1 (:= is assignment) or as inc(x), and everything would have been clear from the beginning. - Cristian Ciupitu
9
[+4] [2010-01-28 01:51:40] Suraj Chandran

When it comes to fixing and finding defects/bugs:

  • Over-analysing

When you have enough experience in debugging(but not really enough), then even for the most simplest defect, you ignore simple solutions("No way..how can it be so simple") and keep on over-analysing and finding complex solutions. Sometimes though, finally, you end up with the initial simplest solution.

But as you get really experienced, you start repsecting simple solutions and understand the elegancy in simplicity!!


(1) You may say the same with designing and implementing. - too
10
[+4] [2010-04-23 04:29:54] omermuhammed

The beginner will have heard of and maybe even used version control (CVS/SVN/git etc). They are only learning of build engineers and are hearing for the first time the concepts of release management. They also are reluctant to do frequent and regular checkins.

The Intermediate engineer will know more than one version control systems, know what build engineers do, know the value of logical commits, and are curious of DVCS like git and Mercurial and why they are useful. They will also know the value of clear and descriptive commit messages.

The expert engineer has lived through more than one manual merges (and will do everything in his power to reduce the need for merging), knows the pitfalls and uses of branching and merging, knows when to use SVN vs Mercurial, knows use of tools like Araxis Merge, and unless he is starving (and has already chewed and eaten his toes), will not want to work at a place that uses VSS for source control.

I know I am dating myself with this, but you don NOT want to use VSS.


I give +1 to anybody who says not to use VSS. (ARGH! I still fight this on a semi-regular basis. Fortunately, I'm starting to win...except for a few pockets of resistance...) - JasCav
+1 for the visual of the starving expert :) - CindyH
11
[+3] [2010-01-28 02:01:16] Tor Valamo

Using frameworks

The beginner will say "Definitely. They make everything much easier. I use it for everything. I can make a hello world app in ten seconds. I just need to ship it with this 150 mb framework. No problem."

The intermediate will say "I don't use them at all. How are you ever going to learn programming if you just copy and paste? Also it bloats things."

The expert will say "I use it in some parts of my application. But just a few selected modules, which I've slightly altered to fit my requirements and reduce bloat."


(13) My experience has been that the beginner won't try to use them; there's too much learning curve. The intermediate will use them everywhere, and create a cruise ship where a bicycle would have fit. The experienced programmer uses but doesn't overuse, hopefully. - Dean J
(3) @Dean I think intermediates are often more arrogant; so they don't use frameworks because they think they can program anything. - Wallacoloo
(1) @wallacoloo: It might split up more than three ways, I think. :-) - Dean J
My experience is closer to @Dean J's as well. The beginner is often busy learning the language itself--no time for frameworks! - musicfreak
12
[+3] [2010-01-23 18:07:24] BlueRaja - Danny Pflughoeft

In C and C++:

const int* vs. int* const

The beginner will simply not use const.

The intermediate will write const int* and, giving themselves a false sense of security, may accidentally overwrite the pointer (for instance, the common mistake of = instead of ==)

The expert will know that const int* is a mutable pointer to a constant value; int* const is a constant pointer to a mutable int (to get a constant pointer to a constant value, use const int* const!)


(3) Assignment instead of comparison is not a mistake of the intermediate... Unless you want to tell me I'm an expert ;-) - James Morris
(1) Obligatory reference to C++ faq: Read const from right-to-left. - BlueRaja - Danny Pflughoeft
13
[+2] [2010-01-23 18:33:29] ZoFreX

I'm sure I'm not speaking for other developers, but at the moment I'm mostly working in a language I'm extremely comfortable in, doing tasks that I know how to do really well. Because of this, design and programming mistakes are significantly reduced, so I'm finding a rising proportion in bugs are due to simple typos. You could say there's a bug between my brain and the keyboard, i.e. my clumsy fingers.


I find that neatly formatted code as part of a v.strict coding standard helps eliminate those typos that sneak through the compile phase. - logout
Many of them have been typos in the configuration files for the project, followed by ten minutes of wondering why my plugin hasn't properly initialised. Ideas for checking config files welcomed! - ZoFreX
(2) A good IDE can eliminate almost all typo-related problems in code, especially for dynamically typed languages (eg. for Python, Eclipse + Pydev) - BlueRaja - Danny Pflughoeft
A typical PEBKAC situation :) - runrunraygun
14
[+1] [2010-06-02 23:51:10] Peter

When you run into a bug in a framework your application is based on:

The beginner won't fix it, because it's difficult and they're scared to delve into framework code.

The intermediate programmer will dive in and create a large pile of code to replace the allegedly buggy framework component. They'll have fixed the immediately observed bug.

The expert will try to find a solution that works with the framework, not against it. Sometimes they'll leave the original bug unresolved when they know that to fix it will leave them open for more severe bugs down the line.


(1) I think the expert would find an immediate workaround, but contact the framework authors with a bug-report and (if it's something he's paying for) request a patch. - BlueRaja - Danny Pflughoeft
Maybe, but if your bug is in something like .NET, for example, you might have to wait a year for an update that'd fix it. My point is that if a fix or workaround is not available, the expert knows that sometimes it's better to leave well alone than to make things worse through lots of busywork. - Peter
15
[-2] [2010-03-18 18:48:13] NAVEED
Difference between Class and Structure ?


EDIT:

First of all this is entirely language dependent. so may be someone don't want to agree with me.

Beginner:

Structure member are public in default and class members are privare in default. (I know only this difference at the beginning of my education.)

Intermediate: (Something like this)

  • A structure can't be abstract, a class can.
  • Classes are used for large amounts of data. Structs are used for smaller amount of data.
  • Classes could be inherited whereas structures could not be inherited.
  • The structures are value types and the classes are reference types.
  • A structure couldn't have a destructor such as class.
  • You cannot override any methods within a structure except those belong to type of object.
  • A structure couldn't be Null like a class.

Expert:

From OO perspective, there are no difference. From technical point, there can be many differences but that depends on the language. Ignore Structure.


(3) Classes can be inherited, Structures cannot. The default access for a class is private whereas a structure's default access is public. See stackoverflow.com/questions/13049/… for class vs structure in .Net - clyc
is there any technology defined in my above question ? And that is the point that I want tell. You provide me a question about .NET technology and I work in open source technologies like PHP and JAVA. - NAVEED
what about this stackoverflow.com/questions/1920849/… - NAVEED
You won't find a unique answer unless you specify what language you're talking about, and exactly what kind of difference you want. In C++, the language difference between a class and a struct is whether default access is private or public. However, they tend to be used in much different ways, a class being used as a real data type and a struct being used as a bundle of data. - David Thornley
@David: and when someone ask you it without defining any language ? what about that question ? - NAVEED
@NAVEED: If you're a beginner, you answer it in whatever language you know where it makes sense. If you're an intermediate, you ask which language. If you're an expert in enough things, you might possibly narrow the possible answers enough down to be useful, but in a case like this won't be able to. - David Thornley
@David: It means that there are different answers by expert,intermediate and beginner. Now look at the topic of this thread(question). They asked such type of questions, therefore I mentioned this question which creates confusion. Then why downvote??? - NAVEED
A class is a reference type, a struct is a value type. It is C#. Is this really different in other languages? - ydobonmai
@Ashish: You got another difference but also confused. And this thread is for those confused questions but I am surprised that why I am down voted. :) - NAVEED
@NAVEED, :-) Well, when you ask this question "What is the difference between class and struct?", you and the other person know which language you are talking about. I am not confused. I was just asking if this behaviour is any different in other languages from C#/Java as I dont know others. - ydobonmai
@Ashish: It is different in different languages. OK. Answer my question without questioning me. My question is "What is the difference between Class and Structure? Any confusion?" - NAVEED
@NAVEED: I think the problem is that you answered in an unexpected form, not pointing out that the different answers. Since I didn't downvote you, this is speculation on my part. - David Thornley
@Ashish: See my earlier comment for the difference in C++. In C and C++, there is no such thing as a reference type or value type, since objects of either type can be either. - David Thornley
People are downvoting but no one able to answer a generalised answer to my above question in this answer. Everyone asking which technology? hahahhahahah - NAVEED
(6) Maybe they're downvoting because they don't see the connection between the question and one-line statement you posed and the topic at hand. Instead of being so smug about it, perhaps you could just edit your answer to explain in more detail what exactly you mean. - indiv
OK. Answer is edited. - NAVEED
16