I consider myself a master at vb.net, and now I'd like to learn C++. I know they are similar in many ways, so instead of starting from a standard "learn C++ Basics" which there are thousands of, and then move on from there on, as I have done with all other languages. I would love if someone could point me to a tutorial that learns, someone with knowledge in vb.net, C++. Or maybe a page pointing out the differences between the two.
Also, with them being similar, is their simple converter, that can convert code on line-base from vb.net to C++? I would like to convert my current asp.net website (less than 30 lines of code right now) project to C++, as I find the best way to learn is through doing it.
As #ildjarn and #GregHewgill pointed out, C++ is quite different from vb.net. C# and (to some extent) C++/CLI would be much closer (and despite the name, C++/CLI is not C++).
C++ (by itself) does essentially nothing to support web development, so converting an asp.net web site to C++ will most likely be a decidedly non-trivial exercise. There are frameworks (e.g., Wt, POCO, ACE) that support network and web development in C++, but I don't believe they have automated tools to convert from asp.net. In any case, converting a web site to C++ using one of these libraries is not going to teach you much about C++. At best, it's going to teach you about that library.
I feel obliged to point out, however, that if web development is your primary interest, C++ probably isn't your best possible choice. At the very least it's quite an unpopular choice for that purpose.
The typical answer for people who already know how to program in some other language and want to learn C++ is Accelerated C++ (but you may want to see The Definitive C++ Book List for other possibilities).
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I would like to know the advantages and disadvantages between C++ and VB6. The reason I am asking is because I came across a website where they have source code for various programs that are coded for Windows machines, and they are almost all coded in VB6.
However, I do not know a lot about VB6, and am trying to learn C++ at the moment, and I was wondering why people would code in VB6 instead of C++ or how they rank in different areas.
So I would appreciate it if someone could weigh the pros and cons of each language and really give me perspective of the languages.
-Oswald.
I was wondering why people would code
in VB6 instead of C++ or how they rank
in different areas.
VB6 is a dead language. It was a Microsoft proprietary language.The VB6 IDE is no longer supported but VB6 applications are supported for at least the lifetime of Windows 8. Most (with many changes) of the syntax lives on in VB.NET (another proprietary language). In addition to the syntax, VB.NET and VB6 share the idea of "canned programming", where the developer just combines existing building blocks to create small applications very easily. VB6 introduced a large number of innovative techniques for this. It became known as RAD, Rapid Application Development or Rabid Application Development, depending on who you ask.
The problem with RAD, that it doesn't scaleā¦
Probably you looked at a very old web site.
C++ is a general programming language standardized by ISO. There are also a great many other general programming languages, and many of them are also standardized. In addition there are general programming languages like Java that are not standardized by some international standards organization, but have sufficient heavy backing that it's almost as if they are open languages, in spite of being technically proprietary.
Going into more details comparing the languages serves no useful purpose.
You might read up on the old C versus Pascal debates to see why (these debates got pretty heated, so called language wars, but resulted in some classic papers such as Brian Kernighan's "Why Pascal is not my favorite language").
VB6 is antiquated -- the only reason people would code in it these days is if their company had business reasons for not upgrading to something newer (like a large legacy code-base written in VB6). Even then, you'd expect them to be looking to move on.
VB6 has been obsolete for quite some time now and superseded by VB.NET. C++ and Visual Basic have way too many differences to list here, but if you want to learn C++, it doesn't help much to learn from VB examples. There are plenty of books, tutorials and examples for C++ - in all likelihood, much more than what you would find for VB - so that's what you should be looking for.
I am learning C++, but only after Python and Java.
It is not suggested to learn C++ as a first language (that's what I got online).
I am interested in getting deeper in low-level programming an OSs so C/C++ is what I am aiming for right now.
I would say learn C++
One reason VB may still be used is that in some companies (such as the one I worked for) we required financial analysts who were good at understand the math behind the business AND be able to produce applications that solved business problems. It turned out (as others have pointed out above) that it was easier for us to hire folks with good functional business knowledge and then get them up-to-speed with VB than C++ or VC++, the latter two being the exclusive domain of the IT-department developers.
Basically if you are looking for low-level coding that offers more speed then go with C++, however if you are new to programming I wouldn't recommend it. However, there is much more overhead with C++ and coding can take more time. C++ also allows you to be object oriented if you so choose, but it does not force the paradigm.
Visual Basic is a high-level language and is pretty well noob friendly but is slower than C++. Visual Basic has less overhead meaning you can code a lot quicker once you get the hang of it. I'm not sure if VB is object oriented but I don't believe so.
C++ is a lower-level languagge, thus programs will perform better... everywhere, period.
VB6 is a higher-level languagge, so it'd probably be easrier to learn. Actually it would depend on your previous skills, if you know java you'll have a hard time understanding VB6.
A friend of mine once said, if you know english you can write VB6 :)
Plus, VB6 is no object-oriented, while C++ is
VB6 has since been superseded by VB.net. VB was and continues to be very "newbie" friendly. VB was easier(depends on what and whom you ask) to code in, whereas C++ allowed access to certain components not available in VB6. C++ was also significantly faster than VB6, though those type of speed differences don't matter much any more.
There are certain sites which continue to host/advocate vb6 code. VB6 support will be completely dropped after Windows 7.
So the main difference is that VB6 is a slower, (becoming unsupported), proprietary language that is easier to learn for programming beginners. C++ is a standardized, supported language that's quite a bit harder to learn, though its faster/more efficient.
For starters, I'd recommend a Basic dialect, be it Microsoft Small Basic (this is a newb's language), VB.net, FreeBasic, RealBasic, Auto-it or maybe even PowerBasic.
Hope this helps.
I recently started C++. I am using PHP right now and decided to take a look at C++. Web programming had me working with a couple of languages, with a couple of people. I wanted to do programming where I only had to bother with one language and create small utility apps (mostly not web-based). I wanted a compiled, strongly-type language without memorizing a tome of classes. Basically I wanted to learn C++ for the following:
mobile programming (I don't ever want to go touching Java, and I don't have a Mac for Objective C or IPhone SDK)
small desktop apps like DTRs, POSs
creating small desktop-based games
creating small Air-like applications that can access the web for additional content
I heard that C++ is not beginner-friendly and is mostly used for huge projects with lots of calculations and fine details (like 3D games). Is it practical or even possible for me to use C++ for the above cases? (Sorry, I haven't delved on C++ that much yet, so aside from "huge, monolithic project", I don't know any other uses for it)
You can certainly use C++ in all the areas you mention, though whether it is best of breed for any of them is open to debate. C++ is very large and complex language, and requires a fair bit of effort to get up to speed on. If I were you, I would pick one of the areas you mention that you are most interested in, and then find out which language(s) are best suited for that area and learn that.
If you are set on learning C++ you will need to read at least one book on it - you cannot learn it from internet resources alone. See this question The Definitive C++ Book Guide and List for a book list.
On the droid you can use other languages aside from Java - check out their ASE (Active Scripting Environment). C++ / C should really only be used when you have no other choice - i.e. speed critical code, operating systems etc. It's very easy to make a mistake that's difficult to diagnose and there are lots of task where it'll take way longer than it should to write and odds are others have already done so and done it way better - reinventing the wheel is bad. If it interests you though by all means learn and eventually you may master it. It's an excellent skill to have.
It's also not a completely object oriented language however, it's a hybrid one that supports most object oriented features, but some such as inheritance and polymorphism are a bit awkward to deal with in C++ - for example you have to define methods as virtual in base classes in order to be allowed to redefine them in subclasses - sort of like predicting the future - will this method every be desired to be redefined by an inheritor? Really what happens in that case is you make the base class method virtual later on to enable it to be redefinable - that is if you happen to have access to the source code to do just that - if not then oh well. For an example of this confusing stuff in C++ and other gotchas: Pitfalls
Look at other languages such as Ruby or Python - in particular Stackless Python where a combination of it and C++ (used where necessary) was used to create EVE Online as well as the functional languages such Erlang and Haskell.
For 2, 3 and 4, I recommend C# over C++, for the reasons I wrote here.
About 1, you can do iPhone development with .NET but I've never tried it and I don't know how viable it is.
Edit
To answer your actual question: yes, it's totally practical to write small and large desktop apps in C++. Especially if you use quality tools like Visual Studio and Qt. It's just that I think it'd waste a lot of your time for no reason, unless you intend to go into professional game development eventually.
I went to C++ from PHP like you, but I was more interested in 3D games and such. Now I have moved on to C# and find it much more enjoyable than C++.
As for your specific areas of interest however, C++ is certainly an option but C# may be better.
Mobile programming with C++ is probably not a good idea. I know it's possible with NDKs and such but for a beginner it's probably not so good. For iPhone development, other than the official SDK, the next best option is the (commercial) MonoTouch framework from Novell. However, you may still need a mac to deploy (I don't know). In terms of Android, if you don't want to touch Java (don't blame you) I believe a C# framework (similar to MonoTouch) is in development and other languages may be available. Other platforms? No idea.
Small desktop apps is also very possible with C++. Assuming you're running Windows, you can use the Win32 API (pain) or the C++/CLI API (better). You could also use a different GUI framework like Qt, wxWidgets or GTK+ which are all also supported on other platforms. Again coming back to C#, GUI development using GTK# in MonoDevelop is so much fun. Having used WinForms in Visual C# Express back in my Windows days, I can say that I now enjoy the process whereas I didn't before.
Games are my main area of interest and the reason I originally picked up C++. Seeing as you've said small and desktop-based, using C++ for performance reasons is way overkill IMO. You could make a decent, fun, playable game in Python using pygame without the pain of using a language like C++. In C# (yes, I'm trying to sell it to you) you could create awesome games using the XNA framework from Microsoft or other frameworks like (my personal favorite) OpenTK.
Rich internet applications. C++ is probably not the right tool to use here. It's certainly possible but seeing as C++ has no standard networking library, you would have to figure some of this stuff out yourself. C# may not be the right tool either but it makes it a little easier. There are other options as well (like Python) but it's not something I know much about.
Despite what I've said about it, I still think C++ is a good language to learn. It teaches you about lower-level things you never think about in PHP land. If you want to learn it, the book that really helped me was "C++: A beginners guide" by Herbert Schildt and also "Programming" by Bjarne Stroustrup.
Yes, your use cases can all be done with C++, more or less (YMMV on mobile devices).
To some degree or another, a language like C# will be more rapid to develop in, however.
In my opinion, once you get away from the straight-up form design features and hack for a while in a language & application, language feature comparisons begin to diminish in meaningfulness.
I recommend C++ as a first "heavyweight" language; see here for my most recent discussion on it.
This may seem a trivial question, but it's one that's bothered me a lot lately. Why do some programmers refer to "C++/STL" like it's a different language? The STL is part of the C++ standard library -- and therefore is part of the language, "C++". It's not a separate component, and it does not live alone in the scope of things C++. Yet some continually act like it's a different language altogether. Why?
It's possible to be a competent and experienced C++ programmer and never use the STL. You may be using Boost or ACE, or been an MFC windows programmer for 10 years.
If you want someone experienced in using the STL, asking for someone who knows C++ is no guarantee that you'll get one.
Also for my mind, writing code that's heavily dependent on the STL feels very different to writing, say, MFC code. They might as well be different languages. They certainly won't look particularly similar.
An understanding of the STL isn't necessary to understand C++. It's useful to have when you need ADTs, but you can go (could have gone?) through your whole C++ career without needing it.
The above answers are really good; I'm only going to add to their content in a broader context.
Developers might refer to language/api|library e.g. C/Win32, Java/Struts, Java/Spring, C#/.net MVC because there are in essence two knowledge bases - knowledge of the language in question and knowledge of how to use that specific library, API or framework. Something like Win32 is pretty huge, as is say Django, which I'm currently learning. Django itself works in a very specific way and knowing that is what I'm learning, not Python.
The same is true of C++/MFC or C++/Boost or C++/STL. The language is C++ - the API/library you're using is MFC, Boost or STL.
Probably because STL came a little late to the C++ game, and many people have written code that does not use any STL. For example, think early win32 programming with MFC.
Guess:
When C++ was first released, the STL did not exist. It came into existence later as an optional addition and then was incorporated into the standard.
When writing a resume, people would often list C/C++ as a language, which, in many cases means they don't know either.
Sometime resumes would list "Visual C++" as a language, trying to indicate they don't know what a language is.
This, together with "great knowledge of C++ and PHP" statements, go strait into recycle bin at my firm. Not because they are necessarily bad programmers - but because the interview time waste is not worth it.
I want to learn C++ so that i can develop C++ Python modules for server-related stuff.
I'm a purely dynamic languages developer (Python, PHP, Ruby, etc). I want to learn a fast language, and if I'm going to do this, I'd rather learn a really fast language like C++. Before I even get started though, I understand that suddenly working with static types, a different syntax, and compiling code will be quite the paradigm shift. Is there any advice that a C++ dev who also has dynamic languages experience can give me to me to help me make that shift faster?
I doubt there is any specific advice that can be given, other than that you must read a good book on C++ written by an authoritative author or authors - do not pick the first or cheapest one that comes your way. For a list of books see The Definitive C++ Book Guide and List - I personally would strongly recommend Accelerated C++ - it is written for people with programming experience, though not specifically for those coming from a dynamic language background.
Get the the books, and the tools (g++ or VC++)
In the transition from python to C++ I would recommend
learn the differences between duck typing and static types
learn the differences between the memory management of Python related to the memory management of c++.
When you know this good, you'll be able to write something without shooting yourself in the foot.
There are plenty of other different topics also, because of the multi paradigm nature of c++, but start with the basics and add to your repertoire as you need it.
Since I have been mostly using script languages in the past time but now want to go to the "high-performance" level I decided to learn C++ some time ago.
I looked at some "beginner" tutorials and bought an O'reilly C++ pocket reference book (it's really helpful). My problem is that I now know all the basics but I'm not good enought to program a more complicated game, for example, yet.
Do I have to get one of those thick C++ books for further learning?
I'm going to use C++ on Windows mainly. What APIs beside Win32 are important for me?
My goal would be to write a small interpreter for a programming language I've though of - I managed that in several scripting languages already, what API/Library knowledge do I need in C++ to write one?
You don't need a thick book - you need a good one. Get Accelerated C++, written by Koenig & Moo, two of the original C++ development team.
Depends what you want to do.
You don't need anything - you can write a perfectly good interpreter or compiler using just the C++ Standard library. See this SO question for lots of info in this area.
Learn with books. C++ is a complex language. My suggestion is to first go with a rather quick introduction and general overview of the major programming paradigms that C++ supports: OOP and generic programming: Accelerated C++.
When you finish this book, you can go with the two volumes of Bruce Eckel's Thinking in C++ which are very detailed.
For UI programming, the best C++ toolkit is Qt, and it is multiplaform-ready. You can read "C++ GUI Programming With Qt4" (the first edition is free to download, just google it). If you want to stick with C++/Windows API, learn the Windows Template Library, altough it may be a bit hard due to lack of official documentation (altough there are good tutorials on the net). WTL is the way to go to create very small, lightweight applications (Qt DLLs on the other side, need a few MBs each).
I have always found that learning a language from a book is pretty difficult and that after you know the basics you should begin to program. So instead of picking up a thick manual I would check out something like http://www.cprogramming.com/tutorial.html#advanced or just google for c++ tutorial and something that you would like to try to make.
A good (and) thin book to get started in C++ is Accelerated C++ by Koenig and Moo.
I mainly do programming under Linux, but I hear a lot of bad things about MFC, so I'd try to find a different GUI library.
Once you get up to speed with some of the more complicated parts of C++ syntax, have a look at the Boost.Spirit libraries for parser generation. The various Boost libraries provide some very useful extensions to the Standard Library.
Honestly, In learning C++ i never picked up a book (no flaming please). The best advice i can give is to go to this page and go through the tutorial. It covers the majority of the C++ language (read: most commonly used features) and keeps it as simple as possible. As far as APIs that are important... well that is a matter of preference. No one toolkit/api has really "won", but Qt, GTK-- (gtkmm), and wxWidgets are all big players. And besides GUIs, you'll probably want to learn either the raw winsock2 and threading APIs OR the boost library's threading and network interfaces. I do agree that MFC is dying, and for windows-only development C# is taking an increasingly large role (even on linux/mono C# is starting to catch on... slowly).
Also, the best way to learn a language is to code. So don't just read a whole ton- without practical experience you're never going to learn the language. Ask questions, answer those you can, and write tutorials- for yourself if nobody else. Writing down what you've learned is a great reference, and the process of straightening everything out in your head to write it down in a fashion that another person can understand it alone is a great way to reinforce concepts. In a strange, but seemingly backwards, way I found the best way I learn programming is by helping other people with their questions.
#Neil- i disagree that online tutorials are "flat out wrong". If anything, the style they teach you might be geared towards readability rather than optimization- which in-my-not-so-humble-opinion is an advantage. In my limited experience I've found cplusplus.com a go-to reference for pretty much everything.
Specifically, to answer your questions:
1. No thick book needed. I've heard that the thinner ones can be useful as a quick reference, though.
It's completely subjective and depends on your goal. Boost's network and multithreading libraries are probably a good start.
between std::string, std::stringstream, and getline(std::istream&, std::string&) you should be pretty good. C++ comes with a whole ton of built-in functionality yet isn't too bloated/huge/impossible to learn. Take advantage of it. All of the parsing is built in already.
Please, for Pete's sake, don't use directly use the Win32 API. You'll be painting yourself in the Microsoft corner. There are plenty of cross-platform libraries out there you can use instead:
Standard C++ library: strings, file i/o, containers, algorithms
Boost for the everyday stuff they left out of the standard library: parsing, networking, threading, smart pointers, memory pools, date/time, matrices, etc... Boost libraries are peer-reviewed before being accepted and are high-quality. Boost is the breeding ground for libraries that eventually become part of the next C++ standard.
GUI Toolkits: Qt and wxWidgets are very mature and widely used. There are many more.
For C++ on windows, definitely learn Microsoft Foundation Classes (MFC). Without MFC, you have to implmenet all of the windows API stuff yourself, which is more C than C++ and can be quite a pain.
You also may want to get, learn, and use the boost C++ libraries. They aren't windows specific, but they are a great resource for anyone.
I highly recommend Stroustrup's Intro C++ book. It covers C++ and STL in a very approachable way.
After that you might consider looking into books on Qt, a multi-platform GUI toolkit, or WTL or MFC for Windows. You could do .NET + C++, but that would be a lot to learn. In my experience with Qt and MFC, books have not helped much. Tampering with sample apps, building small apps just to test out one kind of feature, and poking around the docs was the only way I could get my head around either library. The books I had tended to simply gloss over too much--they were not worth the money.