Object Oriented Programming at Undergraduate level: Language for object oriented programming
Both Java and C++ are "high-ceremony" languages where you have to learn a lot up front (or blindly accept a lot of meaningless gobbledegook) just to write very simple programs. I think they are both poor choices for teaching programming (and only slightly better for working in).
Ruby would be my first choice for a starting languages, Python second. They are simpler to get started with, easier to read, and have many important features that Java and C++ lack, such as blocks and closures. (They would also be my first choice for "real work", wherever possible; they are certainly not toy languages.)
Javascript might also be a reasonable choice --- also valuable to learn in today's environment when so much of our software runs inside a browser --- but I do find some aspects of the language a bit more confusing.
You can also consider using Python. It is an intuitive and powerful interpreted language.
Hi.What Biswanath was told that is also correct but it depends upon you that you are using which language.Thanks.
G'day,
To my opinion,
- C++ is probably too complex mainly due to its inheritance from the C language of the last century.
- Java is a great language and I think more easily OOP than C++, but the syntax may be "boring" and inefficient for student
- I personally have learned many years ago with Eiffel, which was great, but ...
- I follow Biswanath to consider Python, which a bit perturbating for people having C++ experience, but very easy and powerful for newbies and also after some experience for experienced programmers (with a speed-up in the development process).
Regards,
mc
I would use Python or Eiffel. If you really have to choose between C++ or Java, I would say C++.
It all depends on whether you plan to focus on OOP's concepts or underlying implementation.
If you want to keep it high-level and not dwell into how OOP features are implemented, I'd recommend Java, or even Python. I hesitate to recommend Python over Java due to some of its idiosyncrasies – such as the mandatory specification of the "self" argument in method declarations – but other than that it's a language that really keeps out of the way, leaving you to concentrate on the concepts.
However, if you'd like your students to not only learn how to use OOP, but also how it's implemented at the language level, I'd suggest the course taken by my college professor:
1. Explain how function pointers work in C, and how they can be used to decide at runtime which function (of a given set) to call;
2. Implement a project that requires polymorphism in plain C, using structs and function pointers to simulate virtual methods;
3. Now that they know the practice of it, explain the theory behind polymorphism and how classes = ADT + inheritance;
4. Re-implement the project in C++, now using classes and virtual methods;
5. Now that they've learned a language (C++) where they have to choose whether to define a common superclass for all their classes, whether methods are virtual or not, simulate interfaces using pure virtual classes etc, show them Java as a language where all these things are already given;
6. Re-implement the project once again, this time in Java.
I reckon this is a rather (for lack of a better word) brutal path to take, but as someone who survived through it, I can attest the deep understanding of OOP it imparted to be more than worth the pain.
Both Java and C++ are "high-ceremony" languages where you have to learn a lot up front (or blindly accept a lot of meaningless gobbledegook) just to write very simple programs. I think they are both poor choices for teaching programming (and only slightly better for working in).
Ruby would be my first choice for a starting languages, Python second. They are simpler to get started with, easier to read, and have many important features that Java and C++ lack, such as blocks and closures. (They would also be my first choice for "real work", wherever possible; they are certainly not toy languages.)
Javascript might also be a reasonable choice --- also valuable to learn in today's environment when so much of our software runs inside a browser --- but I do find some aspects of the language a bit more confusing.
Another "spin" on this question would be to find out which of the programming languages is most in demand in your region by employers, especially if your institution has a co-op program. That may even be a web-based platform language as Michael Hackett noted. For purposes of motivating students to learn, especially if they believe they will not have to program after they graduate, using a language that they can apply immediately to projects or co-op work is a plus.
This is by experience as I had to pick jobs based on having moderate Java but basic C++ in my skillset when applying for co-op jobs in my undergraduate program. (I eventually started with companies that used Java for mobile apps and testing, and learned C/C++ in later co-op postings.) Both Java and C++ are certainly valid languages, although as mentioned for C++ you will have to explain the "legacy" baggage from the original C language. Python is relatively easy to learn, and I also used it in industry, but I can't say it's as valuable as the C++ and Java.
Of course students can pick up new programming languages on their own, but they are expecting you to provide them with the most relevant knowledge for what they need to do in their careers.
Re-reading the question, I'd like to amend my response. I was assuming this was a *first* programming course, but that's actually not clear. If it is, I stand by my first answer (Java and C++ are not good first languages), but if this is a 3rd or 4th year undergrad course, specifically about object-oriented programming, then perhaps a more rigorous language like Java or C++ would be worth considering. It depends on what experience the students are coming in with and, as Patrick Santos says, it depends on what sort of work you are preparing your students for.
I think, if I had to pick from those two, I'd go with Java for teaching O-O, because it's a bit more straightforward, and the tool support is probably the best, and once you have that under your belt, it's pretty easy to pick up C++ from there. In my experience, C++ is not used much anymore outside engineering and lower level stuff (OS, crypto, embedded), but maybe that's exactly what your students hope to get into.
That said, I don't think there's anything limiting about using a higher-level language like Ruby or Python for teaching O-O, unless there is a specific need to meet an industry demand and there isn't room for another course in which to do it.
Teaching object oriented is better starting with Visual basics...as far as I know any basic programming related quick basic, pascal and C++ in need a lot of effort or language program. However if you are concern with web base programming it would be so different, you still can interact with vb or Php, Html or Java and you can use mySQL n Postgrey as a database for web instead of Dbase III, Foxbase, microsoft access and soon. Regards
If I may quote Alan Kay: "C++ is not Object Oriented. I made up the term Object Oriented and C++ is not what I had in mind."
Python ;) No really, it's not the language that makes a program object oriented. You can perfectly well write OO with plain C, just have a look at the Linux kernel.
But for easy usage and proper code style I suggest python.
Not Perl. Perl was created before Object-Oriented concepts (OO) and OO stuff was added later in a clumsy way.
If you want to teach a high-level scripting language with Object-Oriented features, Ruby was created as a "Perl-like" scripting language with Objects and Object-Oriented programming incorporated smoothly from the beginning. So for beginners in OO coding, Ruby would be a better choice than Perl.
However, for versatility and skill and usefulness in the job market, you cannot do better than teaching C++ as the main Object-Oriented language in the world today. Java may be easier to learn, but its use is limited to certain sub-fields (most web-related) whereas standard C and C++ at the bottom level underlie most of the code used in the world today, including the Internet itself. If you were going to create a huge new project, such as a new operating system (like Linux?), a new database server, or a massive multi-physics simulation, you would probably start with C++. It is the hardest of the major OO languages in widespread use but also the most valuable/rewarding. (In spite of Alan Kay's objection, "C++ is not what I had in mind", it is nevertheless the case that C++ is the most widely used Object-Oriented coding language in the world today across the widest range of disciplines and job opportunities. It may not be "pure enough" in the OO sense that Alan Kay would prefer, but it works.)
Python would be easy to learn but of the languages I have mentioned here, it has the smallest user community worldwide.
To conclude: if you want to make the class easy for beginners, Java or Ruby or Python would be good choices.
If you want to make the class valuable for future employment/versatility/job-applicability, teach C++.
In terms of OO-scripting, Ruby is a real beauty. You can see that it was designed with "the principle of least surprise" in mind, everything works in a way which an experienced programmer expects it.
If you want to teach the something from the ALGOL family (C/C++/Java and the like), have a look at D: http://www.digitalmars.com/d/
It's similar to C++ (also in performance), but without the mess.
D language, where this been used for..? seems a hybrid with OO concepts.
D is essentially a cleaned-up C++ with lots of direct support for modern concepts (such as design by contract, garbage collection, associative arrays, resizable arrays, clean templates,...).
The most interesting concept is to have a "safe D" subset of the language which can be enforced and which disallows meddling with pointers, direct memory management, etc., but on the other hand, the language allows the same full access to the hardware or performance as C/C++. This is very powerful, as "harmful" actions can be explicitly restricted to certain parts of the program where they are necessary.
Thanks for the information Stefan. Is it be applicable for any domain? Is there any live example for the same or any applications to showcase its power.
I think C++ is the better option, Because in C++ graduates will also study about data types safety ans OO concepts.
I am not sure which one should be used.
However I am sure the one that should not be used: Java.
Although Java is a good platform form some applications, your students will not acquire some good habits. One of the most important is; resource management. Then when the transition to other languages they will be leaking resources very frequently. Another issue is that they will not be concerned by performance.
unforunately gwbasic and qbasic are very easy to use powerful English like languages. the == is overloaded as assignment and equality both . u can exchange the value of an integer with a floting point . such powerful features are absent or impossible in todays fancy languages including java, python ruby and also c from which they derive. the most important principle in programming is natural to use and english like oops and everything else is an artifical jargon unless it naturally comes on lips
@Abdul:
The domain is the same as C++: Covering systems level up to high-level OO abstraction.
@Anil: Having to understand the concept of strong typing is surely a disadvantage when using C/Java as a beginner's language. It adds a level of complexity which clouds the algorithm for a beginner.
On the other hand, mixing integers and floating point is normally rare. Free types can easily lead to confusion, as in this Perl example:
$a = 11;
$b = $a . $a; # (string) concatenation... : $b = "1111"
$c = $a + $b; # ... vs. integer operations : $c = "1122"
Conclusion: Perl is not a good choice as a beginner's language....
i think JAVA but is not definitive,
Because it depends on your skill in teaching.
http://programmers.stackexchange.com/questions/85191/is-java-a-good-start-to-learn-oop
We have recently switched from Java to C# in our curriculum. This was largely motivated by C# being better suited for Game Programming, but as a non-game programmer, I also find C# to be quite a bit cleaner than Java. A big downside of C# is its proprietary nature.
I would never start with a scripting language like Ruby of Python. Programmers have to earn the freedom of scripting languages.
From the "earn the freedom" prespective, COBOL would be a good starting choice - you can tell your students: "once you've all been good boys and girls for some time, we can move on to a nicer language" ;-)
My point was that I'd prefer starting students on languages where the compiler provides some protection.
I'd not suggest using Cobol. It lacks too many features that I'd like to educate students about.
Of the two, I think Java is a better first language. The whole business of deallocated pointers leading to bugs that are horribly complex to debug and exhibit seemingly non-deterministic behavior is substantially avoided by Java garbage collection. This is no small thing since even one really rotten experience with debugging can turn a person off to programming for a lifetime. The issue of excruciatingly careful memory management can be left for a follow-up course!
dear Stefan i understand that mixing of int with flot does not occur in comon practice. but the fact remains that 3rd generation gw basic q basic can do it but not todays languages.
2)also gwbasic and qbasic overloaded = for both assignment and equality , a marvel which is very useful for natural looking programs not possbilei todays langugaes ruby, java , python almost all madly following c.you have not replied for this point.
3)basic was English like and concise. see the ease in statement input "name and age" name$, age. pri. c would require you to use two statements scanf, printf with awkward syntax. even c++ would require cin cout but basic was more readable and required lesser writing. even java is complicated in this regards.
4) basic had a simple facility of parameters subroutines Gosub which could transfer some part of computation a logically separate unit to another part of program without other overheads of parameter passing
5) cobol had built in indexed sequential file, basic could have built in random files one has to program al this i c++, c, java etc. handling of databases is the most important task done in it industry commercially.
6) in basic there were syntactically different loop structures while .. wend, for ... next, repeat .. until . in all derivatives of c ( c+= java ruby etc ) all blocks begin and end with braces. so it is difficult to spot and separate different types of loops employed.plus for loop is unnatural why this syntax for (exp1:exp2;exp3) compare with basic style syntax for expression1 to expression 2 step expression 3( optional step clause) body of loop next.
of course one can evolve and define iterators as sets with built in next member and have iterators in addition to for .
7) in basic a statement did not require semicolon to terminate gr8 . This saves from syntax errors. rather we should have hyphen in case we wish to continue statement on next line. may be sending program over a communication channel the editor can add semicolon at end of statement but programmer should nt be required. spare us from cancer of semicolon.all ruby , java etc suffer as they are derivatives of c.
8) c cold not overload = and equality so it introduced == and madly all derivatives followed this weakness.
9) basic allowed arrays with variable dimension . c is very weak in handling even two dimensional arrays and requires the second dimension a constant t be passed as parameter oh my god what a bad design and what a serious lacuna which can only be corrected using pointers and so cryptic code. Ok java has corrected this somewhat by treating arrays as objects.
100 in java if i have a class student and instance variable x and if i say another y =x a new object is not created but only reference is copied. this creates a subtle bug and here program loses transparency with logical thinking
one could have avoided artificial looking use of keyword new by modifying design. suppose i say student x, y then two instances of student class would be created. one does not require new. but if i say student x and later on have a statement y =x then y will be alias for as i have not declared instance student y.
i a for natural english like programming . No construct be artificial. logic should reflect in program naturally.
10) in Foxpro we had integrated development for sql databses and programming language . we could create a box simply saying 1@ 3,2 to 5,6. what an ease of user interface design . 2 say get statements of foxpro are very ideal for screen form designs no modern languages have these facilities and rather have complex mechanisms for input. we say Foxpro basic outdated and have complicated languages which require separate interface for database rather than integrated environment
11) in c and it's derivatives we have ternary operator ? : but foxpro has more easy to understand iif operator which can be used both as ternary operator or statement
12) in c and its derivatives we have switch with limited capacity. in foxpro we have do case and cases can be complicated expression resulting in strings as well .
13) Finally typography. Java has conventions of using capital letters, ( of course in a systematic fashion) but very can result in typing errors and method names are long. Programming is alogical activity to be done on paper but such ocean of methods and utility classes with such long names difficult to type has resulted in environments and programmers sitting in front of terminals damaging eyes.
so we have glorified clerks as programers rather than programming being an intelligent task . comp science is moving away from intellectual science and involving jargon and clerical tendencies ( first these were spotted n cobol) are we not proud to create and intellectual science like mathematics or relativity theory
14)finally a s John Backus remarked in Turing award lecture lecture that programming languages have become increasingly complex retaining basic defects
15) a professor of comp science fully agreed to e but he said u will not be getting support. these languages have media support. Software industry is crazy and labels things as outdated rather than creating an artistically beautiful science
Well to answer this question I would suggest you to teach object oriented programming using C++. The justification go like this 1) It is easy to understand the concepts of OO 2) You can make use of this features while implementing ..
Neither. If the goal is to learn and get strong OOP fundamentals, I would recommend Eiffel and Bertrand Meyers methodology "Outside-In". Please have a look to the book Touch of Class. It is a great book for a first course in Programming. Modern, Semi-Formal, and deals very well with motivation.
It also has three appendix that explain how C++, Java and C# deal with typical and advanced OOP constructs (inheritance, generics, etc..).
You can also compile Eiffel to Java and .Net bytecode, so it is a powerfull weapon.
http://www.amazon.es/Touch-Class-Learning-Program-Contracts/dp/3540921443
Java or C++ ?. Java is more easy to learn and to teach (for OOP) than C++. In addition Java is a managed language (the memory is managed automatically) but C++ no.
I agree with Michael, the dichotomy seems silly in that there are better languages specifically to teach OO design. That aside, I would recommend Java as it has stronger roots in object orientation. I have found Introduction to Object Oriented Design Using Java to build a solid foundation of object orientation with Java as a catalyst in stead of the usual 'learn Java' approach.
http://www.amazon.com/Introduction-Programming-Object-Oriented-Design-Using/dp/0470128712
I also recommend Java over C++. C++ has a lot of baggage it inherited from C and others. Java is cleaner and safer. Java compiler is your friend, unlike in case of C++. Java is far more object oriented than C++.
Well, I think that C++ is a basic programming language for learning OOP because it introduces object model and syntax base for other OOP languages including Java, C# , Delphi (object model), Perl (syntax), PHP (syntax) and even Python (object model, although very relaxed in relation to C++) and Visual Basic (object model).
So, I prefer C++ at OOP start.
C++ is preferred for learning/understanding basic and pure concepts of Object Oriented Programming.
Zaheer: Not at all. C++ is not a pure OO language by any standards. It is extremely complex and confusing to a beginner to understand it properly. If you know C, you may find the syntax easier -- but if you want to learn OOP, and want to learn programming well, choose a cleaner language like Java. Look at the friend functions, confusing inheritance mechanisms (most of which have nothing to do with inheritance really), all the evils of C, and so on....
Java is a programming language originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities than either C or C++. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java is as of 2012 one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million user
There were five primary goals in the creation of the Java language:[22]
1. It should be "simple, object-oriented and familiar"
2. It should be "robust and secure"
3. It should be "architecture-neutral and portable"
4. It should execute with "high performance"
5. It should be "interpreted, threaded, and dynamic"
so it is better to use Java as OOPs for Teaching
Lata: I think, it should be the other way. C++, as I mentioned earlier, is a bad language to learn OO. So learn with Java. If you want to work with C++, you can move there later. You will know what is good and bad in C++, then.
I've taught Java, and I currently write both C++ and Java programs demonstrating distributed concepts (equivalent programs, sometimes I start in Java, convert to C++, sometimes the other way around), I'd lean to Java for an OO teaching environment. The reasons are: 1) the 'bare' command-line environment is better-integrated (sorry, IDE guys, I feel it's better to start there), 2) less 'c-baggage' to explain.
If your specific focus is training OO concepts, one of the scripting languages specifically infused with OO constructs (Python or Ruby, NOT perl...) may be the better choice over either Java or C++. You would have minimal messing with the mechanics of link dependencies - if you can 'see' the text, you can 'link' it...
I believe the fundamental motivation for teaching OO programming is to develop in others the skills required to write Really Useful classes, so whatever environment best promotes explaining how that works is what's best.
Smalltalk is a "pure" object oriented language and is probably the most suitable language for explaining and understanding object model and underlying concepts. I recommend Pharo (http://www.pharo-project.org/) as a free Smalltalk language for your lectures.
I'm with Hackett on this one. Don't do Java or C++. I've been trying to get my department to utilize Processing (http://processing.org/) language for Computer Science intro course.
A thing you want to require from a language that you're teaching is instant gratification. Java has headaches, C++ has headaches, scripting languages are usually too simple with their utility (such as make an object car that has fuel speed and color... boring)
JavaScript is my absolute favorite scripting language, but to have an impressionable result you also need to get elbows deep in HTML and CSS, and perhaps some jq-plot.
"A thing you want to require from a language that you're teaching is instant gratification." Interesting to see how things have changed. I majored in electrical engineering half a century ago. We started with math, then physics, and finally some electrical engineering. We never did build any cool devices in university. I finally got to help design a cool device in my first job -- the horizon scanner for the Gemini capsule. Gratification didn't come until over six years after I started college.
I'm not making a judgment here, just an observation of how times have changed. I assume that today's youth, who seem to need instant gratification, will do things just as cool and interesting as my generation.
well from the answers i see the JAVA guys Vs the C++ guys, i am a C++ guy, but i don not see a big difference between both languages in the term of OOP, normally teaching OOP comes after teaching some programming languages, check your students and see which language they are more familiar with, and go on.
Depends on what is the purpose of teaching someone programming.
Is it so that person just has basic understanding of OOP and not extensively use it in his commercial/academic work? Or that person's ability to use the language to it's maximum extend as his main tool in his future work?
In first case, any OOP language can go and I would even suggest ActionScript3.0 (Flash11) since it has easy to use drawing API for any type of visualisation (eg. draw data-drive diagrams etc.), easy to make GUI etc. Java also could be solution, especially if it's about development on mobile devices running Android.
However, in the second case, if that person is to use learned language and programming skills extensively in his future work, and make maximum out of it, then C++ is the path. Yes, it has a lot slower learning curve, but keep in mind that what you get in return, once you become 'c++ expert' is unmatched with any other programming language.
I've seen posts saying that Java can do same as C++ and that is true to some extent: yes it can make loops, and make nice OOP-organized programs... but that's it.
It will never be able to make it to the level that you can in C++, starting by developing apps using all kinds of external sensors (direct access to Kinect for instance, or any of other sensor solutions, thermal, ambient, tilt etc.). Let alone GPU development with OpenCL/OpenACC and CUDA that can give you tremendous computing power (just imagine, new nVIDIA 650 GTX Ti has 768 CUDA cores)! None of these can be achieved in Java or any other language.
So it comes to: what do you want to be able to do with your programming once you learn it?
hello, i learnt programming with c, and i think that is not a good language to learn programing. it has a very strange syntax for a rookie. I think that is more usefull and better to learn programming languages like java.
Although neither one is the best starter language for learning OO, I would advocate C++ here for people having background in C or other procedure-oriented languages, and Java for people having zero background in any strong-typed programming languages. It has been well acknowledged that C++ is a pure OO language, I recommend it, though, because it will tell you more about the secrets of OO compilers than Java would do. As a matter of fact, as for my limited expertise in Java, I am sure that one can implement a decent OO design purely using C++, at least as good as Java does. But the bottom line is, as I mentioned before, it may not be good starter for people having no knowledge or experience in lower-level high-level language that requires understanding deeper inside the computer system and OS. Also, pointer haters will swarm towards Java, I suppose, just as performance-wise picky guys will do toward C++.
to some one suggesting the "processing" language, I just wanted to add that it is not a real full-blown programming language but a data processing/visualization scripting language, more or less based on Java. I do not think it is quite OO as well according to my experience in using it for two years actually, so is its variant for web graphics, processing.js.
The first OOP language I learnt were Simula where the concept of object was first introduced. Today for teaching purposes I would probably use (and actually I partially do) Scala. A good choice is also C# especially if you want to go into the details of the virtual machine
@Tilmann
Great that you are so passionate about Java, and indeed there's always gonna be work for Java developers.
However, whatever is support for GPU-programming in Java, until high-end development houses, like ID Software, Blizzard etc. switch to Java, there's no evidence that Java can perform better in GPU. Otherwise, Java being easier to learn and thus easier to find developers for it, rather than C++, would make these big money makers switch to Java in no time. Having larger pool of ppl to choose from for Java development, than for C++ development, is market supply-demand law - making it cheaper to get or replace developers than what currently is in C++ world.
To conclude:
Yes you will get a job as Java developer. No, you will never be as paid as C++ developer since you are easier to be replaced than a C++ developer.
Which language is more popular does not determine how many jobs you have for a language. It just means ppl rather choose easier path to go through. Having 10x Java developers than C++ developers means only that C++ developers will have better payments.
I am currently competing in China, country with probably more developers of all kinds, than in majority of other countries in the world. You cannot possibly imagine how many developers claim to be Java developers. It's a sea of ppl looking for jobs. And yet, I manage, with C++, to have so much projects, that I am rejecting work since I can't do it all.
So anyone that is just starting with development learning, if you are looking at it from professional perspective (to live from it, raise your kids from it), then C++ is the way to go.
Anything else is unsafe.
"learn c++ and you will have all the experience to use all othe language" this said me my teacher many years ago, and he have rigth. So is my opinion that c++ is the best language but for undergraduates student also java is usefool.
My biases are that I have written maybe a quarter-million lines of C, and I learned OO in Smalltalk-76. I would go with Java over C++ (if those were the only choices) for 2 reasons. First, Java actually fixes some of the problems with C and C++, which C++ doesn't. Neither one is as safe as some of the modern interpreted languages like Perl, which make even more classes of errors impossible (or at least difficult) to write, but Java is clearly better than C++ in that regard.
The other reason is more like a lack of a reason. I don't feel like C++ is a more natural and intuitive extension of C than Java is. They both felt about equally easy or hard to make the transition to (and so did C* for the Connection Machine). So I don't think that "similarity to C" should be a reason to prefer C++, even for a C programmer.
If they have an experience in programming language before java is good but if this is the first programming language their learn c++ is prefered
In my view, the most power program tool is ASP.NET with C#. Please, have a look at the link https://www.researchgate.net/post/Is_Java_too_complicated
In my opinion two programming techniques are to be distinguished : Object Programming (OP) and Object Oriented Programing (OOP). In OP like with java and visual basic , the programmer usually uses predifined objects and costumizes them or build new derrived ones. However in OOP using C++ the programmer is appealed to create new class objects based on elementary data type, which requires many skills of a high level in C and C++ programming. Also and as indicated by Java programming inventor J. Gosling : Java= C++ minus complexity plus security. that is Java can be tought as a secure derrivation of C++ where the objects needed by the programmer are predifined and capitalized as library : For these reasons and based on my own experience in teaching java and C++ for some years ago, I recommand Java instead of C++ since that it is suffisent to introduce the object programing concepts, and is much easier to take in hand than C++ for undergraduated students. But for graduate students in sciences and technology, especially those who will be involved in developping specific enginering appications, I prefere C++ since that it offers a great flexibility in the introduction of OOP concepts and their use in the developpement of usefull software components .
In my opinion, we can learn the basics of OO programming, ( representation as objects, polymorphism, ...) and then show their implementation is both languages Java, and C++ languages.
I'd prefer C++ as it is universally accepted among all different fields of science and engineering...
first learn C++ then proceed for java. I will prefer C++. comparing java, C++ has higher priority
Thanks to all for replies and fruitful discussion. This is really a Question Mark in Academia to use a particular language for teaching OOP methodology. In my personal point of view I would suggest to use C++ at it covers more aspects of OOP but I would also recommend to use JAVA in combination with C++ which might be complex to deal with but may be a good experience.
Between this two, absolutely Java. The main reason is that if you use C++ for the first time, you not only have to deal with OOP, but with pointers, and it is really painful. It is more easy to see and learn the main OOP ideas with clear languages, such as Java (alternatively you might also consider Python).
Java was made for this very reason, OOP. C++ is good too tho.
Final answer: Java
If you want to teach OO, between C++ and Java, the answer is Java, no doubt. C++ is lower level and you can use imperative programming with C++, without OO. But if you want to teach pure OO, you should teach Smalltalk.
OO purity: Smalltalk > Java >> C++
Java is simpler and have a clear syntax, so it is convenient to teach OOP. Also, you can use C# as a simple language and both of Java and C#'s syntax is nearly same.
C++ is a really complex language as it has many features that interact with each other. If you want to use it to teach OOP you should at all cost try to select the features of the language that are essential and not present the rest.
Java is certainly simpler than C++. Indeed, the garbage collector relieves the programmer from the hard task to track references to the created objects.
I heard C# improves on Java. But if you use a Unix-based environment, the tools might not be as good as Java's.
Finally, I would also mention Scala. It is compatible with Java but has a much leaner syntax and as it is essentially functional it tends to allow for more concise solutions.
Anyway, once the concepts of OO are taught, the students should be able to use them in the language of their choice.
P.S. I do not know Simula or Python so I cannot comment on them.
I would recommend Java over C++ as a first OO language. For all its failings, Java is better to learn OO than C++ just because it is simpler and other things won´t interfere (memory management, pointer arithmetic...). I'd say, provided a knowledge of imperative programming first, in order to learn C++ programming in assembler or C understanding OO is a prerequisite, because it is a complex language for a newbie.
I would also prefer you to use Java, since it is full oops oriented
I have been teaching OOP at my department from the last 3 years. Although we are also following C++ in OOP but my observation is that for basic understanding about OOP, C++ is good option because the students are coming with a background of C in the previous semester. Although Java is more suitable for OOP, having lots of new features but on the other hand Java is bulky language. Teaching Java at UG/PG level teaching as one of the course in a semester of 4 months (2 months excluded for exam, holidays, etc.) is not possible.
Hi, you can first introduce OOP without any language by defining the concepts such as encapsulation, methods, objects, inheritance, polymorphism, composition, aggregatin, etc. After that you can show them how these concepts can be implemented using C++ or Java programming languages. On e important thing is to know that C++, Java are languages that implemented OO paradigms. You should also point out the differences between the two languages. For instance, multiple inheritance is not allowed with java but it is the case with C++, etc.
I am going to go against the crowd. Teach using C++, structure it properly, then they will be able to use any language they want afterwards. C++ is complex if you do everything at once, but to use it properly you have to understand how computers work and how compilation works, two very useful bits of knowledge.
Who said education should be easy?
I wonder that there are 2 important concepts which JAVA does not cover, operators overloading and multiple inheritance. So for what i have come to conclusion that if time permits in a single semester, it should be designed in such a way that OOP concepts should be covered by using both the languages or there should be a comparison at the end how each language supports a particular oop feature.
If you want to teach the programming art and the objective it is to have good programmers (that know what they do), the best solution is C++ even if it is not a pure OO language. Othewise the best solution is Java.
C + +, and many other languages, OOP-based OOP-based languages, the first one was inspired by him. Pure object-based, such as Java or C # (pure OOP) is not. Procedural includes features. so
C ++ =C + OOP
in the form of an equation can be established. Lower-level language. Not easy to learn. I would not recommend it if you do not intend to write the operating system. I think java
No doubt C++ is first step to learn object oriented programming language..but According to me JAVA is better to teach object oriented language because it is pure object oriented programming language and C++ is little bit confusing language for beginner...
C++ is a mess, with all the dirty parts of C (preprocessor, pointers, varargs, ...) showing through. in addition, many parts are inconsistent (why do templates use a totally different syntax, for example?). And without garbage collection, memory leaks are very likely.
Java has many rather clumsy aspects, such as getter/setter methods, horrible container classes for integral types, etc.
If you want to stay in the family of C-class languages, have a look at d:
http://digitalmars.com/d
Or you can have a look at Ruby - it's one of the cleanest OO languages I've seen so far.
In case you want to teach your students how OO can be implemented "under the hood", based on a very simple language, check out LUA.
If the students have taken first course of programming and they had studied C++ there. Then it would be better to opt Java in OOP because C++ is not purely OOPL.
If the choice is limited in these two languages I would say Java. It is purely object-oriented, has a garbage collector, a Just-in-time compiler, some features of concurrent programming. But for a third language I would recommend Eiffel. It incoporates some excellent software design features e.g. "design-by-contract", and the language looks more elegant than Java. Of course, "elegant" is a matter of taste. For European "school" of programming, Pascal might look elegant, while for the North American, C looks nice. Another choice might be Python.
It all depends on target application. There is no one right answer to this problem and everyone has an opinion and their favourite language. Currently, mine is Java for the simple reason that it is truly portable across platforms. However, to use a topical example, Java is not so good with OpenCL. So if you wanted your students to explore more modern approaches to accelerated performance in their simulations Java would be a less useful tool (here C99 and objective C would also be possible options to explore). I am sorry but in my view your description of the problem is far too brief for anyone to be able to provide you with really helpful suggestions.