Most of us that work in the IT industry have been around for a long time. We started out in our parents basement writing code in some BASIC environment, ussually Commodore BASIC or QBASIC. Do you remember how thrilling it was? Your first program and it was something extremely basic but the point was it worked. Some of us got hooked right away and kept trying to solve problems and added more and more pushing the capabilities of whatever language we used. As we got older the environments progressed and the programming tools progressed and got more complicated.
For those of us that had access to what was to become the internet we learned about more programming tools and languages through some electronic bulletin board somewhere. This is what is called hobbyist programming. Most of these freeware and shareware programmers are hobbyists they code at night but have a day job somewhere else. One of the guys that I know that does shareware is a woodworker by day, he makes cabinets and bed frames and he comes home at night and codes and sells his shareware just to give him extra money and to supplement his income. The problem up until now was that programming tools were getting very expensive. For the hobbyist this was too expensive and they cant afford some of the high end programming environments. Luckily the times have changed and companies like Borland and Microsoft have made some very nice tools available for low cost or free. There are Open Source IDE’s such as SharpDevelop and numerous others for Java and C++.
Build it yourself
One way to do it is to build it yourself. Download the .NET Framework, the Borland C++ command line tools and Emacs or GVim and you got yourself an extremely usable development environment. For this method you need to know the proper Syntax for whatever programming language you are using. This method is for the extremely geeky and new developers may find this method a little bit intimidating. For those of you that want to learn C# on Linux I strongly suggest Mono. Mono is an open source implementation of the Microsoft .NET Framework. It runs on a wide variety of UNIX and Linux platforms. Packages are available for different flavors of Linux as well as Mac OS X and Win32. You can build Mono for any distribution of Linux and you can build Mono on different UNIX environments such as Solaris, HP/UX and ,God Im going to get flamed for this, UnixWare as well as FreeBSD. Emacs comes standard with Linux and Mac OS X so that is no big deal. Im also going plug XCode right now. XCode is the development environment available for Mac OS X, its also free from Apple Computer. For Mac users I strongly suggest XCode its a very simple tool to learn and you get tons of support from Apple. XCode comes with Interface Builder as well as other tools.
Borland C#Builder
Of all the IDE’s out here for C# this is my personal favorite. I find it much less resource intensive than Visual Studios and I enjoy the layout much more. Borland C# Builder comes in two different flavors. There is a Professional version that includes an Architect, Professional and Enterprise edition that starts at $999.00 and there is a free personal edition. For work I use the Professional version because there is a catch to the Personal edition, the personal edition can only be used for non-commercial development which inhibits the developer. You can also export the code from Borlands project files to Visual Studio formats. C#Builder is extremely easy to use and is very intuitive for the new user. If you are interested in developing ASP.NET content C#Builder can also do that. For those of you that can afford it, go with the professional version. If you just want a decent IDE to create Open Source software than the personal edition is equally just as good. C#Builder does require IE 6, the .NET Runtime and the .NET SDK 1.1
SharpDevelop
The golden boy of Open Source C# IDE’s. Very good and very stable, also very cheap to acquire. SharpDevelop is already at RC2 and if RC2 is any vision of whats to come I forsee SharpDevelop becoming an extremely popular package both commercially and personally. RC2 is right now at a usable point. When I first heard about SharpDevelop it was at version 0.7 and at that time it was just a good editor, it has advanced pretty far and it is one of the Open Source projects that I look forward to seeing what happens. SharpDevelops layout is very similar to that of Visual Studios. There are a wide range of options for SharpDevelop, yopu can work on either C# or VB.NET projects. There is also a C++ option where you can create C++ projects. Its not hampered by the same non-commercial only restriction such as C# Builder personal. SharpDevelop wss forked recently and dubbed MonoDevelop. MonoDevelop is the IDE for the Mono project but lacks some features such as Windows Forms design. MonoDevelop is for the Linux platform but has been compiled on Mac OS X and Solaris. SharpDevelop requires the .NET SDK 1.1 but you can also use the Runtime only as that has the VB.NET and C# compilers built in.
Web Matrix
Web Matrix is a hobbyist tool created by Microsoft for web development. Its part of the ASP.NET project and is free for download. Web Matrix is the forerunner to Microsofts Web Development Express package. Certain features were taken from Web Matrix and placed into the Web Developers express product. Web Matrix is mostly used for ASP.NET development biut you can save .cs files and create them making it good for C# development. You can also use Web Matrix to create static HTML pages, edit text files and is great at creating interactive web pages. Being that WDE is in circulation now I dont know what the future is for WebMatrix. Whether Microsoft kills the development of Web Matrix or opens it up to the Open Source community is unknown at this time. Although there is no official support, forum support is available.
Visual Studios Express Line
Visual Studios Express is Microsofts developer tools cut down and repackaged seperately. Visual Basic Express, Visual J# Express, Visual C# Express, Visual C++ Express, SQL Server Express, Web Developer Express are the individual products. These are not crippled versions of their professional package but more or less just individualized. Pricing has not been officially announced but some have stated it will be about $49.00 USD for each product. If you are up to speed with Microsofts development suites then you should have no problem whatsoever using these tools. If you are new to programming you will find Microsofts famous ease of use incorporated. SQL Server Express is the only package I know of that will be free definately.
XMLSpy
XMLSpy is another great developer tool. It doesnt have anything in the way of WindowsForm design but this is more or less a good editor for doing manual syntax. It was recently made free by Altova for home use. You can do many different types of documents using XMLSpy, XML, HTML, Text and even ASP pages. On Longhorn Alpha I was using Visual SlickEdit 9 until my trial period ran out. I started using XMLSpy Home Edition and it works beautifully on Longhorn Alpha. Its also usable on Windows XP Pro and Home as well as Windows 2000. Only the home edition of XMLSpy is free.
Java Programmers
Java programming is great if you want to develop cross platform applications. The best way to develop real Java applications is to stay away from proprietary Java tools such as Visual J++ and Visual J#, rather go for an standards compliant stack such as Suns Java or the BEA suite. There are several free IDE’s for Java development. The first being Eclipse. Eclipse is an Open Source project to develop an IDE based on the IBM WebSphere toolset. Its allows utilization of plugins and you can enhance it in many different ways. Eclipse lacks the GUI designer that the C# tools offer and to create GUI elements in Java you have to use the Swing toolkit. The second is Netbeans. Netbeans is an IDE developed by Sun Microsystems also open source. You can enhance Netbeans through the use of plug-ins as with Eclipse, the only downfall with Netbeans is the speed. Its very slow starting and compiling and it takes twice as long to compile the same Java code in Netbeans than in Eclipse. For me, Eclipse is the best tool available for the job.
C++ Programming
C++ programming seems to be the top dog programming language in the world today. Everyone seems to love C++. C++ is the cadillac of the development world. Its fairly simple to learn, not as simple as C# or Visual Basic, but if you ae a quick learner you will pick it up in no time. For the newcomer to the programming scene I also recommend Eclipse for developing in C++. The Eclipse C++ IDE is a separate plug-in for Eclipse and doesnt come with the standard download. If you are happy doing Windows only programming and Windows programming gives you the warm and fuzzies use Visual C++. If you are interested in Mac OS X programming use XCode, if you want to write code that you can take across multiple platforms then use Eclipse.
Conclusion
These are all great tools for the nobbyist programmer. As you can see there is a wide variety of products that can be used, some free, some low cost but all of them of great quality. Programmiung over the years has been a pleasure for me. Asl alway look to the web for information. It is impossible for me to list all the resources and programs that are available. For me, Eclipse handles more than 99.9% of my programming needs for Java and C++. I am often inclined to sort of preach Eclipse to everyone but by all means explore your options and use the tools that are best for you. What I may like and dislike may be the total opposite for you so dont cut yourself short and by all means experiment. Learning how to program is hard but very rewarding. Nothing beats the rush of actually writing code and to have your program work. If you are new to programming by all means have fun, if your program doesnt work the first time out then do some problem solving but by all means dont give up.
References
About the Author
Roberto J Dohnert is a Unix/Linux and Windows Consultant and software developer. His first introduction to Unix based systems dates back to NeXTStep. He is a member of the GNU Darwin Distribution and has made several contributions to that and other projects. His personal webpage is here.
If you would like to see your thoughts or experiences with technology published, please consider writing an article for OSNews.
C++ programming seems to be the top dog programming language in the world today. Everyone seems to love C++. C++ is the cadillac of the development world.
I like C++, but it’s development has somewhat stalled in the past. While C++ is a good compromise between speed and abstraction, other languages focussed on different aspects. Java did a great job on providing a uniform system to a limited set of platforms and having a huge standard library.
Other languages focussed on specific problem domains (PHP for the web) or specific kind of problems (Prolog) or concurrent programming (Erlang) and so on.
And other stuff is still very important, just because so much important code is there (Fortran, COBOL)..
Regards,
Marc
Sometimes you want just an editor and not an IDE.
For that there are the classical tools Vim/Emacs(/nano?), and some modern ones, like JEdit, Scite, Kate, etc…
For the hobby market, I really don’t see why you wouldn’t include REALbasic, from Realsoftware. Frankly, I think it’s one of the easiest languages out there to pick up quickly, has a great GUI visual designer, excellent syntax, and a decent IDE… all for relatively little money. It’s OO based, but you can also still do much procedure style. Also, with the latest versions, you can now code for Windows, Mac & Linux all at the same time. Finally, you can easily go from GUI to console to web cgi type apps very easily.
I’ve been using it now for a couple of years, and although there are some issues with it, I can’t find a language / IDE that’s easier to just “get something done” in quicker.
Personally, I think most people ignore it because it has the word “Basic” in it. I say get over it.
All those IDEs are rather annoying and confusing when starting to program or even when trying to build Free Software.
Personally I like python and IDLE, they are simple and unobtrusive. For java I love DrJava, I haven’t hit the point where I want, or need a GUI builder. When it comes to C, I’ve stopped using IDEs at all. Mingw with Msys and vim are often easier deal with then many IDEs.
My two cents.
Nice article.
Don’t forget Python!
http://www.python.org is a great language for hobbyists who don’t want no fuss and just wanna program with instant results, sort’ve like instant coffee.
What about the *real* hobbiest development tools?
For 2D and 3D games:
http://www.blitzbasic.com/
For applications:
http://www.purebasic.com/
When I was twelve, I just pored over the (seemingly) endless lines of code for Nibbles and Gorillas on QBasic under DOS 5.0. I found where the number of initial lives is set and upped it up a bit Ever since I jumped to C/C++, VB, touched on Java, and now I do PERL and PHP for my website.
That thrill is still with me, and clearly still with the author.
@Anonymous (IP: —.sothfd01.mi.comcast.net)
Sometimes you want just an editor and not an IDE.
I know what you mean. Look at Crimson Editor (crimsoneditor.com) for an excellent Windows based one.
As someone would put it, are you on crack? C++ is mostly useful for professional programmers that are prepared to deal with the pain associated with programming with it (tedium, learning curve and error-proneness) because they are paid to do so.
The author forgot Python, which should be ideal for a hobbyist programmer (pros too, of course). Hobby programming should be *fun*. Python is fun, and gives you results quickly.
Other thing that irked me was that knowing the syntax, of all things, is not necessary. Was it supposed to be sarcasm?
I recommend k/kdb kinda like python, but even __more__ fun girls love it to! fits on a floppy, easy 2 demo, has built in GUI and web browser.
http://www.kx.com
Why suggest C++ or Java as “languages for the hobbyist”? Why not languages which are either easier to use (Visual Basic, Squeak) or more trendy (Ruby, Python)? I like Java fine, but if someone asked me for advice on what to tinker in, I wouldn’t hand them my 967-page copy of “Java in a Nutshell, 4th ed.” and tell them to go for it.
‘Cuz its really easy to learn the basics of Java, and then, swoosh, off you go. If they’re hobbyists they’re not going to get into the nasty gory details; they’re not doing “enterprise” crap, so why should they even care?
I remember the days of hobbyist computing in the 1980s, with all the various versions of BASIC that started right up and gave you all sorts of neat power. The author presents numerous environments here, but few of them (as far as I can tell) are INTERPRETED languages. If you really want to experiment with what a computer can do, you need to have an interpreted language that does some neat things right out of the box and that comes with a solid manual with short but fun programs. Most of the environments he presents — for C#, Java, C++ — are based on compile-only languages, and in any case it’s a bit of a chore to get them to do anything fun, and the manuals don’t come with program listings that will do anything fun.
I don’t know enough about VisualBasic to know whether it’s as easy as the BASICs of yore, so maybe that would be a nice start. But the author doesn’t describe it much.
C++ programming seems to be the top dog programming language in the world today. Everyone seems to love C++. C++ is the cadillac of the development world. Its fairly simple to learn, not as simple as C# or Visual Basic, but if you ae a quick learner you will pick it up in no time.
C++ is not fairly simple to learn, unless you’re talking about the simplest, most mundane features of C++. Other languages that are far simpler to learn, that don’t require bizarre features such as copy constructors and C-style pointers, and that come standard with a “safer” environment. Eiffel comes to mind, as does Logo (although Logo is generally less useful). If I knew anything about scripting languages, I’d probably mention a few of those. THAT’S where hobbyists ought to be looking to learn some programming.
All IMHO of course.
I think a hobbiest programmer (i.e,, kid), would be best served using one of the popular scripting languages first. Usually easier to debug, interpreter can be used interactivly, and it’s easier to get up and running with your simple programs.
http://mindstorms.lego.com/eng/default.asp
Expensive, though. Requires Windows, too 🙁 bummer
Is there a Python implementation for .Net?
@ Roberto J. Dohnert
Can I have a copy of your wallpaper?
Out of the ones available, I like Python best.
As far as GUI programming goes for Python there’s always Glade, but keep an eye open for the Glade 3 clone named Gazpacho.
http://gruppy.sicem.biz/componentes#gazpacho
It is written in Python, and is showing lot of potential, arguably more so than Glade itself.
This is a “What the heck?” article…
Hobby with C++? dude… come on…
He finally mention Eclipse, almost as a footnote meantime filling 2/3 of the article with advertising…
And ofcourse, let’s not forget Python…
I’ve been programming for like a decade and I’ve been through BASIC, Pascal, C, C++, Java, and Python…. always an evolution.
My advice, If your’re looking for a programming hobby… get the following:
Python from:
http://www.python.org/
wxPython for GUIs from:
http://wxpython.org
and SciTE (got to have something to write the code with) from:
http://scintilla.sourceforge.net/SciTE.html
after that, join the mailling lists
http://wxpython.org/maillist.php
enter the IRC channels
#python, #wxpython on irc.freenode.net
and read some tutorials:
http://www.hetland.org/python/instant-hacking.php
http://www.ibiblio.org/obp/thinkCSpy/
No money… more fun
There’s IronPython (www.ironpython.com) and Boo (http://boo.codehaus.org/); IronPython has yet to see the light of day, but Boo is quite functional already. Boo is “like” Python, but not exactly Python. Very close, though.
I second the other comments: I’m a professional software engineer for mission critical tier 1 telecom products, using C++ on a daily basis. Despite its shortcomings, it’s still a good choice for this type of professional work (transaction performance being a high priority).
However — I would not recommend it at all for any hobby work. C++ is deceptive: it may seem easy to learn, but for the uninitiated it is _easy_ to fall into traps that require an expert to help you out of — it has no padding or safety features :-). These are not the kind of obstacles you want as a hobbiest. Even C using pseudo OO is better than C++ for a hobbiest: less chance in C that you’ll suffer from some strange object slicing or related problem.
I wouldn’t even recommend python either, I think it too terse and idiosyncratic. You need a language like perl or php: that’s flexible and actually somewhat forgiving, but even these have their shortcomings. I hate to say it, but VB is probably a good recommendation.
For the hobbiest: the language needs to be:
(a) quite fault tolerant (i.e. garbage collection), and not allowing strange traps (with perl and C++ you can easily get lost in strangeness).
(b) powerful and simple, all sorts of kitchen-sink tools and utilities (perl and php good here).
(c) not requiring too much “infrastructure” (e.g. java environment …).
(d) scriptable and interpretation, quick and easy to hack up things (perl good here).
By no means a complete response to the post. If someone were really interested in addressing hobbiests, they’d dissect (a) who the hobbiests are, and classify them, and identify what they do, etc; (b) survey the languages, and their pros and cons; (c) use a couple of “sample” use cases — i.e. what would a hobbiest use the language for?; (d) distill all of this into a table like a consumer product review.
I read the article, and have to agree that Python might be a better ‘hobby’ language. Been using it myself lately and really enjoy it.
As a side note, your XP widgets/taskbar are different from the standard (I like yours). What are you using to change them?
Thanks
PowerBasic – fast as C for a lot of things. Full Windows programing. No DLLs. Complies down to complete stand alone EXE of only a few K.
<a href=”http://www.powerbasic.com/“>PowerBasic
@ Stan
He’s using the leaked Royale Visual Style from Windows Media Center 2005 edition.
You can get it at the usual places.
excellent hobbyists language: assembler…
will bring the coder some exciting times for sure and it’s rare nowadays.
@ Ronald
Thanks. Found it, installed it. And its Steve, not Stan.
I first started programming back in the 286 days with basic and Turbo Pascal. I’m now learing C.
I tried using modern IDEs, but they are very complex and confusing, and you need to learn loads about X or GTK just to draw a single pixel on the screen.
So, I simplified the whole lot. Pico is my editor, and SVGAlib gets stuff on the screen.
It’s very simple to get graphics working with svgalib, and pico does not generate trillions of files and headers, all I see is the few lines of code I’m working on.
Modern programmers will probably laugh at this, but it really is much simpler, instant, and more fun for a beginner than jumping straight into a big IDE.
Hey guys, some have expressed interest in the theme and on the comments someone wanted the wallpaper. The theme is the Royale theme from Windows Media Center edition 2005. It can be downloaded from:
http://www.geocities.com/rjdohnert/computer.htm
just scroll down and I have the download link
For the wallpaper it is called Plasma, it can be downloaded from:
http://www.geocities.com/rjdohnert/wall.html
Also scroll down and get it.
Just to contra-balance the nay-sayers 😉 C++ can certainly be a hobby language, or rather, any language can be a hobby language.
It all depends on what you want to do, how long it can take and how challenging you want it to be.
If you are a complete novice, you could start with a simple basic. If you did basic in the eighties (as the author implies to have done and as I have done), you would probably like C family languages by now (C/C++/C#/Java, whatever). Or maybe Pascal or Delphi.
If you’re going for web stuff you could go PHP or ASP and add Perl if you’re into torture (that’s a joke Perl fans!).
It really doesn’t matter, since it’s all about hobby programming. Work is a different cup of tea. The author does a fine job relating what he sees as good tools related to his hobby (some annoying typo’s though).
Let me just mention
http://www.thefreecountry.com
which is a great resource for these types of tools and other related stuff.
C++ programming seems to be the top dog programming language in the world today. Everyone seems to love C++. C++ is the cadillac of the development world.
It’s a stretch to say “everyone seems to love C++.” Of the people I know, I’d say more people hate it than love it. Personally, I don’t love it, but do think it’s a local maximum in terms of power among “popular” languages. As far as car analogies, I wouldn’t say Cadillac, but rather Ford Explorer. It’s ubiqtuous, reasonably powerful, a little cheap-feeling, reasonably safe when used correctly, horrendously unsafe when used incorrectly.
@Marc van Woerkom: I like C++, but it’s development has somewhat stalled in the past. While C++ is a good compromise between speed and abstraction, other languages focussed on different aspects.
I like C++ too (but not “like like”, for those who remember elementary school but it’s an absolutely terrible compromise between speed and abstraction. It is that way for the exactly the reason you mention: “it’s development has somewhat stalled in the past.”
C++, as a language, is designed so a compiler doesn’t need modern optimization technology to get good performance out of it. It only offers abstractions when simple optimizations (mainly, inlining) can get rid of the overhead. That design makes the abstractions rather spotty. For example, in C++, there is a “virtual” keyword to tell the compiler when a method might be overridden by a derived class. This is to eliminate the performance overhead of having to generate an expensive virtual call for every method, even ones that aren’t overridden. Modern compilers can easily derive this information on their own, which leaves “virtual” as just a wart on the language necessitated by dumb compilers. There are lot’s of other warts in the language (eg: nearly all the limitations of templates), that exist only because C++ has to assume a dumb compiler and linker combo.
Im not really proficient with Python, I dont use it, so I didnt want to mention it because if I dont know it, I dont know what it can do. Really the only thing I do know about Python is that it was written by Guido Van Rossum. As for Java and C++ I mention them because merely because the tools are available and if someone wants to use their time to learn C++ and Java then so be it, C++ is easy enough for me but maybe because I am proficient in it I dont find it hard. Im sorry is I left out some things of importance and if I didnt mention your language of choice please dont take it personally.
Well when I was one of those hobbyist programmers back in the 80s,we did the real fun stuff on our 8bit micros in pure mc, coding happily away in assembler. You know MONS, GENS and the like. Then the Amigas and STs came along – so much power, with real C compilers… but at the end of the day it was asm too, since MC68K assembly looks pretty much like an HLL compared to Z80… ahh the memories!
I think C++ is a suitable language for hobbyists. It just depends on your hobby. I would recommend C++ for use in games or 3d graphics hobby development. First, most of the APIs for games and graphics are in C or C++. Second, the performance of C++ and optimization possibilities are a good reason to choose C++ for this type of hobby. If you are doing cross-platform C++ development, check out Borland’s free cross-platform C++ IDE, C++BuilderX Personal. It supports a number of compilers and debuggers, including Borland, GCC, (Microsoft, Intel, Sun in the pay for editions) etc. unlike the Eclipse C++ which at this time only supports GCC. You can download it here: http://www.borland.com/products/downloads/download_cbuilderx.html#
C++ can be quite easy depending on what subset you use.
Most of the time I think people learn C++ from the wrong side and begins by learning its low level C subset and then moving to classes. While you’ll probably be more confident at the end with some complex features such as pointers, memory management, copy constructors, etc; it’s still very error prone and not very fun.
I think that one can learn C++ easily by first learning to use the standard library without reinventing the wheel. And only then going deeper in the matter if he’s willing to. Plus this way you can do advanced programs quite rapidly.
As an advanced C++ programmer, I almost never use pointers, new/delete, copy/constructors, destructors, etc. Mostly everything can be done by using the standard library, and C++ implicit operators will do the rest of the job (it’s more efficient too). The main mistake of a lot of C++ programmers is to uselessly reinvent the wheel.
I think that the only key feature of C++ that really cannot be easily mastered is template/meta-programming.
I wrote my first large programs in GFA basic on ATARI ST in the mid 80’s. With the C# last year, I found again the same good sensation than I lost since the GFA Basic period. The C/C++ was closer to my early 6502’s days, efficient but not elegant. C# is fun, more fun than Visual Basic.Net even if it’s very close. Foth was also fun in the 80’s, more advanced than current Basics.
Never had fun with Java, bloated, slow and too verbose, nor with all these languages with a ‘$’ in the variable names.
I started my hobby coding back in about 1984 or so with my Commodore Vic-20, moved up to a Commodore 64 after a lightning storm killed the Vic.
Back then when you bought the computer it came with BASIC built in and the manual that came with it taught you how to code. There were also many magazines out at the time that contained code you could type in. I believe the mag I read was Family Computing, had plenty of Commodore programs in it.
Since then I’ve moved on to PASCAL, C, C++, RPG and FORTRAN while getting my engineering degree. Then I moved on to Assembler and COBOL. From there I went to VB, then to Java, now I’m full time Java/.NET. But it all started with the 8K RAM Vic-20.
@GPSnoopy –
You make an excellent point about using the standard library in C++. It makes programming C++ soooo much easier, and can be as easy as Java, VB, Python, etc.
The Standard Template Library, specifically, is a true work of programming art, as far as libraries go. Many of the brightest minds in the programming discipline (Bjarne Stroustrup himself included) spent years perfecting the STL. But then people turn around and not use it, constantily reinventing the wheel, using lots of pointers, copy constructors, direct memory management, etc. and falling into the usual potential pitfalls of C programming.
The problem is that people usually learn C++ with a bottom-up approach, first learning the low level stuff, then moving up to objects and templates, etc (and that’s the fault of most C++ books and classes – learn C in C++ first, then learn objects and templates and the library).
What should be done is people should be taught with a top-down approach, learning the STL right off the bat, along with basic syntax. Then the new learner doesn’t have to worry about pointers and/or arrays (along with direct memory allocation) when using strings. Or the new learner doesn’t have to worry about array bounds issues, by using the Vector template. There are many other examples of this higher level abstraction (without loosing much in efficiency and even gaining efficiency is some cases) as well.
There is one book out there that does this top-down approach: “Accelerated C++”. It teaches the STL immediately, putting it into a context of solving common, simple problems, seamlessly integrating it into “Hello World” style learning examples. This book doesn’t even get into pointers until the second half of the book. Frankly, anyone who says C++ is “too hard”, or anyone who codes with C++ and runs into common pitfalls, should read this book.
Stroustrup’s book, also, is a great example of taking the right approach, only on a more advanced, in depth, ultimate language definition level.
These two books combined put my C++ understanding and proficiency onto a much higher plain, to the point where I’m completely comfortable with C++ and making it my favorite language (when I used to think it was too hard and bloated). I’ve learned that C++ can be as low level and powerful and efficient as you want, or it can be as high level and productive as you want, without these two categories being mutually exclusive.
People who bash C++ typially just haven’t learned it in the best possible way.
“””People who bash C++ typially just haven’t learned it in the best possible way.”””
The people who bash C++ are often the ones most proficient with it – neophytes don’t usually even know of all the evil lurking beneath the surface. I also used to think that C++ was ok when I was younger and less experienced.
Anyone who doesn’t think C++ sucks should read “Effectice C++” and “More Effective C++”.
Also, STL doesn’t rescue C++. In many embedded environments STL is not available at all. Many tookits don’t use STL. Most open source C++ projects don’t use STL. Most C++ coding done in the industry involves lots of legacy code maintenance where STL can’t be trivially adopted. I agree that STL seriously rocks, and it’s the only saving grace C++ has going for it.
My advice – if you know C++ already and have a C++ job, don’t quit it. If you don’t know C++ and don’t yet have a job, learn something else. You’ll probably live a happier, easier, longer life.
I used to be a Windows kid. *sigh*. I got a copy of Visual C++ 6 with some book and I had learned how to use it. It was a truly great IDE. I especially loved their word-completion feature.
But then I switched to Linux. Where the hell was the compile button!? Since switching to Linux, I’ve learned a lot about GCC, linking and other things Visual C++ kept from my view.
Honestly, I’d say most hobbiest programmers only really need Kate, which is just a standard text editor with syntax highlighting,the ability to open and view several files at the same time, and a built-in shell. I’ve seen lots of hobbiest programs, and their source code, and it’s usually not too large and not to hard to find what you are looking for in the source.
As far as hobbiest programming languages go, I really can’t comment. I started in LOGO and BASIC in elementary school, and then just learned C++. LOGO teaches you that the computer does what you tell it, no more, no less, and BASIC teaches you about procedural programming, no more, no less.
@JeffS
Yes and No. Even with STL, string manipulation is still a mess, and simple methods like ToUpper, ToLower are still missing. Frankly, can you say that:
transform (MyString.begin(),MyString.end(), MyString.begin(), tolower);
is elegant, when with other languages or libraries, MyString.ToLower() and the job is done ??
And I don’t speak about unicode.
STL are not for hobbists, it is just for unix gurus.
I agree that hobbyists (or “nobbyists” near the end of the article… ) are a few steps away from C++ generally. When I was a not-bad QBasic programmer, I sent a letter to Apogee (back in the day!) asking them what language they made games like Monster Bash in. They said some proprietary thing, but that I should try C++. So I invested $137.50 in Borland Turbo C++ for DOS, and never figured out how to use it before it became obselete. Now I code in C++ using free tools on other platforms, like BeOS, but I had to learn it three times before I got it, and I’m still learning…
It is sort of related to the discussion, so I might as well toss it out there. I’m working on a project called JiggleScript. The home is here:
http://www.jigglescript.com/
Basically I’m using JavaScript to interface with OpenGL and other libraries. Over time I want to clean up the API and such, but its pretty cool right now if you’re careful. 🙂 My girlfriend’s brother has been doing some pretty amazing stuff with it. I just wish more people were poking around with it. 🙂
Oh, and its available for both MacOS X and Windows and the same scripts will work the same on either platform. (Well, within reason, there are some OpenGL differences and such.)
I agree with you about this generally, but I have to take exception to this point:
or it can be as high level and productive as you want
There is an abstraction ceiling built into C++ by the limitations of the language. Once you really start pushing the modern techniques, you hit a wall in what you can do. If you follow the path of the STL, you realize that you want lambdas and closures, and Boost.Lambda just doesn’t work well enough. If you start heavily using template metaprogramming, you realize you want real procedural macros, and the hacky tricks you can do are just too much trouble for too little gain. If you follow the object-oriented aspects of C++, you start to miss dynamic typing, and run up against all the limits of the object model, like the fragile-base-class problem. If you start heavily using the container classes, you realize that you can’t use polymorphism with them without using smart pointers. When you start using smart pointers in containers, you run up against all the hassles of now having two levels of indirection whenever you need to use an iterator.
In general, C++ gives you a lot of power in abstraction, but it’s a far cry from being as “high level and productive as you want.” Especially in the context of hobbyist languages, where the “popularity” aspect isn’t as big of a deal, there is little reason to deal with those limitations when there are much more suitable languages available.
Can’t a free STL implementation be used then ?
There is the SGI one (a bit outdated though) and STLport for example, but I dunno if they can easily be used in embedded env.
Nice summary article.
Is it just me or are all images out of sync with the text?
For example the XMLSpy screenshot appears on the conclusion paragraph, etc.
Chris Page did a pretty excellent analysis of the points in Meyers “Effective C++”. The comments are in regards to C++ vs Dylan specifically, but the discussion is general enough to highlight some key weaknesses of C++.
http://homepage.mac.com/chrispage/iblog/
The problem is that lot’s of compilers still aren’t good enough to handle the STL. You’re okay if you’re working on something with a port of g++, but there are still embedded systems where you can’t choose the compiler. Also, there are a huge legion of C and C++ programmers who still aren’t comfortable with the STL, and don’t allow modern techniques in their projects.
last year i started my first year at 6th form and as coursework for computer science we had to learn QBasic (my school cant afford anything better…) and write a sort of database program. im still not very good at it and it may be old but its still fun .
There are interesting comments above. Sure C++ is complex. Someone can start learning C++ with its hairy syntax and only start learning the complex stuff after a while. A beginner would be best limiting him/herself to a subset of the language.
From a beginner point of view, it would be better to start with a more high-level language though or even scripting language. This way the beginner can start focusing on programming algorithm rather than loosing despair with the complicated syntax and convoluted idiosyncrasies of C++.
Ideally a beginner should look away from C++ first, anyway, unless the idea is to be able to get a job asap. Some programming concepts can be grabbed more easily by looking at Smalltalk, Lisp or ML/Haskell in the first place and then eventually going back to C++ via Java or C#.
To focus back to the article and the review of the different environments available, the one major difference is how much the editor is going to actually help the beginner.
For example the Java part of Eclipse has native support for refactorisation — this is a major help imho, even for a professional programmer. Most editors, including VS.Net, don’t go far enough. Sure Visual or XCode gave auto-completion, for example, but that’s not enough. Current tools could go farther:
– automatic generation of doxygen-like documentation with graphical representation of class hierarchies and graphical representation of dependencies between classes.
– refactorization tools: renaming, extracting, reorganizing, etc.
Eclipse’s JDK is also neat in that it allows one to create new classes or methods by a right click on an unknown identifier, and of course the default templates can be customized. Any thing that helps reduces the actual syntax-related typing and focus on the actual implementation is good to have.
The title is “Programming Tools for the Hobbyist” ; I interpret it as “Free or Cheap Programming Tools”, and in that way this has been a very good reading for me, I love to learn about free tools I did not know. Thanks for all the cool links Robert !
Now a lot of people seem to like Python a lot. I don’t know it, could anyone advise me a good IDE for Python/Windows with a GUI designer ?
Question :
———-
What’s the best way to stop the Microsoft hegemony and monopole over operating systems in the world ?
An answer :
———–
By making free software (free as in free speech) not free (free as in free beer) for Windows users.
Many Windows users say, “I only have to pay Windows, because there is thousands of freeware (so they call free software) downloadable at free of charge” 🙁
I think this (clearly) subjective comparaison is missing the point even though it’s highlighting some pitfalls in C++.
He talks about garbage collection. In C++ you can also use GC, but you have the choice not to use it (which is very important). But it’s often irrelevant, since you almost never need to allocate memory yourself in C++ (see my upper comment).
He’s clearly ignoring references in C++, which accomplish most of what he says about ‘=’ in Dylan.
He’s always saying Dylan is better ’cause you can make a mistake such as with feature X in C++. Again, in C++ you have the choice to use that feature X when you actually need it. Again IMHO, most of the time, people are taking C++ from a pov that is too low level.
This kind of attitude doesn’t to see the philosophy of C++ “what you don’t use won’t hurt you”; and the biggest pitfall in C++ is failing to comply with this philosophy.
The only good point he is making is about the obsolescence of the preprocessor. But seriously, on 8 hours of programming in C++ I probably spend 10 minutes writting preprocessor directives.
I remember the days of hobbyist computing in the 1980s, with all the various versions of BASIC that started right up and gave you all sorts of neat power. The author presents numerous environments here, but few of them (as far as I can tell) are INTERPRETED languages. If you really want to experiment with what a computer can do, you need to have an interpreted language that does some neat things right out of the box and that comes with a solid manual with short but fun programs.
To quibble on a technicality, when you say “INTERPRETED” what you really mean is “Dynamic”. You can have all of the benefits many associate with an interpreted system in a dynamic system that actually compiles the code on the fly for you. Like I said, it’s a quibble.
Back In The Day, your editor started with a “READY” prompt. If you had a more advanced system (Commadore, Atari), you could actually cursor around the screen and edit code that way beyond simply retyping line numbered statements.
The beauty of those systems, besides their basic compactness, was that you were able work with your program in an interactive environment. Run the program, hit BREAK (or put STOP in your code), change a variable, type CONT and move on.
Try out simple code at the prompt, etc. Need to “Unit Test” a function? GOSUB 1000 at the prompt.
Add in some high level routines for sound and sprites, and you were able to quickly get Interesting things with quick results and turn around.
For polished, finished programs, you still had to do “more work”, maybe get into machine language, or whatever.
But the system’s were pretty painlessly accessible.
The biggest curse is that the BASICs didn’t really encourage “modern” structural coding technique. But even then a lot a interesting programs and technique were learned by having access to a “simple” 8K ROM and a READY prompt.
Aw, man. Now I’ll have to work double-time on producing free stuff. ;(
Any language can be a hobby language. I started way back when with assembly then moved on to C.
I got into C++ because of work. And I also learned Ada because of work.
I would say that my hobby language is C++
John
Some good points being made regarding my original post singing the praises of the STL. Here is some follow up:
One poster said you can’t use the STL in embedded environments. True, but trying using VB or Python in embedded environments. Plus, I doubt very much that “hobbyist” programmers are doing too much embbedded stuff.
Also, the STL is not perfect, but it’s there to save tons of time and make the programmer’s life potentially a lot easier.
Sure, there are still other pitfalls in C++, but most of that is due to not using the library.
Another poster objected to my reference to C++ being “as high level as you could want”, saying that it falls short of other higher level languages. This poster (and others) should try QT and it’s GUI design tool, QT Designer. Then use Kate to manage the project, alter code, and compile the program (with Kate’s built in terminal). This is about as easy as it gets, even exceeding VB IMHO (and I’ve used VB, along with VC++, professionally for 6 years).
This gets back to libraries, and adds in good visual tools, to complement basic C++ language facilities, making life easier for the C++ programmer. With proper use of both standard and extension/proprietary liabraries, and good IDE’s or editors, C++ becomes very easy and productive indeed. REally, when you look at it, a language is only as powerful and easy as it’s supporting libraries and tools allow.
Now, all of that said, I would not direct a noobie or a total hobbyist to use C++ as a first language. I would probably point them to Python on Linux/Unix, and VB on Windows. Then I would encourage them to dive into C++ after they get their feet wet, and experience the power, efficiency, and flexibility of this excellent language.
And I’m not a language zealot. I believe in using the best tool for the job. I just like to defend and promote C++, because I’ve discovered what a powerful (and fun) language it can be.
Great language for beginners, powerful language for expert programmers and FUN to work with!
http://www.ruby-lang.org
I think this (clearly) subjective comparaison
Clearly. It’s a marketing piece as much as anything else. However, it was written by someone who knows a lot about C++, and as somebody who has also used C++ a lot, I agree with him.
He talks about garbage collection. In C++ you can also use GC
You can, but not very good ones. The language semantics don’t let you use high-performance generational GCs, just lower-performance conservative ones.
but you have the choice not to use it (which is very important).
Not using the GC is an optimization that should only be made when profiling shows you that you’re spending too much time in the GC. The default should be GC on, with manual management possible (which is what some Dylan implementations can do). Instead, C++ use manual management as the default, with GC possible. This shows in the fact that large C++ projects, to this day, suffer from memory leaks. Mozilla leaked like a sieve until well into the 1.x series, for example.
But it’s often irrelevant, since you almost never need to allocate memory yourself in C++ (see my upper comment).
This isn’t really true. If you’re programming something like a GUI, where you need polymorphism, you have to store pointers in STL containers, so you lose the memory-management benefits of the STL. You could store smart-pointers in the STL containers, but then you’re back to a primitive GC, one that is slow and not transparent to the programmer. That’s just the ideal case. In practice, you have to deal with code written by people who do not use modern methods, and memory leaks and corruption become a fact of life.
He’s clearly ignoring references in C++, which accomplish most of what he says about ‘=’ in Dylan.
References don’t do the “right thing.” In particular, they are not first-class, so you can’t do things like store them in containers, etc. Like many C++ features, they are a partial solution, not a general one.
He’s always saying Dylan is better ’cause you can make a mistake such as with feature X in C++.
It’s not just a matter of being able to make mistake using feature X, but people making mistakes often enough that a C++ luminary had to write a book about it.
Again, in C++ you have the choice to use that feature X when you actually need it.
In a lot of cases, you don’t have that choice. If you actually read all 50 of the points, you’ll see that the majority of them have nothing to do with pitfalls of specific features, but general aspects of the language that you have no choice but deal with.
Take, for example, #22: ” Pass and return objects by reference instead of by value.” Every time you write a function declaration in C, you have to choose between reference semantics or value semantics. If C++ gurus tell you to always choose reference semantics, why does the language default to value semantics? Choosing how to pass values isn’t an optional feature — you have to make the decision each time.
Or, take #14: “Make destructors virtual in base classes.” You don’t really have a choice whether to make a destructor virtual — if there is going to be a derived class, it needs to be virtual. It’s not a choice you can make, just another thing you can accidentally forget.
Again IMHO, most of the time, people are taking C++ from a pov that is too low level.
Aside from the memory management bits, none of the points have anything to do with a low-level view of C++. In any case, the actual advice was written by Scott Meyers, who isn’t exactly a C++ dinosaur.
This kind of attitude doesn’t to see the philosophy of C++ “what you don’t use won’t hurt you”;
That’s the thing — what you don’t use *does* hurt you. C++ is full of little micro-optimizations at the language level, and compromises for dumb optimizers, and you have to be aware of those micro-optimizations in all code you write. Why else, for example, do methods default to being non-virtual? So compilers don’t have to do virtual-dispatch elimination. Why are their multiple forms of delete? So compilers don’t have to elide object headers. Why do the default copying-semantics leak memory in a language that generates tons of copies behind your back? When you initialize a member in the class declaration, why can you only use constant-integer-expressions? So the compiler doesn’t need to execute code during compilation. Why do you have friend functions? Because they had to hack around the “class boundries == protection bounderies” decision, even though the two should have been orthogonal. Why is the “diamond-shaped inheritence graph” possible in C++, and why are virtual base classes necessary? Because without class-hierarchy analysis, dumb C++ compilers would treat everything as a virtual base class, and pay a high performance cost.
Also, the STL is not perfect, but it’s there to save tons of time and make the programmer’s life potentially a lot easier.
No doubt. The STL can be a phenomenally productive tool, when you use it for the right things. It’s great, in particular, for scientific, mathematical, or simulation code. However, the STL isn’t a completely general solution, and C++ in theory is a general-purpose language.
This poster (and others) should try QT and it’s GUI design tool, QT Designer.
Qt is a great tool, but partly because it’s pretty “Un-C++”, with its pseudo-dynamic features. In particular, the STL zealots are always giving Qt flack for not doing things the STL way. However, it doesn’t make up for deficiencies in the underlying language.
This is about as easy as it gets
Oh, it get’s much easier. In particular, Kate + GCC lacks any sort of interactor, where you can type in code and have it execute on the fly. A good interactor remove the compilation step from the “edit, compile, debug” cycle, which makes it great for quicky trying out short, but tricky pieces of code. Any Python programmer will tell you that he has one Vim window open editing the code, and a python shell in another trying stuff out.
Weird. I was just about to mention Ruby too…
Ruby is a great place to start, pure OO, interpretive, easy to code Apps, Web based stuff, servers and so on.
Haven’t used Python, Perl, PHP and so on too much, but from what I gather, Ruby is right up there with these guys, and some would argue better in some areas. A mate here swears by PHP for web based development.
For Linux and Mac, you can run Ruby out the box.
For Cocoa dev, you’ll need RubyCocoa, but this means you can use Interface Builder for UI design (very nice).
For both platforms however, Tk, Gtk (and Glade) and so on are available. Not to mention great XML / Socket / Net / text parsing and database tools (plus many many others)…
For Windows developers, you’ll need something like Cygwin, but other than that there should be no problems (shame there isn’t a purely native version). Not sure if there is any native windows UI support either (guess who hasn’t used Ruby on Win yet)…
Again, we’re talking hobbist programming here right. Ruby is not that good for low level OS coding, writing DLL’s or NT Services and so on. I probably wouldn’t try and write DOOM 3 with it either…
But to get a handle on how to code, OO concepts and so on Ruby is not too bad at all. I’m using it more and more at work to write apps that would normally take thousands of lines of code in no time out all. It’s weird for some of us coders who have been in the game for a while to start using a scripting language for mission critical applications, but you can / should at times….
Having said all that, C / C++ / Objective-C / C# / Java and so on can be excellent hobbist tools, any language can be really, as long as you are prepared to take time to learn the tools, pretty much like any hobby really. The advantage to learning Jave or C++ etc. is that there are so many languages out there with very similar syntax, so jumping to another language isn’t too hard.
In “Effective STL”, Scott Meyers points out that you shouldn’t use smart pointers (auto_ptr) in STL containers (i.e., vector of smart pointers). In fact, compilers should NOT allow it. I don’t know if you’re using auto pointers or rolling your own smart pointers, but either way I question just how savvy you are with C++.
A few people have mentioned Pascal and Turbopascal which nowadays lives on in Borland Delphi (Kylix on Linux). This has an IDE which lets you do full GUI applications with the visual editing tools or simple console applications if you so wish. There is a cheap personal edition for non-commercial use and I have also seen older versions for free with magazine CD-ROMs. Borland’s version of Pascal is object oriented and has fixed some of the old problems with Pascal (255 character strings etc.) too.
My personal tool of choice for creating a complete application.
Oh, it get’s much easier. In particular, Kate + GCC lacks any sort of interactor, where you can type in code and have it execute on the fly. A good interactor remove the compilation step from the “edit, compile, debug” cycle, which makes it great for quicky trying out short, but tricky pieces of code. Any Python programmer will tell you that he has one Vim window open editing the code, and a python shell in another trying stuff out.
Now you are comparing apples to oranges. You are talking about the advantages of an interpreted, scripting language, over a compiled language like C++ (which has advantages all it’s own). What you are describing is one of the purposes in life for a scripting language. A compiled language, by contrast, is better for fast executing programs, systems programming, games programming, rich GUI interfaces, etc.
Pluses and minuses to both.
It’s not just a matter of being able to make mistake using feature X, but people making mistakes often enough that a C++ luminary had to write a book about it.
With great power comes great responsibility.
Taking away feature X for the sake of safety is all fine and good, but then you have a less powerful language. In other words, I will gladly take the potential pitfalls of feature X if feature X will enable me to do things (at least do them well) that other languages would allow me to do (at least do them well).
Stroustrup makes this point on his website:
http://www.research.att.com/~bs/bs_faq.html#remove-from-C++
http://www.research.att.com/~bs/bs_faq2.html#memory-leaks
I just finished writing about Ruby, but failed to mention Delphi. I use Delphi for most of my Win coding, which includes DLL’s, NT Services, client/server and Win Apps. I’ve never used it for Linux dev, but that’s there too, and now version 8 does .Net nicely too (sort of do it with 7).
I mention these just to say that even though Delphi is easy to use and learn, it’s very scalable as well, generates fast standalone code, is OO (single inheritence) and (if I can use this world) fun.
Scripting languages like Ruby and compiled languages like C/C++, Delphi and so on mix well together too…
I guess the choice of language comes down to your applications target, standalone app, service, web based, platform and so on…
Pretty much any language out there has it’s merits and can be used by hobbyists…
Personally, I prefer Objective-C for compiled languages, Ruby for scripting and Delphi on Windows (as Objective-C isn’t that native over there)…
Good luck…
. You are talking about the advantages of an interpreted, scripting language, over a compiled language like C++
1) There is no such thing as an interpreted language or a compiled language. There are only interpreted implementations or compiled implementations.
2) I use Python as an example only because people are familiar with it. Python achieves interactivity by being interpreted, but in general implementations don’t have to do this. If you have an incremental compiler, one that only recompiles the parts of the program that have changed, you can generate native-code fast enough for an interactive prompt.
It is true that C++ is far from ideal and contains lots of legacy “cruft”. Part of the reason is that C++ wasn’t designed from scratch, but evolved ( something like “C”->”C with classes”->”templates”->”STL” ). This might make it a difficult learn (esp. for the so-called “newbies”).
But not all hobbyists are newbies and for some C++ is an excellent tool. I’ve been a hobbyist for nearly 20 years (my first languages were Sinclair Basic and Z80 assembler). Now I usually use C and (sometimes) C++, and I don’t feel a great need to switch to Visual Basic or Logo.
In “Effective STL”, Scott Meyers points out that you shouldn’t use smart pointers (auto_ptr) in STL containers (i.e., vector of smart pointers). In fact, compilers should NOT allow it.
auto_ptr is just one type of “smart pointer” and not a very “smart” one at that. I’m talking about reference-counting smart pointers, like Boost’s shared_ptr? You know, the kind that were recently incorporated into TR1? You *did* know that, didn’t you?
I don’t know if you’re using auto pointers or rolling your own smart pointers, but either way I question just how savvy you are with C++.
Would you like something, to, um, wipe that egg off your face?
There is no such thing as an interpreted language or a compiled language. There are only interpreted implementations or compiled implementations.
Is there a compiled implemenation of Python? How about Perl, PHP, Ruby, etc? I have not heard of such implementations. I’m just curious.
Now, I do know that Lisp compiles to machine code, while still being interactive, Python-esque, at design time. Also, with GCJ, you can compile Java to machine code and avoid the JVM all together. And VB (at least VB6) gives you the choice of going native or going interpreted.
But I still maintain that comparing Python and C++ is like comparing apples and oranges. They are two completely different animals (other than both being programming languages) used for (usually) different things.
My first program when I was a kid was a QBASIC gravity/solar system simulator I built using the gravity forumla from my brother’s physics book. Ahhh the joy of seeing it work for the first time is something I’ll never forget. I celebrated by downloading inappropriate pictures from a Bulletin Board System using my 1200bps modem.
Taking away feature X for the sake of safety is all fine and good, but then you have a less powerful language.
Two points:
Most high-level languages (and I don’t mean Java!) can do everything C++ does, with fewer features. Instead of little, special-case features, they use more powerful, general-purpose features. Instead of having pointers at the base of the language, in the off-chance that you might need to do some memory-level manipulation to talk to a hardware device, they just have special objects that represent machine words, and some special functions to write them directly. Instead of having lot’s of features like “virtual”, which are just optimization hints to the compiler, they depend on smart compilers that can figure them out. The key weakness of C++ isn’t that it allows you to deal with low-level issues (big deal, so do many other languages), but that it *forces* you to deal with them. As Eugenia likes to say “defaults matter”, and the defaults in C++ aren’t optimized for what most programmers do.
Is there a compiled implemenation of Python? How about Perl, PHP, Ruby, etc?
There is a .NET implementation of Python, and .NET does have an ahead-of-time compiler. PHP5 has a native-code compiler via the Bigloo compilation system.
Now, I do know that Lisp compiles to machine code, while still being interactive, Python-esque, at design time. Not just Lisp, but Scheme, Dylan, SML, Ocaml, Clean, and half a dozen others.
But I still maintain that comparing Python and C++ is like comparing apples and oranges. They are two completely different animals (other than both being programming languages) used for (usually) different things.
Python is a language, and C++ is a language. Thus, you can compare them. In particular, a lot of people find Python absolutely wonderful for writing GUI code, and GUI applications are a big part of C++’s market. Basically, in any situation where speed isn’t a crucial factor, Python is a viable competitor to C++.
This shows in the fact that large C++ projects, to this day, suffer from memory leaks. Mozilla leaked like a sieve until well into the 1.x series, for example.
It’s not because a project in C++ has troubles with memory management that it means that C++ mem man. is flawed, it only means that Mozilla devlopers had problems with their code.
Most programmers/projects in the opensource community have an heavy C legacy that plays against them when programming in C++.
I still maintain that I’ve never felt the need for GC in projects I’ve worked on. And it also includes GUI.
Polymorphism can be managed by smart pointers, but also most of the time by object pools.
Case where you can’t do otherwise than using a GC do exist.
But then I don’t say that C++ is the right tool for everything, personnaly I wouldn’t do a GUI in C++; but programs are more than just the GUI and one may consider C++ for the rest too.
When having to use code written by someone else, for example an API in C, it’s very handy in C++ to have smart pointers that automatically know what function from the API to call when the object gets out of scope. Something you cannot do in Java for example (and most APIs are in C).
Real example: this made the code of projet using libxml about three time smaller.
References have their short coming in C++, but most of the time they get the job done.
When you can’t use references, I fail to see how Dylan (but Java) with implicit pointers make it so much easier than explicit pointers when you only need a reference to an object (ie no complex pointer arithmetics), apart from not having to type ‘*’.
About the 50 points, most of the time, most of them are not applicable because you don’t use the features that are discussed since you’re more likely willing to work at a higher level.
Also there are points that are obsolete. Ex: checking the value returned by new, since when in Standard C++ new does return a value by default?
Again in C++ you have the choice of working at a higher level using existing libs (the std lib + boost already make a nice package, not counting all thousands others), or to use a low level feature when you need to.
#22 A non issue really. In C++ the three most used methods are:
const reference: the prefered method most of the time if you only need to access an objet.
reference: when you need to modify the object
value: when you need a local copy of the objet.
There are other cases, but these are the most common. Asking one if he should do “reference” or “value” is the same in any language; for example in Java one still has to think whether he needs a local copy of the objet or not.
I fail to see how in any otger language it’s different, a programmer still has to wonder about what he is going to do with the arguments.
#17 A really bad advise. By default one should not even define a destructor, let alone a virtual one.
A virtual destructor is only needed in dynamic polymorphism, which represent only a small fraction of the designs used in programmation.
Stroustrup also suggests not to define (virtual) destructors when not needed.
Discussed points such as copy constructors, destructors, assignment operators are low level and rarely have to be used.
Most of the other highlighted subjects are good programming practice in C++, and you’ll note that at least 1/4 of all points (if not more) are also applicable Dylan as well as other programming languages.
You seem to be always preaching that C++ was designed for dumb compilers.
I beg to differ, most of the C++ features are only implemented in recent compilers and ask for advanced compiler technologies (templates, code optimisation, etc). Just see how GCC 3.4 and VC8 are only now getting close to what a C++ compiler should be. I wouldn’t call GCC or VC “dumb”.
Also, C++ was designed with the choice of using micro-optimisation. If you don’t use them, the compiler has to figure it out for itself (which, btw, isn’t always possible). In Java for example, you can’t use these micro optimisation, which leaves the compiler clueless.
Compilers have made many advances over the years, but a lot of optimisation are theoraticaly impossible without a bit of help from the programmer, dumb compiler or not.
Even when possible, a compiler with good clues about the code will always do better than a clueless one.
In so I don’t see C++ as a language for dumb compiler, but as a language that requires programmers to understand what he is doing instead of “code n pray”.
Again, C++ gives the choice to the programmer to express himself instead of “don’t worry our God compiler is taking care of everything, even though it’s impossible for us to know what you really want to do if you don’t tell us”.
Most high-level languages (and I don’t mean Java!) can do everything C++ does, with fewer features. Instead of little, special-case features, they use more powerful, general-purpose features. Instead of having pointers at the base of the language, in the off-chance that you might need to do some memory-level manipulation to talk to a hardware device, they just have special objects that represent machine words, and some special functions to write them directly. Instead of having lot’s of features like “virtual”, which are just optimization hints to the compiler, they depend on smart compilers that can figure them out. The key weakness of C++ isn’t that it allows you to deal with low-level issues (big deal, so do many other languages), but that it *forces* you to deal with them. As Eugenia likes to say “defaults matter”, and the defaults in C++ aren’t optimized for what most programmers do.
Java has succeeded on the server side, with J2EE, with specialized, dynamic, browser based in house business applications. And Java is being used in smart phones. Java has failed everywhere else.
C and C++ have succeeded fabulously in every arena they’ve entered. As for C++, here are some major examples:
http://www.research.att.com/~bs/applications.html
Java can’t even touch this (only partial) list. So it stands to figure, based on actual real-life software and results, that C++ is much more capable than Java (I won’t go into specifics – I’ll leave that to Stroustrup’s website, and other reference sites). And I’m not knocking Java – it’s good at what it was designed for. While it might be true that Java can do many of the things C++ can do, in most cases it doesn’t do them nearly as well.
Also, C++ does not “force” you to do low level stuff. I have written some fairly decent sized programs that utilized the STL, with nary a pointer or dynamic memory allocation, with similar productivity (speed of development) that I acheived with VB.
C++ can be a powerful, efficient precision instrument. And it can be a fairly easy to use tool with very nice high level abstractions.
And do I care whether or not you like C++? No. If you don’t like it or if your job does not require it, then don’t use it. Personally, I like C++, as well as other languages (including Python), and I try to use what’s best for the job at hand.
http://flatassembler.net
for c/c++ IDEs theres devcpp at bloodshed.net. Its pretty nifty.
hobbiests are not necessarily pansies. just because a hobbiest does something for fun does not necessarily make them any less intensive in doing so. these proposals for dumbed down easy to use languages are quite laughable.
ship in a bottle hobbies, model painting, these people exercise far greater meticulousness than all but the most anal retentive of programmers.
i fail to see how linux itself is anything less than hobby programming.
It’s not because a project in C++ has troubles with memory management that it means that C++ mem man. is flawed, it only means that Mozilla devlopers had problems with their code.
It’s not just Mozilla. It’s pretty much guaranteed that a large C++ project will have memory leaks. The ACE CORBA ORB, for example, is a very mature, widely-used, well-tested piece of code, but still leaked memory in our application.
When you can’t use references, I fail to see how Dylan (but Java) with implicit pointers make it so much easier than explicit pointers when you only need a reference to an object (ie no complex pointer arithmetics), apart from not having to type ‘*’.
The first order effect is indeed the necessity of specifying indirection. In code with heavily-linked and deeply nested data structures (something unavoidable in certain types of code), this extra syntax does become a problem. In such code, thinking about whether you need to use “.” or “->” distracts you from the logical of the code.
Beyond that, you have to consider higher-order effects. Explicit pointer types means that you double the number of types you have to deal with. It creates a difference between “foo*” and “foo”. C++ exacerbates the problem with reference types, which triples the number of types in the system. The net result of this type proliferation is that instead of knowing that bar() takes a “foo”, you have to know which of the dozen variations of “foo” bar() actually takes. Again, this is cognitive overhead that has nothing to do with the logical of your program.
Perhaps the worst higher-order effect of explicit pointers is that it makes higher-level optimization very difficult. That means that the programmer has to do micro-optimizations that the compiler could easily do itself, were it not for those cursed pointers. Basically, anything that changes the memory layout of objects is out of the picture, which precludes stuff like auto-unboxing (to get rid of the overhead of using objects vs primitive types) and auto-stack allocation.
About the 50 points, most of the time, most of them are not applicable because you don’t use the features that are discussed since you’re more likely willing to work at a higher level.
Very few of those points are about “features.” They are about unavoidable aspects of the language. Praytell, who do I avoid dealing with choosing parameter passing methods by working at a higher level? How do I avoid specifying “virtual” methods and “virtual” base classes by working at a higher level? How do I avoid having to deal with pointers (without sacrificing polymorphism), by working at a higher level?
Asking one if he should do “reference” or “value” is the same in any language;
As Scott Meyer says, you almost always want reference semantics. If you really need your own local copy, you can copy it yourself. It makes sense to optimize for the most common case, and C++ doesn’t do this.
#17 A really bad advise. By default one should not even define a destructor, let alone a virtual one.
RAII is a key paradigm in C++. Stroustrup himself says so. Destructors are the chief way RAII is implemented. In any case, when you find out later that you need to implement a destructor in a derived class, you’re hosed.
A virtual destructor is only needed in dynamic polymorphism, which represent only a small fraction of the designs used in programmation.
Dynamic polymorphism is a key component of OOP. If C++ purports to support OOP, it should support it properly. Certain types of code really need polymorphism (GUI code, in particular) and C++ just is far too limited for those applications. You wonder why Cocoa programmers (who use the Smalltalk-inspired Objective C) can’t stop raving about it!
Discussed points such as copy constructors, destructors, assignment operators are low level and rarely have to be used.
In object-oriented code they do. Every time you define an object, you have to consider whether the auto-generated constructors and destructors do the “right thing.” Even if you don’t call them, the C++ compiler will. If you’ve got a pointer variable in your object, you’re going to need to deal with those special functions.
I beg to differ, most of the C++ features are only implemented in recent compilers and ask for advanced compiler technologies (templates, code optimisation, etc).
Templates aren’t an “advanced compiler technology.” They are a rather weak form of macros, something which tons of compilers have. The only reason most C++ features are only now starting to get implemented is that the language semantics are a rat’s nest of special-case features, and the syntax is completely unparsable.
Just see how GCC 3.4 and VC8 are only now getting close to what a C++ compiler should be. I wouldn’t call GCC or VC “dumb”.
You have to distinguish between machine-level optimizers and language level-optimizers. In GCC and VC, the language-level optimizers are quite dumb. Basically, the only thing they do is inlining. They don’t do any dynamic-dispatch elimination (eliding virtual calls), any unboxing analysis (inlining the storage of pointed-to values), type inference (figuring out the concrete type of a pointed-to value), partial specialization of methods, etc, etc.
Also, C++ was designed with the choice of using micro-optimisation.
No, you don’t get the choice. If you want polymorphism, you have to use pointers (since references aren’t the same thing). If you define a class, you have to explicitly use the “virtual” keyword to get sane semantics. You have to make a distinction between heap and stack allocation. The STL is one big micro-optimization, with iterator types that don’t even derive from a common base class, containers that derive from a common base class, etc, etc. SGI even went and made the “concept and model” method of describing the containers in their documentation, which bears a very striking resemblance to a class hierarchy, with the exception that it’s not actually in the code, and the compiler can’t actually enforce it!
Indeed, the “concept and model” method highlights the fundemental weakness of the STL — they realized that it would be nice to have an object-oriented framework to put these containers in, but since C++ compilers were so dumb, the performance would have been too bad actually make it OO. So, instead of having a proper OO framework for the STL, one that can enforce the “concept and model” paradigm in the language, you have critical semantic relationships about the code buried in the documentation. It also means that those implementing their on STL-compatible containers and iterators have to essentially start from scratch, instead of being able to inherit the behavior of an existing container or iterator. Boost even has a helper-library to do this conceptually simple thing, because in their own words: “Writing standard-conforming iterators is tricky, but the need comes up often.”
In so I don’t see C++ as a language for dumb compiler, but as a language that requires programmers to understand what he is doing instead of “code n pray”.
It’s not a matter of “code n pray.” It’s a matter of the programmer specifying “what to do” instead of “how to do it.” I get paid to implement the logic of the program (the “what”), not machine-level details (the “how”). If the details of how the job get’s done really are that important (and they rarely are), an experienced programmer can get the compiler to generate the code it want’s, because they know how the compiler works. If even that fails, and now we’re talking about an “0.1% of the time” thing here, there are usually special libraries that let you access machine words directly.
“[…] Mozilla leaked like a sieve until well into the 1.x series, for example. […]”
I have not much knowledge on this topic, but i’m eager to know the following: if you had the interest, time, money, developers agreeing with the choice, etc — what language would you use to develop that browser? And more important: why?
Why suggest C++ or Java as “languages for the hobbyist”? Why not languages which are either easier to use (Visual Basic, Squeak) or more trendy (Ruby, Python)? I like Java fine, but if someone asked me for advice on what to tinker in, I wouldn’t hand them my 967-page copy of “Java in a Nutshell, 4th ed.” and tell them to go for it.
Why not VB? Its not cross platform. It may work on your desktop but may be of little use if you have to do some web programming unless your ISP runs IIS and there is over 70% chance that he doesn’t.
Why not Squeak? Smalltalk is a good language to begin with, but the squeak enviroment feels a bit too toyish if you want to build some real application. The runtime is big and most people doesn’t have it installed.
Ruby,Python are nice languages too, but they are interpreted languages. This means that the newbie gets little help in catching simple errors like mismatches in datatypes.
I don’t believe Java or C# to be any more difficult to learn than e.g python. C++ is another matter as you can express things in so many different ways in that language it will be harder to learn. The newbie will also have to learn things like pointer manipulation.
I think a hobbiest programmer (i.e,, kid), would be best served using one of the popular scripting languages first. Usually easier to debug, interpreter can be used interactivly, and it’s easier to get up and running with your simple programs.
There are interactive debuggers for compiled languages as well. E.g. the eclipse debugger for java. And it not hard to compile your java code in eclipse either you just select save from the file menu.
I would strongly advice against perl as a beginners language. The problem with perl is that it have a very large syntactic footprint. Whatever you write in perl tend to be valid code even though it may not do what you intended. This makes debugging harder.
It seems that this article is not so much about programming languages but programming tools (at least that’s my guess for an article with a headline of “Programming Tools for the Hobbyist”).
One really great development environment I recently found is Motor, located at –
http://thekonst.net/motor/
and also listed on Freshmeat. It’s written for POSIX so it should run just fine under Cygwin or the like, if you use one of those “other” OS’s. It’s not GUI, which is a major plus in my book, and extremely easy to learn.
I’ve got a boatload of development IDE/Tools on my system (ISE Eiffel, Code Crusader, CodeForge, C++ Builder X, SpecTCL, Kobol, Anjuta & the whole gvim/nedit+gcc+gdb thing) and it takes days, maybe weeks, to try and learn how each tool works, with the exception of the last listed. It took me 5 minutes to learn how Motor does things and write the proverbial “Hello World” with it.
One of the reasons I really like it is that it reminds me of Turbo C. Not so much for how it looks and feels but in how it keeps everything simple. It doesn’t get in the way of actually development yet it still have just about all of the features one might need.
I think the debate of what language to use for hobbyists is beyond the scope of this kind of descussion.
At least that’s my opinion.
Hobby programmer does not mean “new programmer” or “illiterate” programmer. Many professionals or academics do hobby programs on their free time (this is also the way many open source projects start).
So C++ could still be a valid example. But, I personally would prefer something “more intelligent” to do small programs.
Basically, in any situation where speed isn’t a crucial factor, Python is a viable competitor to C++.
What situation is speed not crucial? Basically very lightweight, simple apps. The stuff I see done in Python are installation tools, hardware detection tools (like the one with Knoppix), and small utilities in Gnome or KDE. For anything medium to large scale, scripting languages fall behind. But that’s not to say that scripting languages aren’t great tools, for hobbyists and professionals alike – they are. It’s just that C++ can still do all of it, and execute very fast.
For me, it’s rare when speed does not matter when I’m using applications.
if you had the interest, time, money, developers agreeing with the choice, etc — what language would you use to develop that browser? And more important: why?
Personally? I would have used Dylan:
http://en.wikipedia.org/wiki/Dylan_programming_language
Why? For a number of practical reasons:
It’s got a very clean semantic core, based on a mixture of Smalltalk, Common Lisp, and Scheme. It’s got a clean syntax based on Pascal’s. In terms of sheer power it is in the top-tier of languages. It was also designed from the ground up to be very efficient. It assumes a very powerful optimizer, and allows the programmer to give hints (eg: type declarations) when the optimizer can’t figure something out. This allows an incremental style of development, where prototyping is done quickly without hints, and types are firmed as code get’s finalized. Lastly, it’s got a couple of good native-code compilers, and a very good IDE (that’s only available on Windows atm).
From the point of view of Mozilla, Dylan would have a several of advantages:
1) You wouldn’t need the XML + Javascript + C++ deal. You could have a macro-based metalangage for the UI-specification, a loose-style of programming to replace Javascript, and a tight-style to build the high-performance core.
2) It’d be faster to market, both because of the productivity of the language, and features (eg: XPCOM) that wouldn’t need to be reinvented because Dylan has them built-in (Dynamic code loading and a foreign-function interface).
3) It’d be faster. Tuned Dylan code can get to 90% of the performance of C++. However, it is my experience that most code does not operate at the performance limit of the language. Rather, it operates at a limit determined by programmer time. If a language makes you 30% more productive (based on studies, this is conservative), that’s a huge amount of time that can be spent optimizing.
Works nice. Can program darned everything you can think of…
IMHO, PERL eq TrueToolForRealGuru
Anyway, I sometimes get a funny feeling that python ZEALOTS (yeah, zealots…not ordinary users) tries to –force-convert other “traditional language,” highly especially PERL, users into a python zealots…by repeatedly proclaiming that their language is the only-true-next-generation-OO-computer-language-for-real-hackers, that python is uber-cool language to use (yeah…I agree that if you are a beginner, then pythons is a cool choice to make), and that PERL sucks because it’s old and just a PERL and blah blah…
In S. Korea, situation is that worse. Every programmer-wannabes are brainwashed by few python zealots and nearly every college computer language group uses python (and of course, C/C++/Java) but now, PERL is almost forgotten….and there’re some stupid prejudice in S. Korea that PERL is just a CGI-only scripter and nothing more. Pah!!!!
auto_ptr is just one type of “smart pointer” and not a very “smart” one at that. I’m talking about reference-counting smart pointers, like Boost’s shared_ptr? You know, the kind that were recently incorporated into TR1? You *did* know that, didn’t you?
Cute, but not standardized till 2005. Also, I think all of this bleeding edge stuff is a little overkill for the average hobbyest, don’t you?
Would you like something, to, um, wipe that egg off your face?
No, but you should wipe that white stuff off of your lip.
Or shut up. It was not about _languages_ for hobby, it was about _tools_. Sigh…
Why in the world would anyone want to do development on Windows? It seems to me that most hobby development is done on GNU/Debina-type systems. Niche operating systems like Windows might be fun for 5-10 minutes, but that’s it.
IronPython has yet to see the light of day…
Just because you said so, IronPython is out check out http://www.ironpython.com
-1982: TRS-80 (Coco II) with 6809 CPU (I have 13)
That was my very first computer as an unexpected x-mas gift from my now passed away dad. Although I program all summer on a Commodore Vic-20 at Sears store (I was giving demos for the salesman since they couldn’t show what that piece ‘of magic’ could do), that Coco II was awesome and programming was The Thing to do. I learned BASIC (from Microsoft, of course), then 6809 assembly and a bit of LOGO.
-1986: Bought my first 8086 XT clone. QBasic, although I hated it. Batch programming with PC/MS DOS. LOGO again, although this time, the much anticipate computer courses at school just didn’t play with “the nice turtle”. We actually did pretty cool things like learning recursivity, algo design, etc (I loved those years!). Never thought that language was able to do that. Then Turbo Pascal came in. Some serious things could now be done. That`s when I started to hate verbose language me think…
-1989: Deliverance: I finally get in touch with the C language at College, and automagically fell in love with it. Those were the good days of making TSRs and stuff really cool.
1991: At University, much crap are thrown at the students to “open their horizons”, yea right, but anyway, I spent (and wasted too) time on language like Simula, Modula, C (my savior), C++ (I wished they never invented this one), SmallTalk, Miranda, Prolog, SML, some obsur in-house assembly languages and, eventually Visual Basic. Although it was fun to RAD something, I could not cope anymore with BASIC. It was just, ‘not right’.
Professionnaly: Then I started to work and had to do VB, Delphi, C, C++, Java, Jscript, VbScript.
-2000: Then, in year 2000, I decided to take a look at Perl. I fell in love again! This was one of the best language to accomplish any kind of chores. Perl forces you to think diffently (not like the commercial ads) and make you realize that easy thing are easy to implement, and hard thing are POSSIBLE to implement. This gave me hope that maybe the armaged_VB_on will not happen. Programming was cool again.
-2002: I started to fiddle with C# and the .NET Framework (and don`t talk to me about VB.NET: ‘porting’ VB is a mistake MS did that I (and lot of others) am still wondering). (Note: I`d never been tempted with Java because I always felt it was too slow. Sorry, I meant no offense to no one here.) This thing was really cool. RAD desing with a C-style language and strongly typed in a nice IDE that works quite well. This enchanted me. Finally MS delivers what they promise back in 1995. My only grip was not to have done much OO design/programming in the recent years before.
So now, what language a hobbyist should used to play with? I still consider myself a hobbyist even if I earn my life by designing/making software. But my view is biaised because of my past.
Let`s say that for today, someone with no prior knowledge with a computer language, and knowing that he probably be using a Windows XP platform:
-First choice
I’d suggest buying a good C# book, d/l C#-Express (free IDE + C#-language + framework), and learn OO programing.
-Second choice
Or, as a second choice, find a good book on Perl, d/l Perl for Windows (free – always been free) from ActiveState and begin forging his mind into clean and easy was to do things.
When looking back, I wish I could have done that right from the start.
Just my $0.02.
Theres also freepascal and the delphi clone lazarus
http://www.lazarus.freepascal.org/
Still in Beta, but quite stable, and has windows and linux versions so you can write a program once and compile it on multiple platforms.
You can also use freepascal to compile commandline programs.
So what if they’re not standardized until 2005? The standard is based on Boost::shared_ptr, which is a de-facto standard among users of “modern C++.” And it’s certainly not overkill for the average hobbyist — it’s the only way to retain the memory management advantages of the STL containers when using them for polymorphic code. If you don’t use shared pointers, you’re back to new/delete.
In any case, this had nothing to do with shared pointers. You said that you can’t store auto_ptr’s in containers (because you mixed up auto_ptr’s and smart pointers in general), then accused me of not knowing C++ because I mentioned using containers of smart (shared) pointers!
i suggest java
very easly to learn
very fast to do a application
oop
run on many plateform
very good performance now because jvm compile the code
When I program normally I use JEdit or KEdit, depending which OS I’m using but I have to say that building AppleScript progies with XCode and the interface builder is easy and fun!
Okay, this is only a small portion of what real hobbists use.
most of these comments are wrong about popular languages, and if they look beyond the fad languages, you will see C being used the most.
FORTRAN gets used lots still in numerical analysis
Ruby is becomming more popular for the FULL OOP that no highly developed language seems to offer*(no not python, nor perl)
C++ is probably the second language
Depending on what you program, the language differs.
If you program PIC/AVR chips you will use; asm, BASIC, PASCAL, C/C++, or maybe even FORTRAN.
I think this article does not cover these specifics on the wor “Hobbyist”. Mainly because the author has had little experience in the real world.
Thanks for the explanation and the link. I don’t understand everything, but it was interesting.
I can do *almost* anything one can do in Java and quicker.
I really enjoyed the conclusion at the end of the article;
“Conclusion
Click for a larger view These are all great tools for the nobbyist programmer.”
The nobbyist programmer? LOL