last updated:06 Aug 2003 15:12 UK time
|
 |
|
(Comments added for week ending Sun 19 Jan 2003) | View Other Weeks
|
|
| Code Question~ | Sun 19 Jan | |
| Is there a subtle bug in this code due to size_t being compared with an int? size_t cannot be negative.
Would it be better to declare all variables as long?
// Reverse a string
char *str_rev(char *p_str)
{
char tmp, *p = p_str;
size_t front = 0, back = 0;
int test;
assert(p_str != NULL);
while (*p++ != \0) { back++; }
if (back == 0 || back == 1) { return p_str; }
back--;
do {
tmp = p_str[front];
p_str[front] = p_str[back];
p_str[back] = tmp;
front++; back--;
test = back - front;
} while (test > 0);
return p_str;
} |
| Sun 19 Jan | Nat Ersoz | 1. I don't see anything that would be classified as a bug since your while( test > 0 ) could just as accurately be written while( test != 0 ).
2. However, if you'd like to code pretty, then use ssize_t which is the signed version of size_t.
3. I think its better to prefer size_t or ssize_t when dealing with posix functions like read and write which return ssize_t. When using lseek, somtimes the typedef off_t is used - conform to the API norms when possible. Then, if you compile against a 64 bit file system, the ssize_t typdef should take care of you. |
| Sun 19 Jan | Nat Ersoz | Hey, y'know, on second thought... to code pretty, I would just use int in this function - since you're not invoking any API where ssize_t is used. And, the difference of pointers is int. |
| Sun 19 Jan | Andrew Simmons | I'd be inclined to get rid of front, back, and test as integers, and just work in terms of two pointers into the string. |
| Sun 19 Jan | | Thanks for your responses. I now have a couple of ideas on how to make the current code 'solid.'
Working in terms of pointers is my goal. This code represents a step in the refactoring process.
It is necessary to have the comparison (test > 0) as when you have strings of odd and even lengths (back - front) will equal 0 for odd lengths and -1 for even lengths because back eventually surpasses front. |
| Sun 19 Jan | those who know me have no need of my name | Yeh, it doesn't work:
char t [] = 'dennis sinned';
char * p = str_rev (t);
printf (p);
prints 'dennis sinned' |
| Sun 19 Jan | | Lol! |
| Sun 19 Jan | Andrew Simmons | 'It is necessary to have the comparison (test > 0) as when you have strings of odd and even lengths (back - front) will equal 0 for odd lengths and -1 for even lengths because back eventually surpasses front. '
Surely odd or even doesn't matter if you write the loop correctly. What's wrong with something like the following (not tested)?
char *str_rev(char *p_str)
{
char tmp, *front = p_str, *back = p_str;
assert(p_str != NULL);
while (*back)
back++;
back--;
while (back > front) {
tmp = *back;
*back = *front;
*front = tmp;
back--;
front++;
}
return p_str;
} |
| Sun 19 Jan | | Your are correct Andrew, that is a 'refined' version of strrev using pointers etc. I made the statement in reference to my code and my own way of thinking about the problem. My original post is only asking if (size_t - size_t = int) has any subtle bugs. As far as I can tell it does'nt. Also can't seem to get ssize_t in VC++. Will keep working on it. |
| Sun 19 Jan | Andrew Simmons | 'My original post is only asking if (size_t - size_t = int) has any subtle bugs. '
Sorry, I misunderstood. Are you actually experiencing any problems with this? On my system, VC++ v 6, size_t is a typedef for unsigned int, and I wouldn't expect any problems with the subtraction. I've not heard of ssize_t, but I believe that ptrdiff_t is the signed size corresponding to size_t. In VC++6 this is a typedef for int. |
| Sun 19 Jan | Nat Ersoz | Sorry, ssize_t is defined in POSIX and the typedef can be found in unistd.h. I assumed this was a POSIX question since size_t was mentioned in the first place. Anyhow, probably best to just use int since its the diff of 2 pointers. |
|
| Why didn't you tell me!? | Sun 19 Jan | Stephen Jones |
| Something happened yesterday that reminded me of when I bought my first computer. It was in Barcelona in November 1996. A cloned Pentium 133 with 16 MB of RAM, no CD, a 14 monitor that always ran in 16 color mode because nobody told me how to get it to run any other way, an HP 690 DeskJet, and Windows 3.11 pre-installed (W95 was costing $100 more).
I took it home by taxi, went into tech whiz kid mode, put all the wires in the right place, and fired it up. I got a black screen with some writing finishing in “C:\” . I found I could type what I wanted and it would show up on screen, but nothing exciting appeared to be happening. Now, I knew that Windows wasnt all it was hyped up to be, but this was ridiculous. I dove in a taxi and went back to the shop. Ah, but you must type in Win they said. Thanks, but you could have told me before! I say.
Back I go home and sure enough it works. The joys of the Windows Welcome screen appear. But now we get to the second problem; the mouse doesnt work. There is a very helpful tutorial on screen, and Im sure it would tell me how the mouse would work but unfortunately you need the mouse to work in the first place to access it. I look at my watch, and find its too late to get to the shop but theres still enough time to hit the bookshop. I get to Plaça Universitat just before the shop closes and pick up a 700-page book on DOS and Windows 3.1
I spend the whole night reading the book but getting nowhere, and went bleary-eyed the next morning to the shop. The saleswoman gave me a patronizing smile, and the tech guy explained that I had to install something called the mouse driver which came on the floppies theyd given me. And once again, but stronger, out came the cri de coeur, Why oh why didnt you tell me!
What bought this to mind was that yesterday I finally hit the bullet and started to redo an Access application Id written a couple of years ago for work. As you probably know I am an English teacher not a programmer, and the particular program to keep track of job applicants, was written with the aid of a very large book on using Access, so it has lots of macros (none of which are grouped), no code or comments, and some truly marvelous kludges, such as making a whole new query to get a calculated field for the source of a combo box, because I hadnt realized I could just type the formula in the combo box properties.
One thing the program does is open up a mail merge document to print a report on a candidate. This has certain disadvantages too obvious to mention, so I decided I was going to design an Access report to look like the original Word document and print that.
What I needed was the code to get the report simply to print the current record from the form. I check the help file and it comes up with
>>>To open a report and restrict its records to those specified by the value of a control on a form, use the following expression:
[fieldname] = Forms![formname]![controlname on form]<<<
So I type in
Dim stDocName As String
stDocName = Evaluationquery
DoCmd.OpenReport stDocName, acPreview, , ID = Forms!Evaluationquery!ID
The report opens but at the first page, with all 400 odd reports there.
I go and check similar code in the application used to open a form at the correct record. The code is in a macro and works perfectly. So I change the SQL where clause to what works in the macro
[ID] = [Forms]![Evaluationquery]![ID]
Still opens the form at the beginning with all records. I play around a bit, manage to get the header to show on a separate page and not show on a separate page, spend over an hour looking through the help file and various books, but get nowhere.
In desperation I go to one of my books and adapt a sample of code that opens a report with a subset of records.
Dim strReportName As String
Dim strFilterName As String
strReportName = Evaluationquery
strFilterName = ID = Forms!Evaluationquery!ID
DoCmd.OpenReport strReportName, acPreview, , strFilterName
Whoa and behold, it opens one record at the right place!
Puzzled, I quickly check out what happens when I substitute the last line by
DoCmd.OpenReport strReportName, acPreview, , ID = Forms!Evaluationquery!ID
And it still works perfectly.
Now the reason for this is obvious a posteriori. In VBA the embedded SQL WHERE clause is a string, and thus needs the quotes. But nowhere does the example tell you. Nowhere accessible does the help file clearly mention that actions such as OpenRecord only work with macros, and that for code you must use methods of the DoCmd action, or that your field names will always be enclosed in square brackets in macros, but that this is not necessary in code.
This is just one minor example of a most irritating trend which is not confined to Visual Basic, but appears more there. The lack of any book that actually gives you any basic theory. Its as if the language was called Visual Botchit instead of Visual Basic.
I have read through various VB in 24 hours books (it normally takes 24 hours to read the book and another 24 to debug the faulty code samples but thats another story) and yet nowhere is it explicitly stated why this verbose code below
Dim strReportName As String
Dim strFilterName As String
strReportName = Evaluationquery
strFilterName = ID = Forms!Evaluationquery!ID
DoCmd.OpenReport strReportName, acPreview, , strFilterName
is better than the more concise one line
DoCmd.OpenReport EvaluationQuery, acPreview, , ID = Forms!Evaluationquery!ID
I would think this is obvious to nearly everybody on this forum (and is the answer to Weis complaint about VB being verbose) but to the non-programmer trying to get his office app to work its not.
On the VISBAS beginners forum a week ago there was somebody whose code didnt work because he had not used a Set statement. It was completely beyond him why he needed to, until somebody explained it. NOBODY HAD TOLD HIM.
Everybody here complains about having to clear up spaghetti code from the VB-in-24-hours-brigade. But has it never occurred to you that the reason this is so is that nobody has ever told us any better. How can you be expected to comment code when you havent the least idea how it works in the first place?
The purpose of the for dummies books is supposed to be to make you smart. Can somebody, and Joel obviously springs to mind, write a Visual Basic book that is not aimed at ensuring you really are a dummy after youve read it. A book for Visual Basic along the lines of Greenspuns book on database web applications.
When youre cleaning up code in a few years youll appreciate it! |
| Sun 19 Jan | Mike Swieton | This is a big issue with technology in general. It's easy for those well versed in the technology to forget a detail that they've internalized so much that they don't think about it anymore.
This is what seperates good teachers from poor teachers: the good ones know what these details are, and the bad ones just ignore the sticky points like these, because they don't even think about them, and it's automatic. |
| Sun 19 Jan | Alberto | I know what you mean Stephen, likewise, I have the opposite problem, I've been using VB on and off ever since it was invented, so I know it pretty well. I can't find a book at the other end of the spectrum. Likewise when looking up reference books for learning vb.net, all the 1000+ tomes that I read were full of 900 pages of sheer drivel that I already knew ten years ago.
You and me both are in minority markets that book writers don't want to restrict themselves to. |
| Sun 19 Jan | Stephen Jones | 'You and me both are in minority markets that book writers don't want to restrict themselves to. '
Yet if we were dealing with hardware we could buy Scott Mueller, and it would do for both of us. It covers the theory which I want, covers beginners hardware, and has all the details you want. And sells millions of copies.
The problem appears to be most typical of VB. I can find books on database design, networking, hardware, HTML and SQL that do what they are supposed to, and give you the theoretical grounding. Yet VB books are like manuals for an Airfix kit with bits missing and the wrong type of glue. |
| Sun 19 Jan | WNC | This was great reading. Thanks. I like these little stories. It illustrates what I suffer. Finding the right help for my coding problems. Unless I have a genius whose been coding in my language for ten years sitting next to me, I have to *suffer* through my problems reading thousands of pages of stuff that I’m not sure if I need to understand or not to get to the one simple little thing that explains it.
I’m all for books on *any* subject that can give me what I really need to know.
Anyone who wants to invent a knowledge management software system which could actually help someone with a coding problem would be an instant gazillionaire. |
| Sun 19 Jan | Andrew Reid | Hint for buying programming books:
- The thinnest book in the store on the subject is probably one of the best.
- The thickest book in the store is almost certainly one of the worst. |
| Sun 19 Jan | Bella | Thin = http://cm.bell-labs.com/cm/cs/cbook/ |
|
| Rentacoder sites | Sun 19 Jan | Tj |
| Im a bit tired working in IT, and wondering about those rentacoder type sites. Im thinking of working with one in my spare time (as a codemonkey) for fun. Which ones are decent? I only know of two:
http://www.elance.com/
Requires you to pay money in advance, ugh. Only good if youre serious and want a barrier to entry. At least eBay pimps it.
http://www.rentacoder.com/
The only drawback is they encourage buyers to require ownership of the copyright. How many times a day is that violated or worked around? |
| Sun 19 Jan | john galt | I have never heard of anyone getting work of any kind off those sites. If you think the work will come to you; you are mistaken. You have to put forth some effort...there is alot of compettion out there. |
| Sun 19 Jan | Jeff | I've actually done a job on rentacoder. It work out to about $10/hour - but only because I worked *really* fast on the project.
Rentacoder is filled with several types of buyers:
1) People looking to get spam-ware written - cheap.
2) People looking to get a clone of a popular web-site - cheap.
3) People looking to get a clone op popular software - cheap.
4) Students looking to get their homework done - cheap.
The key phrase is 'cheap' - and they get it. If you look at the bids that are accepted on any particular job, it's usually seems to work out to about US minimum wage. Not surprisingly, most of the work seems to go to people working in low cost of living countries.
In a slashdot article that discussed rentacoder, someone wondered why people didn't use it for subcontracting (and pocketing the difference). There were several 'we already do that' replys.
As to the original question of 'The only drawback is they encourage buyers to require ownership of the copyright. How many times a day is that violated or worked around?' - this is a standard part of most consulting agreements. |
| Sun 19 Jan | Curmudgeon | My theory is that ANY work arrangement facilitated via the internet will pay dirt-cheap.
I surfed Rentacoder for a month last summer and came to the following conclusions:
First, the person that posted in this thread that the RFPs on these sites come from bottom feeding clients and students is absolutely 100% correct. The requirements are utterly unrealistic outside the third world. Example: 'we want a clone of Ebay, keep it low, won't go above $2000.' 'Make us a clone of Ms-Word customized to the pet mortuary industry, and we need it by March 1.' (this being Feb 25, for instance)
Secondly, many of the a-holes posting projects on these sites (I call anyone who wants the moon for $3.50 an a-hole, sorry!) generally list HUGE sets of prerequisite experience for anyone bidding. IE: 'must have verifiable PICK BASIC, VAX PL/1, and HP3000 SCHEME experience. Must send in three complete project source code sets from past projects. Must speak fluent Basque. Must possess copper based blood and pointed ears.'
Thirdly, the projects that are at least remotely, conceivably doable by a real, existing developer usually already contain 20-30 or more bids, usually by work for food offshore types posting huge, rambling, polysyllabillic, alphabet soup skilled, generic boilerplate responses. These offshore places all make it sound like they have a team of 20 PHD level people that they will throw at a $500 project for a month.
I think Elance and Rentacoder, among others, are cruel practical jokes on the developer community. Maybe 'The Onion' is behind both of them... Don't waste your time, except for an ironic laugh. |
| Sun 19 Jan | Boris Yankov | Both RentACoder and eLance are serious sites.
But there is one simple thing: they are tageted towards offshore developers.
If you are in USA or similar rich country you just woun't earn enough.
I am from Bulgaria and I must say that working for RentACoder I could raise my income very seriously (quitting from my job).
When going to such sites you have to accept that you will be competing with hundreds of indians (no offence at all). So you will have to provide either lower prices or better quality than the average (which I choosed).
If you are very good I suppose that you can earn something between $1000 and $2000. No more. And certainly often less. If you are in a poor country this is more than enough. If you are in USA just don't bother looking at these cites. |
|
| Theorems and proofs... | Sun 19 Jan | Warren Henning |
| When studying a computer science book, how important is it, in everyones opinion, to carefully read and understand the proofs of theorems?
Is it sufficient to only understand the theorems and their implications (how they are used and so forth)?
I guess the answer depends on ones intentions -- for the moment, Id like to simply be able to write programs well.
I guess the more general question I also have in mind is: Is it feasible or worthwhile to teach oneself large amounts of computer science material? Can you really be self-taught?
Sometimes I feel like Im wasting my time with these books. |
| Sun 19 Jan | Leonardo Herrera |
My advice: think of your computer classes as 'mental fitness.' |
| Sun 19 Jan | Warren Henning | I don't have any classes (I wish I did).
Right now, it has to be independent study. |
| Sun 19 Jan | Anonymous Coward | If you read and understand the proof you will remeber the theorum forever and solve similar problems in the future.
If you do not then you do not 'understand' the theorum at all, you have memorized the result and will forget it. Further you will never solve any similar problems.
In thr real world case is ever like the any theorum, you need the experience of proving theorums in order to solve the real case from basic principles. |
|
| SourceForge Enterprise Edition | Sun 19 Jan | Richard Caetano |
| Has anybody had an experience with SF Enterprise? Im interested in learning more about if for our IT dept. |
| Sun 19 Jan | Jan Derk | I would like to add a second question to that: Did anyone try or does anyone use GForce?
http://gforge.org/
It's an open source fork of the now closed source SourceForge and created by Tim Perdue, the same guy that was standing at the roots of SourceForge. |
| Sun 19 Jan | do it! | I have been a _user_ of sourceforge inside a corporate setting (don't know if it was particularly Enterprise or anything, this was a while ago) and a _user_ of the real live sourceforge.net. And it looked the same.
More important than the software itself (it obviously does work, and does scale well, although how 'hairy' it is behind the pretty webpages I don't know) is it's roll.
The openness and teamwork it fosters is very valuable. From being in a very closed team with in corp to being in the same corp looking and sharing code with other teams, it was like walking out of a prision into the light after a long time in solitary confinement! |
| Sun 19 Jan | Jeff | My previous company (before being laidoff) was looking at SourceForge. IIRC, the per-seat licensing fee was relatively high - especially since there are several projects that took the last open release and have progressed from there.
Jan mentioned one, another is Savannah from the FSF. Its site is at http://savannah.gnu.org/ |
|
| Windows XP is not an operating system | Sat 18 Jan | HeyMacarana |
|
http://www.pbs.org/cringely/pulpit/pulpit20030116.html
Cringelys true ignorance is beginning to show.... maybe he should stop pretending he understands techie stuff and go back to flying his old planes. |
| Sat 18 Jan | Raist3d | Wow.. I am surprised at this article... anyone else has any thoughts?
He kind of gets it right until you get to NT/2000/XP
- Raist |
| Sat 18 Jan | anonymous | I'm not a fan of MS, but this article is pure ignorance. It would be like claiming Linux isn't a real OS because of bash (yes, I know Linux is really just a kernel, you know what I mean). I don't see what they would gain by porting to Linux (nevermind how it would even be possible). Linux is certainly not the best example of a secure open source/free operating system. |
| Sat 18 Jan | Nick B. | Gee whiz, just replace the core of Windows XP with Linux. After all, Windows XP isn’t an operating system …
Cringely unfortunately claims to know more about the architecture of NT/2000/XP than he really does, and I can’t even fathom where he gets some of his ideas. And then he writes an entire opinion piece based largely on his own misunderstanding! Was it a joke??
He’s kind of like that character Gilda Radner used to play on Saturday Night Live; they both get all riled about something they misunderstand in the first place (I personally think Gilda Radner was funnier). |
| Sat 18 Jan | WNC | I won't pretend to know anything about XP architecture or even that much about Linux architecture. But it sounds like a good idea. Consider this: Microsoft and Apple used to be enemies. Now MS makes a version of Office that runs on Apple’s OS. Why not make a version of Windows that runs on Linux? They don’t have to give up their other OS products and they expand into a new market! Granted most of the flaming Linux fans I know hate MS and Bill with an unreasonably fervent hatred, but all those businesses that are supposedly moving to Linux might be customers. It’s like IBM buying Rational Software. Or a publisher selling the Koran and the Hebrew Old Testament. Or it might be a reason I'm a broke thirty something fat guy and Bill is a Billionaire. |
| Sat 18 Jan | Brian R. | As an idea, the article is interesting.
However, am I supposed to visualize lots of COM servers running behind the 'windowing' all on top of Linux. This strikes me as bizarre. I would think the Microsoft OS has functionality built-into or ontop of their OS that makes their applications profit as such.
If this is the case, then isn't a 1000 lb. gorilla, being placed ontop of a bending branch? |
| Sat 18 Jan | Chi Lambda | No, no, no. Make MS *Office* available for Linux! |
| Sat 18 Jan | Curmudgeon | I'll be the contrarian here. I don't have a lot of heartburn with Cringely's article. Yeah, it's a typically glib op-ed piece about fairly deep technological and architecture issues, but he's basically right. He just leaves out the total rearchitecture of *everything* that would be required to implement his vision.
What the *public* generally perceives Windows to *be* is the GUI system, period. The guts aren't really important to most consumers. So from a marketing standpoint, it could (in another universe!) make some sense for the GUI system to be unbundled and sold in OS specific incarnations: Linux, Solaris, QNX, whatever.
IE, slap the Windows GUI onto Linux and you have an easy to use, Win32 compliant system (with the help of a glob of code similar to Cygwin but going in the other direction bundled into the thing, of course.... :-) )
However, that last aspect is what brings the fantasy crashing down to earth. Windows (the entire product as we know it today in our universe) sort of mooshes together the windowing system with the OS. It's assumed you will always have a display. IE: writing an NT service is a special case of application, and is harder to do with most languages than developing a straight Win32 GUI app. A blue screen in a screen driver in NT can bring the OS to its knees. (since I've rarely heard of many blue screens in 2K or XP, I will defer to someone else's experience.)
So the foregoing vision implied by Cringely REALLY isn't practical. Mainly, the massive Win32 API plus all the subsystems such as COM, etc that comprise Windows as it is known today prohibit this from happening. And if you did carve out a huge chunk of Windows and make it a layer atop Linux (for instance) you would wind up inheriting most Windows behaviors anyway.
But if it *were* possible, it would make some sense and be kind of cool. |
| Sun 19 Jan | WNC | MS Office for Linux. That's a great idea. It would cost a fortune. It would legitimize the Linux OS in the minds of many businesses. That is probably why it won’t happen. |
| Sun 19 Jan | Wayne Venables | Cringley seems to miss the point that without the Win32 subsystem, the NT kernel is a awesome piece of engineering that quite probably IS better than Linux. |
| Sun 19 Jan | Eric | Ho ho, that was fun.
Im no MS fan but I think the 2k/XP kernel is actually pretty good. Also, one of MS' big competative advantages is the fact that everything x86 has win drivers.
The reasons for using Nix IMHO has more to do with the loads of useless crap being piled upon the avrage windows install rather then any real problems with the kernel. |
| Sun 19 Jan | Stephen Jones | The vice-rector at my college once told me that the reasons the machines in some labs kept crashing wasn't to do with age, viruses, or deletion of system files, but because the students kept changing the screensavers!
Critchely's 'Windows is the GUI' is at the same intellectual level. |
|
| C++ == Crap | Sat 18 Jan | anon |
| In another thread, Curious points out the following:
Nobody has problems with pointers in general, Everybody has problems with C/C++ pointers in particular.
Bravo, Curious!!! Im glad someone had the balls to say it. The hipsters who designed C and C++ were utter retards. Theyre so proud of their little minds that devised a language with so few keywords! That because everything in the language is overloaded in fifty different retarded ways. (=0 means purely abstract class!?!? Thats *really* intuitive. But, hey, that hipster didnt have to add a keyword!!!)
Youre absolutely right, *nobody* has a problem understanding pointers, its the idiotic syntax of that ridiculous language that makes it a difficult concept. When I was learning C++, I cant tell you the number of times I had to look up what things like char *( *(*var)() )[10]; meant. Is it because I couldnt grasp the concept of pointer? NO! My mind can wrap around things like algebraic topology quite nicely, so Im gonna say that pointers arent over my head. Its because Ritchie and Stroustrup are imbeciles. What sort of retard would decide to overload the indirection operator to also mean reference?!? The two concepts are close enough in meaning that it almost seems like Stroustrup did it with the intention of making it difficult for beginners.
Lets face it. Thats exactly what it is. People with small brains love the fact C++ has an artificially high barrier to entry. This means that they can have jobs. If languages were easy to use, only intelligent engineers would have jobs - having a retarded language like C++ means that idiots, too, can have jobs because they memorized the unnecessarily convoluted syntax.
By the way, would someone please tell me what was going through Ritchies tiny little brain when he decided that making a languge case-sensitive was a really *cool* idea?
Long live Ada! |
| Sat 18 Jan | Do you hear the four horsemen? | Heh. Venting a little? Personally I love C++. |
| Sat 18 Jan | tired of PHP's case-insensitive function names | 'By the way, would someone please tell me what was going through Ritchie's tiny little brain when he decided that making a languge case-sensitive was a really *cool* idea?'
What's essentially wrong with that? Isn't this a feature that forces you to be more explicit when coding? The basic syntax of the code will also look approximately the same to someone different who's working on your code. Also, that allows for more identifiers in the appropriate scope, though you could argue whether an API which maps 'isSet()' and 'isset()' to different methods is a good designed one... |
| Sat 18 Jan | WNC | Let me guess... you're working on a C++ project for a university class and the deadline is approaching? |
| Sat 18 Jan | Sammy | Just wait until your computer architecture/assembly language class! |
| Sat 18 Jan | crusty admin | Correct.
Because those languages are poorly designed also leads to the plethora of buffer overrun bugs we see in both Unix and Windows. |
| Sat 18 Jan | Curmudgeon | C++ is a 'systems' language. It's an OOP artifice overlaid on the lowest possible level of language abstraction, namely C, that allows the programmer to know roughly what the machine level consequences of his/her actions are given most language statements. In other words - you can't predict what your code will compile to (assembly language wise) in most language environments that have late binding, garbage collection, etc. In C and in C++, you can. In my thinking, C++ is basically assembler wrapped up and presented in some VERY deceiving macros...!
I believe that C++ has been grossly misused as a general application development language in industry. Something higher level, be it Delphi or VB, should be used for most applications instead of C++. IE: you 'should' develop the core of a database engine or a language processor or a component in C++. You 'shouldn't' develop a billing application in C++.
In short - I share your apprehension re: C++, even though I have developed many commercial projects in it. It's a risky pitfall filled tool.
Oh, yeah. To address your problems with pointer expressions some people use: there are MANY macho d*ckheads running around this industry whose little pet 'hazing' exercize with hiring candidates is to give the candidate some stupid assed 5 level deep indirection involving pointer arithmetic. Managers who hire candidates via such tricks should be slapped around and humiliated... |
| Sat 18 Jan | Nick B. | Buffer overruns don’t occur because C++ is poorly designed. They occur because of programmer error. |
| Sat 18 Jan | Raist3d | 'What's essentially wrong with that? Isn't this a feature that forces you to be more explicit when coding? The basic syntax of the code will also look approximately the same to someone different who's working on your code. Also, that allows for more identifiers in the appropriate scope, though you could argue whether an API which maps 'isSet()' and 'isset()' to different methods is a good designed one... '
I am going to have to somewhat agree with the original poster on this. The mere fact that different identifiers can be spelled the same except for their casing I think can make for quite some confusion.
'Buffer overruns don’t occur because C++ is poorly designed. They occur because of programmer error. '
Well if a language allows you to commit more of the same error by mistake then I would count that as a strike against the language when comparing vs a language that in its syntactic grammar and consequential idioms prevents the mistakes in the first place. Not saying with this if what I said applies to C++ in this particular case.
In my opinion, I have grown to like C++ becuase of the control it gives you. And at least for console game development (and I suppose embedded systems) it is quite nice.
What I I would really like though is that the language is 'cleaned up' so that idioms that are known to be harmful are at least not encouraged. Also common 'support code' that many do should be either made into a standard framework or make the language provide more robust support on it.
I realize that many of the C++ annoyances is because wanting to make it backwards compatible with C. I would be all for considering breaking such compatability although I realize this solution won't suffice in a lot of environments.
Before someone says Java or C# let me still say that what I want wouldn't necessarily conclude Java or C# is the solution given C++'s efficiency in memory and degree of control - for the domains I am thinking about.
(but yeah, if I could help and could be easily done I rather program in Java or C# in my main job)
|
| Sat 18 Jan | Halfway Coder | If you think Delphi (object Pascal) and C++ are all that different, I doubt you have a great deal of experience coding in either one. They are very similar. What goes on under the hood I wont pretend to understand, but the actual use of the language (syntax, etc.) is not all that radically different. So, you are either a) ignorant of one or both languages or b) such a flaming genius with compiler issues and machine language that you ought to write your own compiler. |
| Sat 18 Jan | Curmudgeon | Halfway Coder, you obviously fit the role of sniveling coward trolling for a fight on the internet with someone that had no quarrel with you.
I find Delphi and C++ extremely similar in terms of the language itself, but vastly different in terms of the support for GUI and 'normal' application development when it comes to writing an application that a user can interact with. The VCL concept isn't found in any way, shape or form in C++ (w/ the exception of C++ Builder which is C++ on Delphi). That, plus Delphi's inherent support for string data types, is what distinguishes Delphi for most application development.
Oh, yeah, I have developed several shrinkwrap applications in Delphi, including the migration of a company's product line to Delphi. As well as similar 'feats' in C++.
Now, if you want to continue to debate God knows what point, post code snippets here to discuss. Or stuff it.
See you in your parent's basement, junior... |
| Sat 18 Jan | Halfway Coder | Curmudgeon,
sniveling? I have no respiratory ailments.
coward? How am I a coward? Bravery has nothing to do with coding.
trolling for a fight? I picked a fight with what you said and made it personal, that was in error. For making it personal, you have my apologies. But I was not “trolling” for a fight.
You might have a point about VCL.
Since you say: “I find Delphi and C++ extremely similar in terms of the language itself”
I see no point in posting code snippets. Debate has ceased.
I think you ought to post some more substantial proof of the poverty of C++.
I’m older than you might think. |
| Sun 19 Jan | Curmudgeon | Halfway,
On the personal issue - apology accepted.
In the future - don't mistake experience and insight for arrogance, which is exactly what you did. This connection that you inferred caused me to in turn suspect of you (as is generally the case with others, I've found) jealousy caused by personal insecurity on your part. True? I dunno. Work on it. (It just never ceases to amaze me, the truly stupid s*** that some people in this industry use to distinguish friend from foe... such as programming language affinity and opinions on technology. Life's too short.)
Anyway - I do not infer 'poverty' in C++ - if you're looking for that, you didn't understand what I wrote. C++ is a vast, rich language that is immensely more powerful than makes sense for the uses that it is commonly put to in industry. I think what the original post was really complaining about was the overcomplexity of most people's implementations in C++. There are so *many* ways to do things in C++, including overloading, virtual functions, and multiple inheritance, all of which can confuse a code designer, that many (most?) people get lost in the nuts and bolts.
C *is* close to machine language. How? You can use most compiler's 'asm' directive to dump the assembler output, and one can then observe, for instance, how local variable are allocated from registers or on the stack. In general, it's possible to tie C variables to memory locations, somehow. For just one example. And C++ is just C with a *lot* of name mangling added.
On language similarities: I have a few friends that are 'stuck' in Delphi. I've unsuccessfully tried to persuade them that learning C++ would not be a huge conceptual barrier and would greatly increase their marketability. However, none of them have taken the bait. Go figure. |
| Sun 19 Jan | Sebastian Wagner | 'And C++ is just C with a *lot* of name mangling added.'
Dead wrong.
There is a book by Stroustrup (I haven't the exact name right now) about the design of C++. All the points raised in the initial post are covered there. No, Stroustrup is not an idiot. No, I don't say you are too dumb to 'grasp' it. The pointer example you showed is an example of bad programming. Mighty tools give freedom to bad programmers as well.
It's hard to learn C++ because of the interdependencies. For example lots of things start to make sense only once you get into Generic Programming and templates.
Yeah, C++ is a systems language, it may be a good idea to combine it with some other, safer language, just the way Joel does (C++ for the core, interface and business logic with VB). |
| Sun 19 Jan | anon | The book you're talking about is 'The Design and Evolution of C++' by Stroustrup. I used to get very frustrated with the language until I read this and realized the rationale behind some of the design decisions. |
| Sun 19 Jan | Leonardo Herrera |
I would like to add something to the original post: Stroustrup (and Ritchie, given the fact that you mentioned him) are smarter than you.
Regards, |
| Sun 19 Jan | Nat Ersoz | Sounds like our little Ada programmer is having a bad day with pointers. Golly.
When was the las time:
1. You saw an operating system written in Ada?
2. You say a device driver written in Ada?
3. Anyone wrote a project in Ada that wasn't a government contract?
Has the entire world gone mad?? What is all this C code crap running amok all over my machine? What idiot wrote this? Where is my beautiful wife? Where is my beautiful house? |
| Sun 19 Jan | Fly on the wall | Wow, what a great thread.
Everyone is shouting at the top of their lungs about the one true take on C++. Everyone posting here is wiser and more insightful and more wonderful than the next guy. The other guy's opinion is always invalid or incomplete. Any summarizing comments are dismissed as complete ignorance. People's positions on technology are being taken as indication of their worth as human beings.
No wonder most companies cordon off hard core technology people as interpersonally repulsive and put them in their own sandbox to duke it out... |
| Sun 19 Jan | brought to you by the letter m | Fly on the wall == Crap |
| Sun 19 Jan | Curious | Well, the aim wasn't to call the Bell Labs staff names, or to
scare away the non-techie population. There is a point
here about the burdensome nature of C/C++: Using these
languages is in itself a herculean labour, in addition to the
unrelated task of programming.
People use C++ mainly, I think, for backward compatibility
reasons because there is so much of it around, dating to
the 80's. And I think it was adopted then because it was
more-or-less compatible with C, and there was a lot of C
around by that time. There is no discernible good reason
for why that happened, except perhaps C was easy to
write compilers for, especially on smaller machines
('worse is better').
C is actually a very bad language for systems programming
because while it provides the user with a lot of freedom
(by not including sophisticated or restrictive constructs)
it provides the user with very little power. The very absence
of limitations that supposedly make C 'powerful' means
that the compiler cannot provide the programmer with any
high level guarantees, such as performance properties,
graceful failure, proved correctness or optimizations. There
aren't even any standard datatypes for things like Bytes or Characters - everything right down to sizes of types and
error handling behaviour are 'compiler dependent'.
This is why I disagree with ideas like 'delphi is like c++' and
'syntax doesn't matter'. Pascal is an inherently more
powerful tool than C, and if the same compiler is presented
to a user as a Pascal compiler he will be more productive
than if the very same tool is presented as a C compiler
(By the way, Delphi and C++ Builder are the same compiler
backend).
This weakness matters whether one is doing systems or
applications programming, and I can think of many systems
written in higher-level languages - the Crash Bandicoot playstation game was written in Lisp, the Cornell UNet
networking stack was written in OCaML, and of course
US military projects are written in ADA. I have never heard
of either Crash Bandicoot or the Space Shuttle having a
Blue Screen Of Death, and I think there's a lesson here.
Maybe the previous posters could have been more polite,
but please excuse them: they're venting because they are
being forced to use an inadequate tool by accidents of
history and economics. One may use C or C++ not because
it is good for one's task, but because of legacy code or the
lack of other compilers on one's target platform. |
| Sun 19 Jan | brought to you by the letter m | So this is the forum where all the VB coders that don't 'get it' hang out! Get out of the industry people, you're dragging the rest of us down. |
| Sun 19 Jan | Curious | Dear 'brought to you by the letter m',
Quite apart from my functional, database and applications
experience (using things like Miranda, Java, MatLab and
SQL, and NO Visual Basic), I have programmed embedded
controllers in 68HC11, 68000 and MIPS assembler, and
synthesized chips in VHDL.
So while I am pretty sure I get 'it' (low-level coding)
better than you, you're right that I have difficulty 'getting'
C++, just *possibly* because of the reasons I listed above
and to which you did not respond at all.
Had I made an error you could have pointed it out to me.
Instead, you seem to be posting exclusively ad-hominem
attacks, so I suspect you are trolling to provoke the readers
of this board. |
| Sun 19 Jan | WNC | It seems like an impossible argument to win or lose. Unless one argues over false statements made by the proponents of one side or the other or unless one attacks the persons of one side or the other. To say that C++ and Delphi are the same is absolutely false. Paste code from one editor (say Builder) to another (Delphi) and it wont work. To say they are similar is a matter of extremely subjective argument. It is also subjective to say that one is better than the other. I have heard this argument (Delphi is better than C++) from the first time I actually was interested in software development about ten years ago or so and it still sounds like a completely impossible argument to solve.
I myself- who have coded in both C++ (which is really object C) and Delphi (which is really object Pascal)- do not know which is better. I know which I prefer, but that’s another matter.
Those who value economic arguments might say C++ is better. This is a very strong argument for any economic conservative. Just think of the wealth Bill Gates & Company has harvested from C/C++.
I imagine that much of the argument comes down to *how* each language is and has been used by a particular debater. And might even be simplified to “What language a particular programmer likes best.”
The question “Which language is better, C++ or Delphi?” can not be quantified. Other than to point out the different syntax for loops, data types, etc. in each language. Therefore, for true scientists, it can never be solved. For the religious, it is merely a matter of deciding what the appropriate book of revelation has to say on the matter. For my religion, I see that it says nothing whatsoever about it, so I remain an agnostic on the question. |
| Sun 19 Jan | brought to you by the letter m | 'I have programmed embedded
controllers in 68HC11, 68000 and MIPS assembler, and
synthesized chips in VHDL.'
My god. Yet you still don't get 'it'. Pity the people that have to maintain your 'low level' code. |
| Sun 19 Jan | brought to you by the letter m | 'I have never heard
of either Crash Bandicoot or the Space Shuttle having a
Blue Screen Of Death, and I think there's a lesson here.'
The lesson: Dumb people are better served using languages that have been dumbed down for them. |
| Sun 19 Jan | Dan Maas | I agree that Stroustrup presents convincing support for the complexity of C++ in 'Design and Evolution...' But if you then read a book on say LISP or Python, you very quickly start questioning whether all that complexity is really necessary to achieve the same things as C++.
e.g. why does C++ need the STL - which is hard to use and VERY hard to implement well - to do the same things that LISP/Perl/Python etc. do with their simple runtime libraries?
Here's another example - yes it is 'cool' that the programmer can define a new value type in C++ (i.e. a class that meaningfully supports copying and operators). But this one feature brings in a TON of complexity (e.g. unwanted copy constructors and assignment operators, and the near-impossibility of fitting a garbage collector to most C++ software). And then you ask yourself, what is this feature used for in the 'real world'? Umpteen billion different 'string' classes. What else? Not much. (And IMHO C++ would have been a much nicer platform if strings had really been part of the runtime...). I know there are science and graphics users who appreciate having value-type 'vector' classes (I'm one of them), but really this is too much of a minority to justify such a monstrous language feature.
In summary, I think the designers of C++ were too focused on the principles of 'make and check everything statically - do all the hard work at compile-time - require as little support as possible from the run-time library.' e.g. The STL is what you get when you try to implement generic data structures with no runtime library. It works, but it's a monster.
I think the 'do everything at compile-time' approach also led to C++'s mismanagement of headers and long compile times, but I won't get into that rant.
One thing I do credit Stroustrup for was introducing execptions (with automatic stack cleanup) into the C language framework. I believe this is a fundamentally superior approach to error-handling, and it's the feature I miss most when using plain C (in fact I can't live without it, so I wrote my own stack-cleanup framework for C...). Kernighan and Ritchie seem to have been feeling around this - I consider 'errno' to be a distant echo of some attempt at non-local error handling - why don't UNIX syscalls return the actual error code rather than -1 and setting errno? Yet they stopped short of actual non-local exceptions. |
|
| SQL Schema to XML Schema? | Fri 17 Jan | theITguy |
| Is there a tool that will take a typical SQL schema (Oracle, in this case)
and do a best pass at generating an XML Schema? |
| Fri 17 Jan | Hasan Basri | umm.....what? |
| Sat 18 Jan | Danilan | What I did for some DB synchronization tools I had to implement is to read the system tables and create an XML file. I am not sure but it might be possible to dump a XML schema directly from Oracle. |
| Sun 19 Jan | RB | So far, I've never seen an automatically generated xml schema that didn't completely suck.
You're better off hand coding it. After you do a couple, the rest flow pretty easily. If your database design is logical, you can often cut'n'paste parts of the schemas.
Plus, after being at the coalface, it's far easier to then write code that imports/exports xml to/from the database (assuming that's your goal). |
| Sun 19 Jan | theITguy. | thanks, I've been doing it by hand, and it is relatively straightforward, but the data model is HUGE. i've got some emacs macros to assist me, but it still seems hugely tedious for a data model of non-trivial size. i'm going to grab a copy of 'xmlspy' to see if that can help me. anyone used xml spy for this purpose? the goal/purpose is actually have to produce an XML model of our data for a due dilligence review, etc.... sigh. |
|
| Safari | Fri 17 Jan | pb |
| Two thoughts related to Apples Safari launch:
1) Safari is currently a very trimmed down, feature-lite app that has received a substantial amount of praise from early users. Is this an example of application bloat really not being necessary (i.e., as opposed to Joels contention that 80% of the users use 20% of an app but its a different 20% for each user)?
2) Ive read a number of posts here from engineers looking for projects. Heres a no-brainer: port Safari/KHTML/Konqueror to Windows. Granted its not a weekend project, Ive seen small groups of engineers do some pretty amazing things. I wouldnt be surprised if such a product, well done and with one or 2 features missing from IE, could be sold to 1 million people at $25/per. |
| Fri 17 Jan | Bryce | Safari is not open source.
Konqueror's dependance on Qt makes a Windows port extremely difficult. Qt is highly portable, but the Windows version is not GPL compatible.
Apple has already done the heavy work in abstracting Qt from KHTML, a Windows port is underway.
http://khtml-win32.sourceforge.net/ |
| Sat 18 Jan | Martin Schultz | Look at the phoenix browser. Its allmost the same just based on mozilla instead of KHTML.
http://www.mozilla.org/projects/phoenix/ |
| Sat 18 Jan | BDKR | One thing is for sure, Konqueror (Safari) is much faster than Mozilla, Galeon, and Phoenix. Also, they're getting their act together in the rendering department (It was horrible in the past). Mozilla based stuff is great, but better have something greater than 600 Mhz to fend off that sluggish feel.
On Linux, Opera is King. |
| Sun 19 Jan | Martin Schultz | Pheonix seems fast on a 300 mhz machine here. And opera seems to crash to often on my linux machine. |
|
| Updated Software Engineering Course | Fri 17 Jan | Adam Young |
| Im picturing an updated software engineering course that covers the topics of the past decade:
The course would be split between lecture and lab time.
1) Extreme programming: Explain Unit Tests and Pair programming, code standards, etc. Small programming taks can be assigned during labs, and partners rotated often. Lab consists of a Graduate Student Instructor playing the role of the Client, helping the team come up with one short story to be implemented during the lab
2) Refactoring: Lectures cover the refactorings themslevs, with homeworks to refactor small chunks of code. This could be like math problem sets. A lab could have the team wokr on a larger refactoring of a real piece of code (I have several I am willing to offer ;)
3) Design Patterns. Once the class is comfortable with refactoring, Design patterns would be introduced. I like the industriallogic.com ordering. Students would be encouraged to form study groups.
4) Refactoring to patterns: A set of programming problems would be analyzed in lectures showing how the code could be better structured using design patterns.
5) Use acceptance testing: The studesnt would switch roles to be the client. In several media, the students would work through automating acceptance tests.
6) Optimization: Students are taken through optimization issues on several platforms, from Database queries to embedded applications. The practice of profiling and optimizing would lead, followed by a cross section of the skills to optimize. The use of design patterns for effeicincy would probably be covered here as well.
7) Code analysis: This is where students have to read prexisting code, and come up with ways of understanding it. Reverse engineering using tools like UML/ERD diagrams, notation.
Obviously there would be quite a bit more here, but I think quickly you would find that you needed to prioritize and only teach what could fit in to a semester course.
Any thoughts? |
| Fri 17 Jan | z | Seems like a rather odd collection, rather than being a coherent plan of instruction in software engineering. It's sort of a 'Topics in SWE' course. |
| Fri 17 Jan | Adam Young | Well, I have to admit I brainstormed as writing; I wanted to get my thoughts down and organized. However, these are thetechniques I've found most valuable in Software Development over the past couple of years, and I think there is a coherent, thread betwen them. I know a few people that are attempting to document this (Future Addison Wellsey Books). But yes, the organization needs work.
One other Item I'd probably want to work in there somehow is generation of documentation from code: Javadocs, perdocs, Doxygen.
The end produt I would see being a project for a small team. Class members submit project suggestions. I your project gets selected, you get to play the role of customer, Otherwise, you end up on a team implementing. |
| Fri 17 Jan | Bob Greene | Requirements gathering. |
| Fri 17 Jan | David Clayworth | Sounds interesting, but I can't see that Design Patterns or Refactoring warrant more than a lecture or two each. I would hope that most SE courses are doing Acceptance Testing and Optimization already (or maybe I'm too optimistic).
I would think most Universities are leaving XP until they can be sure that it will still be around five years from now. |
| Fri 17 Jan | Adam Young | It would take 5 years to get most univerisits to change their curriculum.
In my Software Engineering, we learend Object Oriented Design using Grady Booch's Method. In Ada. It was a fairly recent concept (back in 1991) that came out of industry.
As for requirements gathering, I would be interested in how you think that should be taught. |
| Fri 17 Jan | schooled | I learned all of this stuff on the job, whilst being paid to do it. Why would I want to pay for a course to do the same thing? |
| Sat 18 Jan | ODN | Martin Fowler's book 'Patterns of Enterprise Application Architecture' is what I wish I had a general feel for back in my school days. I just felt like I had no realistic idea what most programmers did. I just couldn't believe that most programmers were writing compilers, crafting better algorithms, building better AI, and doing embedded work in assembly language. Fowler's book maps out the territory of what I consider meat and potatoes programming in 'the rest of the world.' |
| Sat 18 Jan | ODN | And I disagree with the poster who feels design patterns only warrant a lecture or two. I would have benefitted greatly from a semester devoted to the GoF book, combined with the Fowler book. These should be presented as depth concepts, not breadth. Patterns need to be internalized far more deeply than say sorting algorithms. |
| Sat 18 Jan | Sammy | don't be such an idiot, schooled.
it's not that -you- would pay for it, it's what does the person doing the hiring wish that the new grads already knew. |
| Sat 18 Jan | Jonathan A. | It'd be amazing if they taught something that you could directly use. I just graduated not too long ago and they never mentioned design patterns or refactoring or anyting like that. I had learned and used them on my own but not because of school. Granted, I wasn't a CS major, but I did take some programming classes that dealt with database programming and even OO.
I'm still in my college town. I wish they would teach a good SE course like we are talking about here that Alumni could go take. |
| Sat 18 Jan | Pavel Levin | This course sounds more like Software Buzzword Engineering to me. |
| Sun 19 Jan | Giovanni Corriga | Your course seems more an 'Applied Software Engineering' course than else, but nonetheless, I would be the first to attend.
In my university ( http://www.unica.it ) we do have a course where XP is teached (on par with Smalltalk), but both Refactorings and Design Patterns are just hinted. I had to learn Patterns by myself, and to bug my teacher till he let me attend a tutorial on Refactoring by Fowler himself.
Also, my final ssignment for that course was to build a web tool for managing an XP project, using an XP process. |
|
| Turf wars and Mouth Wide Shut | Fri 17 Jan | IanRae |
| Joels article presents a strategy as the right one, but I think he is making a virtue out of a necessity. It really depends on the company. Business is like a turf war, and what you do depends on how much turf (market share) you own.
Big companies own a lot of turf and are generally in a defensive posture, protecting their market share. For them, pre-announcing features is beneficial. People are buying their product *because* its the market leader; features are not a primary buying criteria. Secondly, as market leader people are more likely to pay attention to an announcement. People expect the market leader to make a lot of noise; hence a steady stream of announcements about up-coming versions, strategic partnerships, etc.
Small companies dont own much turf and therefore need to take an offensive stance. And for offense, surprise is a key tactic. They know that innovations are easily copied, especially in software -- look how fast IE caught up to Netscape. Also, small companies come and go; their announcements are not taken with as much weight.
So, for small companies, Mouth Wide Shut is a good strategy. |
| Fri 17 Jan | Danil | Townsend has some good things to say about this in _Further Up the Organization_ |
| Sun 19 Jan | Leonardo Herrera | 'People expect the market leader to make a lot of noise; hence a steady stream of announcements about up-coming versions, strategic partnerships, etc.'
BigCo's also use this noise to increase their stock market value. |
|
| Pointers for dummies | Fri 17 Jan | Better than being unemployed... |
| I was just discussing with a coworker the article Joel wrote some time ago about for some strange reason, most people seem to be born without the part of the brain that understands pointers.
I think Id like to add to that : And the people who are born with the part of the brain that understands pointers cant explain it to them.
I cant actually put my finger on any point in time where I thought Yes, I get it. This is what a pointer is. It just sort of happened, really. I tried thinking of an analogy whereby if you imagine the memory to be a large block of pidgeonholes, each with a bit of paper in it, the pointer is the pidgeonhole and the value dereferenced by it is the paper ... but that doesnt really explain it well enough.
Just wondering if anybodys got a good way of explaining pointers to new programmers - or, indeed, if there even _is_ a way. |
| Fri 17 Jan | Rick | You're on the right track.
Honestly the best way to teach someone pointers is to teach them about what microprocessors do. I'd wager there aren't many electrical engineers who do programming work for a living that don't understand pointers.
At least one assembly course should be mandatory for everyone. This is why I laugh when I hear people say Java doesn't have pointers. LOL. In Java, EVERYTHING is a pointer. |
| Fri 17 Jan | Yves | I think you're almost there with your pidgeonhole analogy. I'd add that the pidgeonholes are numbered. When you know a number, you can look in the corresponding pigeonhole and read what's written on the piece of paper inside.
And the clever bit is that the piece of paper can have the number of another pigeonhole written on it.
No need to delve into microprocessor architecture. Even my mom's gardner can understand this! |
| Fri 17 Jan | Beth Linker | Having some period of time where you don't really get pointers is part of being a new programmer, I think. One may think that one understands the general idea, but that's not the same as being able to use them well. Ultimately, you have to learn by doing and it can be a slow process involving lots of bad code.
If I were going to explain pointers to a new programmer, I'd probably start by describing memory as a set of boxes that contain values, and pointers as address labels that refer to the boxes. Then I'd run them through some simple examples to illustrate the difference between an integer and a pointer to an integer. |
| Fri 17 Jan | Karel | I would start with the true nature of variables
Variables
Variables are characterized by
· name/identifier,
· address,
· value,
· type
Name gives a label to the memory cell so we may refer to that cell. After all we cannot refer to anonymous things. This is an important principle.
Address identifies the position of a memory cell in a collection of memory cells. Address makes the memory cell randomly accessible i.e. we can access the memory cell directly. We do not have to search sequentially through memory until we locate the named cell, because the named cell has an address.
Value is the content of a memory cell.
Type informs us how to interpret the content of the memory cells. |
| Fri 17 Jan | Practical geezer | Karel,
You are correct of course, but you say “I would start with,” and then you don’t finish.
Care to finish what you started :-) |
| Fri 17 Jan | Just me (Sir to you) | I never got what there is not to get about pointers, so I guess this will exclude me from being a good mentor? |
| Fri 17 Jan | Karel | Lots of ways to continue if not finish:
realise that in scripting languages the runtime will interpret the value by implicitlyconsidering the type
realise that using variable name on RHS means value, using variable name on LHS of assignment operator means means address
naming principle scales up - normailize for commonality by giving names to common things and reference them : repeated expressions are assigned to named variables and the value referenced by saying the name of the var; common statements are assigned to named functions and and their effect referenced by sayng the function name etc. |
| Fri 17 Jan | Danil | http://www.sabian.org/Alice/lgchap08.htm
`I was coming to that,' the Knight said. `The song really is 'A-sitting On a Gate': and the tune's my own invention.' |
| Fri 17 Jan | anonQAguy | Better than being unemployed -
Good analogy. Reading it made me think of this extension for times when you might need to explain what pointers can be good for:
Imagine the little bits of paper all piled on the table, not in the pigeonholes and you have to put them in some kind of order--there's going to be a lot of physical paper shuffling. Now that they're in order, say you want to add and delete some of the pieces of paper...more shuffling.
Then contrast that to the situation with all the pieces of paper back in their little numbered pigeonholes. You still need to read the papers, but now you can just trace a path among the pigeonholes and you don't have to move any paper to get them sorted. Insert/Delete? Easy--find the right point in the path and adjust the path to point over to the new piece of paper and back, or to short-circuit across the piece you want to delete. No more shuffling.
Make sense? |
| Fri 17 Jan | HeyMacarana | 'Just wondering if anybody's got a good way of explaining pointers to new programmers - or, indeed, if there even _is_ a way.'
I used a post office, postal address, and mailman analogy when I explained pointers to someone. I had to create a wierd situation to try and make the analogy work though. |
| Fri 17 Jan | Better than being unemployed... | Hmmm, interesting suggestions from everyone. Cheers. |
| Fri 17 Jan | Sam Gray | I'm surprised nobody has mentioned this yet. I always like to try to explain pointers by using a library analogy. The shelves (or stacks, if you will -- there's a nice natural pun) correspond to memory, books to data in memory, and the card in the card catalog that tells you where to find the book is a pointer.
Of course, if someone's never been to a library, that would fall down, but should such a person really be programming? ;> |
| Fri 17 Jan | tim | And then once they do get pointers you have to explain to them pointers-to-pointers, pointers-to-functions, differences between references and pointers, etc... |
| Fri 17 Jan | Mike Swieton | I've found the reason most people I work with don't seem to 'get' pointers is that they refuse to diagram what's happening. They've not yet reached the point where they can visualize it without paper, but they just won't draw it out. When someone realizes that they can draw things, it doesn't matter whether they get it on an intuitive level: they can always draw a picture and figure it out, and they'll get there soon enough. But people don't do this. Why?! |
| Fri 17 Jan | Norrick | 'I'm surprised nobody has mentioned this yet. I always like to try to explain pointers by using a library analogy. The shelves (or stacks, if you will -- there's a nice natural pun) correspond to memory, books to data in memory, and the card in the card catalog that tells you where to find the book is a pointer.'
Best analogy EVAR!!! |
| Fri 17 Jan | Norrick | P.S. Do you remember to mention that a card from the card catalog can point to either a book or to another card (that can point to either a book or another card (that can point to either a book or another card (that can point to either a book or another card (that can point to either a book or another card))))? ;)
I think that's the part that freaks most people out.
It's like when I'm trying to teach a newbie about saving and finding files in the file system - the file/folder analogy hold up until I mention that folders can contain other folders (can contain other folders, etc.) and then comprehension comes to a screeching halt and I see panic in their eyes. |
| Fri 17 Jan | Still Learning | I think understanding the library (or pigeonhole) analogy is just the first stumbling block. I also think that it's fairly easy for most people to overcome since it's just one level of abstraction.
But when you start dealing with two levels of abstraction (pointers to pointers), pointers to functions, or pointers to struct/class members (-> syntax), then it gets more difficult. You can read several chapters in a programming book much faster than you can assimilate the concepts. So, it can go from still making sense to a garbled mess in your mind in a short span.
Let's not forget the fundamental difficulty of understanding the syntax as well. From page 122, K&R C, 2 ed:
char (*(*x[3])())[5]
where,
x: array[3] of pointer to function returning pointer to array[5] of char.
So, the toughest things in my opinion are remembering all the syntax rulkes and thinking at a second level of abstraction. |
| Fri 17 Jan | Wayne | I have no real C or C++ experience besides reading a few chapters from 'Thinking in C++' and trying to make standard function dll's for use with VB.
I'm not trying to toot my own horn here, but I have to tell you that just from looking at the posted statement, I understood that *x[3] was a pointer (held in an array) to function *(*x[3])() that returned a pointer to a character array's 5th element char(...)[5]. (me. - is that right?)
I didn't read, the next line because I play games with myself like that. Back to the main point(er), I think these are great analogies to use, the Pigeon Holes for simplicity and and the Library to illustrate that Books have content as compared to Catalog Cards wich are only pointers.
I don't see what's so hard about it, but then again, I've known people that have a hard time figuring out how to tie their own shoelaces too :) |
| Sat 18 Jan | Curious | Nobody has problems with pointers in general, Everybody
has problems with C/C++ pointers in particular.
These are neanderthal and insane because of all the wierd
pointer arithmetic stuff and because there are no primitive
types in C for handling things like arrays or strings.
There are only pointers to memory blocks that the coder
must use to simulate such types by explicitly handling them
as addresses, whereas an actual good language would
handle most such cases transparently.
Lisp and Pascal use pointers all over the place, but I've
never heard a Lisp or Pascal programmer complaining
about pointers being hard. |
| Sun 19 Jan | Kyralessa | This is the tutorial that made me understand pointers:
http://home.netcom.com/~tjensen/ptr/pointers.htm
Most especially this chapter, excerpted very briefly below:
http://home.netcom.com/~tjensen/ptr/ch3x.htm
---
int puts(const char *s);
'...The parameter passed to puts() is a pointer, that is the value of a pointer (since all parameters in C are passed by value), and the value of a pointer is the address to which it points, or, simply, an address. Thus when we write puts(strA); as we have seen, we are passing the address of strA[0].'
---
What I'd been struggling with up till reading this was that books referred to 'passing by value' and 'passing by reference' as though C could do either one. When I read this (C always passes by value, but sometimes the value is an address instead of an int or a float), the heavens opened, angels sang, and C suddenly made a lot more sense. (It was such a sea change that I even remember exactly where I was sitting when I first read it!)
I think perhaps a big part of the reason so many people don't understand pointers is they only learn out of one book. I'm working on a CS degree now, and in a new language class I always check out library books or buy one or two books to supplement our class text; having two or three alternate viewpoints helps immensely in clarifying obscurities...especially those which the author has made obscure through bad writing. |
|
| Mouth Not So Wide Shut? | Thu 16 Jan | S |
| I do agree with Joel that publishing upcoming features before they are ready can lead into troubles. For example, Blogger has been displaying the upcoming features for Blogger Pro since the beginning but since the beginning a large proportion of them are still at the Coming Soon stage. Eventually you tend to loose patience and simply move on to another product. So on that point, not saying anything is a good idea.
On the other hand, if you are entering a market where you already have competition out there, I think informing potential customers is important. As a user, you compare product A vs product B. Product A has features X,Y,Z but his lacking feature W. Product B already has features W, Y, and Z and is working on implementing X. That makes it easier to choose product B. Maybe the key here is to display only features that are not new or revolutionary. ie features that your competition already has. In that case, you are not losing your competive advantage when you release a new feature that blows the competition away and customers can still feel confident in choosing your solution even if some standard features are missing cause they know they will eventually be coming.
As well, if you are producing development framework like .NET, I think it is really important to inform users of the upcoming features as companies have to fork huge amount of money to get development going (computers, IDEs, training, books, hired experienced employess...). Customers of .NET had to feel confident that if they started using .NET, they would eventually have all the tools required to achieve their goals. Also AFAIK Sun came out with J2EE before .NET so MS had no choice but direct attention to their product. |
| Thu 16 Jan | Tom Payne | Microsoft have used this as a tactic to damage innovative competitors. The stoory goes:
1. Company X announces and ships innovative product.
2. Microsoft quickly announce that they too are working on functionally equivalent project.
3. Everyone waits for Microsoft's product and doesn't buy Company X's.
4. Company X goes out of business. Microsoft quietly 'shelves' project.
No, you're not reading slashdot :-) |
| Fri 17 Jan | Just me (Sir to you) | Interesting Tom,
do you have any specific examples of this? |
| Fri 17 Jan | Tom Payne | Tablet PCs? (when they first came out 5+ years ago, Go & Pen computing)
Dictation (a la Dragon Dictate)?
Mobile phone operating systems? (although that's not going in MS's favour at the moment: see current problems with the Orange SPV and MS being taken to court by a former UK development partner)
Xbox vs. PS/2 & N64?
Java vs. .NET? MS was maybe a bit slower on this one, but their dropping of support for Java in Windows and hyping of the functionally similar .NET is suspicious.
DirectX vs. OpenGL?
To be fair, other developer's see MS's ideas and think 'that's a good idea, but I don't want MS to control it' and as a result announce their own versions, e.g. Sun's response to the now-scrapped Hailstorm.
My point is that pre-announcement can be an effective weapon, particularly if you are already in a dominant position in a closely tied field. MS. being the single largest player in the software market by a huge margin, is in an excellent position to exploit this weapon and does so regularly. |
| Sun 19 Jan | Yo-Yo MaMa | While I think there is a shred of truth to the idea that Microsoft have used vaporware announcements to harm competing products, your last three examples are way off base.
> Xbox vs. PS/2 & N64?
Do you really think this situation applies here? Console buyers are not CIOs. Microsoft's name meant nothing in the console market. The attempt to create pre-buzz for XBOX was to try and get developers on board to create software for the system launch... and is completely par for the course in consoles. (And, uh, N64? That's so 1996. I think you meant the Gamecube).
> Java vs. .NET?
Java was around for years before Microsoft mentioned anything about .NET (or even 'COOL'). Java was already well established as a server-side development technology before Microsoft started talking about .NET publically as well. I just don't see this fitting.
> DirectX vs. OpenGL?
This one is reaching as well. While the Quake games proved you could use OpenGL for game graphics, DirectX is a lot more than a 3D API. And while some people may argue that OpenGL could have been used instead of inventing Direct3D, I believe Microsoft made a sound choice in developing their own API and its paying off in spades now. OpenGL is a great API from a design standpoint, but it suffers way too much because of the committee atmosphere in which it is now developed (a committee made up of competing vendors, mostly). While DirectX 9 has a high level shader language and cross-vendor support for many other advanced graphics features, OpenGL is languishing and at the current pace of things I wouldn't be surprised if OpenGL 2.0 were released at about the same time as DirectX 11. |
|
| BBCi | Wed 15 Jan | Ged Byrne |
| While web sites are desperately trying to find revenue streams, the BBCs website goes from strength to strength.
I dont know of any other portal that match the depth and range.
http://www.bbc.co.uk/
Do you think that the BBCs public funding gives them an unfair advantage ( http://uk.news.yahoo.com/030115/80/djbjn.html ) or could this be the way of the funding the web for the future?
Is there anything else out there quite like it? |
| Wed 15 Jan | Walter Rumsby | Well, other web sites have similar (or larger) amounts of funding and have not turned out anything of comprable quality.
BBCi seems to have used its money smartly hiring smart people and taking the time to think about how to present itself online. |
| Thu 16 Jan | Stephen Jones | Political fanaticism makes public funding a taboo concept and also the web is quite new so much stuff has been provided for free either indirectly through public funding or from commerical interests as a lost leader. However one does wonder how much longer Google can afford to run Google groups for free, or that the webarchive can continue without any apparaht source of funding.
How necessary an ENABLING job will become in the future I don't know. Possibly the job can better be done by indriect public funding as at present. The translation of certain web sites into other languages (particularly those of the poorer countries, and of open source software interfaces and help files is another place that springs to mind.
The insistence in the UK that universities and other insititutions search out extra funding can have nefarious consequences. It would be much better to give them a little extra public funding to produce online content for the public domain. I believe MIT has already committed itsellf to doing that for free. |
| Thu 16 Jan | Yandoo | >>Well, other web sites have similar (or larger) amounts of funding and have not turned out anything of comprable quality.
The difference is they have to use that funding to make money. The BBC doesn't.
How can a private firm compete with the power and funding of the BBC? It can't . Regulators are beginning to examine the role of the BBC more closely. For instance, they recently announced a new learning project for schools - something like half the content has to be procured from the private sector. |
| Thu 16 Jan | bccfan | The BBC is providing a service, for which the British public pay a high cost (in the UK anyone with a TV effectively *has* to 'subscribe' to the BBC, regardless of whether they consume BBC content).
On the other hand, the BBC TV is the best TV that I have sampled anywhere ever. No adverts, two channels of good, well produced content, sold all over the world.
The reason the BBC website is so good (e.g. news.bbc.co.uk is invaluable to me, and IMHO better than cnn.com) is because of the content.
The fact is that the content is content that is already generated for the live shows. The news and sports coverage is the same coverage as is selected from for broadcast in the news etc. The background material generated when preparing a documentary or drama or whatnot is relatively straightforward to present online.
So basically I view the online content as the final resting place for great content that was previously discarded/archived.
I look forward to them providing a video-on-demand service for their archives! When I watch British programs elsewhere in the world, I get fustrated by the incessant adverts!
BBC rules!!! :-D |
| Thu 16 Jan | Stephen Jones | To say the BBC produces great programs because its better than the competition is like saying Saddam Hussein is great because he's better for the Iraquis than Genghis Khan was (yep! the Mongols did invade Mesopotamia!).
I pay for BBC prime and although its better than all the other Satellite channels I pay for put together there is still only about three or four hours of TV a week that is worth watching.
However BBC World (the free service) and the web site are fairly good.
And those that say public funding is bad because it is inefficient except when it is good in which case it must be trimmed for the sake of 'competition' are obviously pushing their special interests. |
| Thu 16 Jan | Ged Byrne | ------------------------------------------------------
How can a private firm compete with the power and funding of the BBC? It can't .
------------------------------------------- Yandoo
The argument is usually the other way round. How can the BBC compete against the funding of private individuals.
On the commercial channels Who Wants To Be A Millionaire gives away prizes of up to 1000000. BBCs flagship quiz Weakest Link has prizes up 32,000. Contestants rarely get close to this.
When BBC lost the rights to show football after ITV Digital paid a fortune for exclusive rights. Many questioned if the BBC was still viable. Later that year when ITV Digital went bankrupt, and causing real damage to the game.
My partner is a teacher, and at the moment we are paying way over the odds for resources. I am delighted to see that the BBC are finally going to shake up the market. |
| Thu 16 Jan | Better than being unemployed... | Remember that 25 years ago, there were only 3 channels of television in the UK. Because of this, there was far less possibility of an idea reaching fruitition on television, which meant only the best ideas got in. Also, computers and the internet weren't aorund then, so television had a stronger footing.
Nowadays, I have 200 channels (most of them of utter dross) on my television, and a virtually infinite quantity of websites at my disposal. The goalposts have changed, and the BBC is trying to react to them.
However, because of it's experience in producing quality, I use the BBC's news site in preference to any radio or TV news, or any newspaper. |
| Thu 16 Jan | Stephen Jones | In general the proliferation of television channels has led to a decline in the number of programs made, apart from the six talking heads sitting in a studio commenting on home videos variety.
It's not just the '57 channels and nothing on' syndrome Springsteen referred to; it's the fact that is the same stuff on each of these 57 channels. When satellite TV took off in the Arab world in the early niineties the joke was that you could always find your favourite film showing on one channel or another. Indeed one pastime was to watch the same film on different national channels to see which bits each country censored.
The situation with local radio is even worse. There are thousands of local radio licenses but they are all taken up by branches of three or four national chains and the only 'local' stuff on the station are the ads. |
| Thu 16 Jan | David Clayworth | I'm a Brit now living in Canada. I can now get over sixty channels of TV (it could be 200 if I tried), but frankly I more often found something I wanted to watch on the five channels of British TV than the sixty of American. Of course if you think 'World's Wackiest Police Chases' is good entertainment then you would disagree with me, but for intelligent programming there is no comparison.
As for the inability to compete, it seems to me that ITV is doing just fine (football fiascos aside). The BBC isn't funded enough to prohibit competition, but the fact that it is judged (to some extent) by quality rather than by revenue seems to force the competition to up the quality bar.
More cheers for the BBC, and keep it funded the way it is. |
| Thu 16 Jan | Ged Byrne | Of course, in the field of television America has done fine without a public broadcasting network. Right now the USA is producing quality productions like 24, and in the past stuff like Columbo and (of course) Star Trek.
The big difference, though, is that Commercial television figured out how to fund itself from the start: Adverts.
Adverts seemed to have failed on the internet as a means of funding content. I think this is because the internet does not have the bar to entry that television has, which means that broadcasters are unable to charge the same premiums for advertising space.
This makes the Internet more like Radio, and again the BBC excels here. Are there any other radio stations quite like Radio 4 (a non music station. Far more than talk radio, it has drama and highly intelligent content). Could Radio 4 survive in a commercially?
So far people are struggling to find a way of funding the internet, and the BBC's model seems to be working. |
| Thu 16 Jan | Yandoo | >>The argument is usually the other way round. How can the BBC compete against the funding of private individuals.
In the sphere of television I agree completely, although the BBC seems very good at leveraging what it does have to produce higher quality programmes.
However on the web it is a different story. Which private companies have access to the amount of quality, and quantity, of content that the BBC does, and can also spend large sums of money with no need to seek a return. That is the argument - the level to which a publicly funded company is allowed to compete against private firms. |
| Thu 16 Jan | Yandoo | Incidentally, it's real nice to know there is some kind of British interest on this forum. Everything always seems to have such a damn American tint! |
| Thu 16 Jan | John Topley | The BBC does have adverts, just not commercial ones. It is constantly advertising its own programmes just before they are on, which I find annoying. Also, don't forget that it has a large commercial revenue from sales of programme formats to other broadcasters, video sales, merchandising etc. |
| Thu 16 Jan | Stephen Jones | ' the level to which a publicly funded company is allowed to compete against private firms. '
Yea, lets get rid of all this dotcommunism.
Look what happened with air. Made it free and all the private companies that could be selling it and creating real jobs aren't around any more |
| Thu 16 Jan | David Clayworth | Yandoo
Strangely enough, and don't ask me why, it seems as though two out of the three top posters to this site are British (Ged? SImon?).
Maybe it's the quality of the topics. Or maybe Brits have more time on their hands. :-)
http://www.usabilitymustdie.com/jos/WW_All_Members.html |
| Fri 17 Jan | Ged Byrne | ------------------------------------------------------------
Look what happened with air. Made it free and all the private companies that could be selling it and creating real jobs aren't around any more
----------------------------------------- Stephen Jones
Not only that, but all this free air is being used by criminals and terrorists. |
| Fri 17 Jan | Stephen Jones | ' it seems as though two out of the three top posters to this site are British ...... Maybe it's the quality of the topics.'
Yea, that's right. Why should we let the Yanks have the monopoly on mindless patriotosim! |
| Fri 17 Jan | Neil Elkins | I'm British Too.
But I'm not a top poster, I'll admit. |
| Fri 17 Jan | Simon Lucy | I think our typing speed is quicker.
The BBC is doing so well at its site that its prompted Patricia Howells to snarf about the licence fee again. And the web site is a curious admixture of the public broadcaster and the definitely for profit merchandiser.
The BBC had to stop promoting BBC publications in all those little adverts because it was recognised as a misuse of the Charter.
But in the past five years or so the BBC has certainly got its act together, I just wish there wasn't this pell mell rush into digital ghettoes. TV and radio content is splitting into ever smaller nuggets of stations, none of them are likely to gain a secure following and they'll just be merged and demerged over and over.
The illusion of choice pervades everything.
The centre cannot hold, I need more coffee. |
| Fri 17 Jan | Ged Byrne | As far as I can see the only reason for those BBC digital channels is to allow us poor workers to savour the delights of daytime TV. |
| Fri 17 Jan | JP | 'Look what happened with air. Made it free and all the private companies that could be selling it and creating real jobs aren't around any more.'
That's not an exactly ... useful analogy. The issue is that the BBC has been entering areas which are already reasonably well-served by the private sector, and throwing money at it. Money which was actually raised for other purposes by a compulsory tax on television ownership.
Even in the broadcast sector, which is where the BBC was intended to operate, it attempts to compete with the commercial companies operating in the same sector. It actively tries to minimise their market share. How is this consistent with a public service mandate.
The reason that its recent move into educational publishing causes concern is that it was a pre-existing sector, in which the BBC had no intrinsic interest. It decided to enter the field, just because, well, it could (and it had some money spare). To put it into perspective, how would you react if it decided to form an IT consultancy division which would give away its services for free?
*Declaration of interest: I work at a web publisher that the BBC started competing with directly a few years back. |
| Fri 17 Jan | Ged Byrne | I think that Education publishing is hightly relevant to the BBC.
BBC has produced educational programming since day 1 for both radio and television. Education is a significant part of the corporations remit.
The real problem is that in education the market is not 'well served.'
As I say, we spend a lot of time and money on teaching resources on the web and both quality and quantity are poor. |
| Fri 17 Jan | Just me (Sir to you) | I would also say that the public broadcaster going into educational publishing is a better use of the public money it is trusted with than it being spend on game shows, daytime soaps or football licences. All the latter grounds are abundantly covered by the private sector, and there seems to be no particular civil values served in these. |
| Sat 18 Jan | I just like to read | The BBC levies a £2.5 billion tax on UK television owners. What we get in return is a load of left wing propaganda and very few programmes worth watching. Most intelligent viewers only watch TV for the US shows - Friends, Frazer, etc and these shows are only on the commercial channels. It is a myth to say there are no adverts on the BBC. There are hundreds of them every day. These adverts usually consist of pointless animation or praise for the BBC. If you do not pay the TV licence fee you can be thrown in prison with a load of murderers and perverts. Despite the above comments I think the BBC web site is very poorly done. |
| Sat 18 Jan | Neil E | Most of the programmes on the BBC (and the commercial channels) are adverts for the related merchandise, just look at the Tellytubbies or S-Club-Whatever.
Funny thing is, product placement in programmes is actually against the broadcasting rules here. But Popstars, Pop Idol or Fame Academy manage to display their product (the singers) quite happily for several weeks before their records come out. Why not go the whole hog and invite car manufacturer to provide a programme so we can vote for our favourite design features in the months before the car is launched...
Even the bit which should be worth it, the news, is crap. I wouldn't agree that it has a left-wing bias, I think it's more of a bias toward recieved wisdom and cliches.
Still, that Del Boy falling through the bar in 'Only Fools and Horses' is worth evey penny of licence fee I've paid over the years... Ahem. |
| Sun 19 Jan | Ged Byrne | ------------------------------------------------------------
The BBC levies a £2.5 billion tax
------------------------------------ I Just Like To Read
I'm surprised the conservative party haven't used this yet. With families starting to feel the pinch, a promise to scrap the license fee could be a real vote winner. |
|
| Java vs. Perl/PHP | Fri 17 Jan | Brian R. |
| I have to make a decision between whether to take a class in Perl and one in PHP w/Apache taught as well, or a class in Advanced java.
The java teacher is really smart and a good teacher (Indie lady w/no accent).
I look at the job ads and see 1)M$ followed by 2)Java. Perl and PHP are almost completely off the map - less than 5% ads mention it.
Does anyone know why Perl and PHP are not asked for much. I have my own suspicions, like versatility and the fact that most co.s are only interested in high-end, high scalability apps.
CGI may be slow, but for personal systems it should be quicker to develop w/for the web.
I dont have much confidence in the ads (lots more right now BTW, in general [Jan must be hiring season]). |
| Fri 17 Jan | pb | It's more that companies feel safer buying into environments from big companies they know (Microsoft, Sun) which is legitimate, IMO. So, if you'd like to use the class as support for looking at corporate-type jobs, then go with Java. If you will be looking at smaller outfits or doing your own development, consider perl/php. |
| Fri 17 Jan | john galt | Take a class in design or architecture. Syntax can be learned in a month. But if you had to choose take the java class. Perl's OOP is messy IMO and php doesn't have enough respect among companies that pay well. |
| Fri 17 Jan | Brian R. | Wow, you guys are great, thanks a lot.
I was starting to think that security might be a 'hole' in open source programming or some such 'fatal flaw', but I think you guys are right that it just doesn't get the same level of respect by big co.'s.
I was thinking more of the small co. route, but I am rather capable at understanding OOP concepts, so perhaps the Java route for now, based on your reactions.
Mostly I am interested in which language is 'superior' in terms of real-world productivity, and getting a job right now wouldn't exactly hurt either :); self-employment potential was the 'secret goal'. |
| Fri 17 Jan | Matthew Lock | Perl would be your choice for productivity, check out all the free modules on http://search.cpan.org
I have used PHP a lot and Perl beats it hands down in productivity. Couldn't say for Java though. |
| Fri 17 Jan | Brian R. | Thanks Matt. I think file processing is so important, yet I don't see it as a 'prominent' part of java.
pb says, 'It's more that companies feel safer buying into environments from big companies they know (Microsoft, Sun) which is legitimate, IMO.'
Would those concerns go something like it is easier to commoditize an M$ or Java programmer. My mental image of corporations is in wanting someone who can be easily laid off, and still have easily maintainable code for the next guy. M$ is the most advertised for job positions, and the easiest to learn tools, IMO. And in return, more people will learn the M$ way, ensuring more people competing for the same job, IMHO.
I know everyone wants to make a career and afford a house, car, etc. as a programmer. I would just be happy w/ a programming job, where I am more likely to have some real, less dispensable value.
Thanks for the replies. It's an important topic, to me at least. |
| Fri 17 Jan | Jeff | A lot of companies use Perl/PHP/Python/you-name-it - they just don't hire people specifically to do it. They let their Java/C++/C programmers work in the other languages too.
As one of my previous employers stated 'it's a lot easier to find a C++ programmer that can do Perl then a Perl programmer that can do C++.' |
| Fri 17 Jan | Tom Payne | > I have used PHP a lot and Perl beats it hands down in productivity. Couldn't say for Java though.
Yeah, this is my experience. PHP is brilliant for producing simple dynamic pages quickly (parse request, query database, insert results into template). But it's very much a toy language: it lacks almost all of the features that halfway-decent languages provide (decent OO model, closures, iterators, scoping, templates, etc.).
I'm not sure what you'd learn in a PHP class, aside from the simple mechanics of how to write a simple dynamic webpage. Concepts, i.e. building a franework of understanding into which the vast majority of procedural languages will fit, are much more useful in the medium to long term. My gut feeling is that you'll learn these concepts in the Java class but not in the PHP one, and so would recommend Java. |
| Sat 18 Jan | WNC | ' 'it's a lot easier to find a C++ programmer that can do Perl then a Perl programmer that can do C++.' '
That's a comforting thought. I've done only Visual Basic professionally, but I've been seriously studying C++ for two years now in an effort to increase my value as a programmer. Someone I respect said recently I was probably wasting my time studying C++. So your comment is comforting, I hope it’s true.
My studies so far have led me to this conclusion: VB is mostly using other peoples objects and C++ is mostly making your own objects. Of course this is probably related to the kinds of VB programming projects I have been involved in- actually mostly VBA MS Office integration type projects. There are probably millions of VB class authors out there who will now flame me for saying that, but it’s been my experience. |
| Sat 18 Jan | raindog | I was C++ programmer with more than 10 years of experience, when I encountered Perl. I took me about a year to learn it to understand all the details, but it was worth it. I'd say it was one of the biggest addition to my skill set. Just for comparison, it took me 2 weeks to learn Java to understand very well (better than Perl in 1 year). However, Java didn't change the way I program. As someone (Paul Graham or Richard Gabriel?) said, if a language doesn't change the way you think, it's not worth learning.
So, my advice - learn Perl. It's a super-language. |
| Sat 18 Jan | BDKR | The truth of the matter is that all of these are great languages. All have strong points and weak areas. Too make a comment that any one of these languages is a 'toy' language shows a lack of maturity and experience.
BDKR |
| Sat 18 Jan | PC | My advice is learn both Perl and Java. If you know them you will already know PHP.
Even if the application you are developing is in Java, knowing Perl is a great help. For example, you can generate some of the code automatically with Perl. Any scripting that helps in any way can be done with Perl. Perl can make anyone's life easier, even if you are not developing mod_perl applications.
I personally like PHP for certain web applications, and would often choose it over mod_perl. I would not use CGI for anything except maybe a little application I was only going to use myself. |
| Sat 18 Jan | Leonardo Herrera |
Read some of the insightful Dijskstra rants about languages. You can learn one thing or two. |
| Sat 18 Jan | Tom Payne | BDKR wrote:
> Too make a comment that any one of these languages is a 'toy' language shows a lack of maturity and experience.
I called PHP a toy language in this thread and feel the need to defend my maturity and experience!
I've used PHP to create a fair number of dynamic websites. I think it's fair to compare PHP to Python, Ruby and PERL as they're often used for similar tasks. PHP's great strengths are:
1. It's ubiquitous.
2. It comes with loads of powerful libraries.
3. It's really easy to do simple stuff.
But PHP _the language_ is dire. The object model is farcial -- no decent inheritance, no decent scoping, no data hiding. There is no module functionality, no operator overloading, no iterators, no closures, no templates, no namespaces. In fact there isn't much of anything at all! This becomes a real problem if you're trying to build a medium-sized project or larger.
Ruby, PERL, etc., by contrast, provide all the features of PHP _and_ a whole load more. Writing large projects becomes feasible in these languages.
Therefore, I repeat my assertion that PHP is a toy language. |
| Sat 18 Jan | Jan Derk | I would recommend to both take classes. PHP, Perl and Java all excel in their own specific area and are great tools for any programmer. The saying: 'if all you have is a hammer everything looks like a nail' is just too true in software development.
One thing I would stay away from is the religious time wasting wars about X rules or Y sucks. It's sad to see so many programmers limiting themselves for religious reasons. The fact that you name Microsoft M$ might be an indication that you are heading towards that trap. |
| Sat 18 Jan | Brian R. | Someone tell me this isn't the best place for programmers on the internet. You guys are great.
I took the Perl and PHP/Apache (w/a book on Apache). I am also taking Linux (again, in a way).
I can already do VB, VBA, ASP (still learning), so I am adding open source. I would really like to learn all of the Linux servers.
Java is the most awesome in scope of all of these, and I realized that would be the best for developing my theoretical understanding. But I really want to be an ace scripter and have a lot of competence at cranking out a lot of code before getting abstract and just opening my mind by learning java.
I am interested in just getting down server-side programming and the web. Java is either for applications, or back-end where servers talk to other servers in an enterprise setting. Server-side scripting will dodge this bullet for now.
I have taken one course in Java. This was actually an advanced Java course. I guess I felt 'overchallenged' when the teacher said that these java books are trade manuals and not text books. She mentioned inner classes, and that was one thing I had not heard the term of before, because I did not take java at this college (like most everyone else did).
She said that only ten people stayed through her last class, which sounds like a real challenge, but I didn't want to bite off more than I could chew at the sake of everything else. Perhaps another semester, and if it's not offered, I will teach it to myself.
Thanks for all of your advice. Definitely have a better perspective on what real programmers and hiring mgrs. think about all of this, than I had before. |
| Sat 18 Jan | john galt | '
Mostly I am interested in which language is 'superior' in terms of real-world productivity, and getting a job right now wouldn't exactly hurt either :); self-employment potential was the 'secret goal'.
'
Learn plsql and datawarehousing techniques. Boring as hell but you make alot of $$$.
'
Thanks for all of your advice. Definitely have a better perspective on what real programmers and hiring mgrs. think about all of this, than I had before.
'
Real programmers and hiring mgrs are at the opposite sides of the spectrum. |
|
| Joel never makes any promises? | Fri 17 Jan | Yandoo |
| >> The best way to avoid breaking promises is not to make any
Wow, that must make life for people around Joel to be real tough.
>Joel, can you get the shopping on your way home from work tonight, weve run out of food and my broken leg means I cant go shopping? - mum
>Sorry mum, cant say at the moment - youll find out when I get home tonight - joel
Surely its better to make promises that you intent to keep and the keep them?! Isnt that how trust is built - by making and keepping promises (however small?) |
| Fri 17 Jan | anon | People can really snow you under promises if you let them; a lot of being social is turning many down. Obviously there must be some level where you make promises, like when someone's leg is broken. But why make promises when you can simply just do something? Trust doesn't come from promises, it comes from actions.
BTW, you can see that this is an issue I deal with often. ;) |
| Fri 17 Jan | Yandoo | >>Trust doesn't come from promises, it comes from actions.
I think it comes from a combination of both. Learning to make (the right ones) and keep promises is a cruical part of life as far as I'm concerned. Starting with making and keeping promises to yourself (you implicitly make promises to yourself whether you like it or not). Extending that to include others once you trust yourself enough is a natural next step.
If you're incapable of telling someone you're going to do something and not be able to trust yourself to forfill that promise then what does that say about you?? |
| Fri 17 Jan | HeyMacarana | '>> The best way to avoid breaking promises is not to make any'
I think Joel just intended for the statement to apply to business and not necessarily to personal life.
There's not too much harm in breaking promises with loved ones such as your family if you've got a good reason, and when they're usually understanding and forgiving.
So there's not too much repercussions that can't be easily repairable in a personal situation, while in business one slip up on a promise can make or break a deal. The other side usually doesn't have the background and relationship built up as in the personal relations with a family member or close friend. |
| Fri 17 Jan | Karl Perry | Joel wasn't talking about promises per-se, but peoples' expectations about the content of that which is promised.
'Sure, mom - I'll pick up some milk on my way home. Don't hobble down to the market - I'll take care of it.'
... later ... 'Joel, why didn't you get eggs, too? Didn't you see the almost-empty carton right next to the milk in the 'fridge this morning?'
Joel only promised to get milk, and he delivered. However, his mom assumed that he would realize that they were out of eggs too, and is now disappointed that he wasn't ... observant? ... prescient?
In the software business where I work, we were all the time dealing with unrealistic customer expectations and frustration when what we had promised - with full disclosure to the client - didn't meet up with their unspoken expectations. We'd promise a fax number field for the vendor form, then they'd get pissed that we didn't also include a fax number field for the client (home, not business, people) form. Now - it would be great if we were imaginative enough to think of the second fax field, but that was not what we promised. But ...
So, we don't promise things to clients anymore. We politely tell them, 'we'll take your suggestion under advisement, and it may appear in a future version.' |
| Sat 18 Jan | Eric W. Sink | > So, we don't promise things to clients anymore.
> We politely tell them, 'we'll take your suggestion
> under advisement, and it may appear in a
> future version.'
This is the safest way to go. I've done it myself lots of times. But customers hate it. What they want is someone who will properly manage their expectations instead of just eliminating them.
Being more open with customers is obviously a risk, but there is an associated reward. People like working with vendors who will be a little more open with their vision and plan. |
|
| Years of experience | Wed 15 Jan | Better than being unemployed... |
| Over the past year, Ive been turned down for numerous jobs for being too senior.
It seems that all the job offerings I hear about either want a graduate, somebody with a years experience, somebody with 3 years experience, or possibly 5 at a push, but after that they just dont want to know. (Ive got 8).
This pisses me off, as it implies companies are happier to get less experienced people, probably because theyre cheap, while the gurus can go jump.
Whats going on? |
| Wed 15 Jan | Practical geezer | Probably exactly what you think, they want cheap. Apparently cheap means, low salary. I suppose they get what they pay for, but don't always quite realise what that means.
Fits perfectly with contemporary short term thinking... |
| Wed 15 Jan | Jutta Jordans | Another reason (beside geezer's explanation) for wanting to hire people with little experience might be that many companies in the business are rather young. The management is young, too. I think, some managers are reluctant to hire someone who has more experience than they have themselves.
Have fun, |
| Wed 15 Jan | Ichabod Crane | Another reason often cited is that someone with lots of experience will get bored with the job and decide to move on. Companies want employess that will stay put. There is a lot of expense in ramping up new employees and compnaies don't want to spend that money just to have someone get bored and quit. |
| Wed 15 Jan | tapiwa | companies are happy with xyz. If you think they are wrong, it is up to you to sell your value.
If they do it because less experienced people are cheap, then you might want to lower your salary expectations, or show that you can add so much more value to the company.
if it is because they think you will bolt as soon as you get something more interesting, you might want to show how long have have stayed at previous jobs, and hint that you want stability/long term contract/long notice period (get creative).
if they think that with that many years experience you are already set in your ways, you might want to demonstrate how you have picked up new skillsets/methods, and how you are able to adapt to new environments.
I could go on.... just sell yourself, and in this market, make sure you are a bargain... maybe not cheap, but a bargain. |
| Wed 15 Jan | | I'm probably as cynical as geezer (probably more so, I'm probably older :-), but there are also some practical reasons.
Younger workers are more flexible (translation: they will put up with more shit) than older, more experienced, workers. That's normal - for example they are less likely to have a family and can therefore work longer hours (and are willing to do so because they need to get experience under their belts and want to make a good impression). Since those longer hours are unlikely to be paid, they can be almost as productive as you and half as cheap.
If necessary they will travel, because like I say they are unlikely to have wife, kids and labrador waiting at home. And if travel is necessary, a young employee can be put in some fleapit hotel without kicking up a fuss. |
| Wed 15 Jan | TK | As an 'aged one' I had a interesting experience last month. A guy wanted a website. I was the 4th or 5th person he interviewed. After a few minutes he said, 'You know, I like your age,' and gave me the project. |
| Wed 15 Jan | Dino | Real projects are 20% fun and 80% sweat. Meaning, that 20% is creative work and 80% routine/detail work. Usually seniors cover the 20% fun part + leadership & mentoring as routine.
Then it quickly comes down to dollars and cents: a company will employ a small number of senior people for $$$, a large number of intermediates for $$ and maybe a number of juniors for $.
There is indeed less need for senior people on the market. |
| Wed 15 Jan | David Clayworth | Try rewriting your resume to omit some of your years of experience. If questioned, just say you don't want to discuss that period. Of course they will probably assume you've been in prison.... ;-) |
| Wed 15 Jan | happy to be working | I'm a senior developer, and I was out of work for quite awhile. I was finally offered a position, at less pay than an intermediate developer at the same company.
I managed to negotiate my pay to the same level as the intermediate. I have about 10 years of experience over the intermediate guy.
I consider myself lucky, if not a bit ripped off. |
| Wed 15 Jan | NIMBY | These days, it's rare that I find a job posting that isn't for a senior programmer/developer/etc. Are companies calling 3-5 years experience 'senior'? |
| Wed 15 Jan | Better than being unemployed... | Thanks for the replies. Just to clarify a bit.
I have a job at the moment. It's 'better than being unemployed' (hence the tagline), but it's not better than the really good job I was laid off from last year.
I've taken a substantial paycut and make less decisions. I'm surprise they hired me as it's rather obvious I'm going to leave as soon as the market picks up.
Jobs I see advertised as 'senior' are generally around the 5 year mark. Anything more than that is 'team leader' or 'manager' and those are definitely thinner on the ground. Plus I'm a developer, not a manager (though I've done a bit of management on the side) so it's not the sort of job I'd want, anyway. |
| Wed 15 Jan | HeyMacarana | I think the main reason employers don't hire people when they reach a certain age isn't usually because of the years of experience they have. I'm sure they'd love to get someone that' s been in the trenches and know what they're doing. Also, you've mentioned that you're willing to take significant paycuts, to keep yourself competitive to younger folks salary wise.
So if we've remove those two factors (years of experience and money) from the reasons not to hire then what is the real reason then?
My guess would be that the person isn't as enthusiastic about working as they could be. You've got to display a lot of energy and enthusiasm.
When you enter the interview, walk briskly into the room and firmly shake everyone's hand while giving each individual a warm and large smile. Think of yourself not as a developer at that point, but as a salesperson trying to sell yourself.
Many decisions are made in the first 7 seconds according to one article that I don't have the link to at the moment. So you've got to make a really good impression within those first few seconds and continue to deliver a go-getter attitude throughout the interview.
Also, doing extra things such as sending a well picked out thank you card to the recruiter, point of contact, and the interviewer will earn you special brownie points that could give you an important edge in a near tie with other candidates.
I don't think several years of experience is a bad thing. Instead, you should focus on it during the interviews as something unique you're bringing to the table that other younger candidates cannot.
If you think the employers are thinking your're too old, then you'll just have to get them to look at the glass half full perspective instead.
And finally, if you've tried all of the above and still aren't getting the results then as soon as you get the call or e-mail rejection, reply back and ask them what made them not choose you. Make them feel as comfortable as possible in order to get a straight and truthful answer.
Just say something like, 'Hi, [interviewer's name], I'm looking for ways to improve myself for future interviews in my job search. And was wondering if you could tell me what in particular or lack thereof in my background, experience, etc. that made you choose someone else.'
When you get a reply back as to why you didn't make the cut, you could also use the knowledge to try and assure the person that their conclusion based on this factor is not totally correct and here's why. You might get back in the running with this tactic and increase your chances of landing the job.
If you don't ask, you'll never know, and will always be second guessing the interviewer's motives and reasons for not hiring you.
Good luck! |
| Wed 15 Jan | Anonymous Coward | My favorite is 'You don't want this job, you can do better.'
If I didn't want it I would not have applied for it.
Still, the market has changed.
At one time programming was about algorithms and data structures, one could reasonably say 'Oh a new programming language, I'll learn the syntax today and be up to speed by the end of the week.'
Now it is all about arcane APIs and toolkits. As these seem to have a life expectancy of about three years having ore experience than that is irrelevant.
Management wants to believe that programming is easy. That way thay can justify making larger salaries than we do.
Further, management also wishes programmers to be a frangible resource. So they want them to be interchangable. So everybody must have the same skills and the same experience. |
| Wed 15 Jan | mackinac | >>> My guess would be that the person isn't as enthusiastic about working as they could be. You've got to display a lot of energy and enthusiasm. <<<
My first impression of this posting was that, yes, it's just a guess like just about every other post in this thread. And besides that, what does being 'too senior' have to do with being enthusiastic about the work. However, there is an important message in the posting.
A few years ago I worked for a small software development company. When they couldn't get enough work, they contacted employees out for on-site work. We usually had to go for an interview with the customer.
On a couple of occasions the customer rejected my assignment to the project. Their reason was that I did not appear to be really interested in the project. I have to give them credit for being perceptive and honest. They were right. I tried to convince them that I could do the work, but it was too obvious to them that I would really rather be doing something else.
In both cases I ended up with an assignment much more to my liking. |
| Wed 15 Jan | mackinac | >>> Further, management also wishes programmers to be a frangible resource. So they want them to be interchangable. So everybody must have the same skills and the same experience. <<<
The word is 'fungible', but I think you have a valid point. If people are interchangable parts, you have lower risks and lower costs. |
| Wed 15 Jan | Vincent Marquez | First of all, I think its very important to clarify what you have '8 years of experience in'. When I see 10 years of perl programming, 8 years of j2ee, 2 years of C#, and other crap like that on a resume, I roll my eyes.
To be perfectly honest, if I'm looking to hire someone, I couldn't give a rats ass if they did cobol for 40 years if the project is in j2EE. The stuff that is important to see on a resume backed by a ton of years are things lik |