PDA

View Full Version : Java or C++




NWAMacTech
Feb 15, 2006, 08:36 PM
I have been researching this question for quite some time and just to further that research I would like all of you experienced programmers opinion. I would like to make a career move, I have always enjoyed programming playing with VB, PHP, and the like but I am not a developer. Where should I start, in your opionion what languages will be most important to watch in the next few years. I want to make myself as marketable as possible however i know that may not be simple.



Mitthrawnuruodo
Feb 15, 2006, 08:45 PM
If you're new to Object-Oriented Programming, then I would recommend to start with Java, and then when you feel you master that you're ready for C++, because Java is more educational/intuitive and not quite as messy/picky as C++. If you know Java then C++ should be fairly easy...

On the other hand, if you're comfortable with the concept of OOP and like to fiddle with details then go for some straight C and on to C++. ;)

NWAMacTech
Feb 15, 2006, 08:48 PM
I probably shoudl have asked in my orig. question. Can you recommend soem good books on java and or c++. I know there are lots out there and some i have looked at just suck.

bousozoku
Feb 15, 2006, 09:13 PM
I probably shoudl have asked in my orig. question. Can you recommend soem good books on java and or c++. I know there are lots out there and some i have looked at just suck.

Try Bruce Eckel's Thinking in Java and his Thinking in C++ books.

Java is definitely a better language to learn because it's closer to a pure object-oriented language but C++ is a very popular language (for buffer overflows) on many platforms.

jsw
Feb 15, 2006, 09:16 PM
Ditto on Eckel.

As far as which language: after about a decade with C++ and close to that with Java (very little overlap, so the C++ was a while ago), my personal preference is Java.

However, I recommend that you look for open positions in your area to see who's hiring for each language. Around here, there's a stronger market for C++ than for Java.

zimv20
Feb 15, 2006, 09:39 PM
Java is [...] closer to a pure object-oriented language
how so?

jsw
Feb 15, 2006, 09:50 PM
how so?
I think the key word was "closer".

Java isn't pure, yes, there are non-object data types, but almost everything you use is an object. C++, well, not as much.

bousozoku
Feb 15, 2006, 10:24 PM
how so?

You can pretty much avoid any primitive types in Java and use objects for everything, in contrast to C++ where you can write whole applications without using a single object.

zimv20
Feb 15, 2006, 10:49 PM
interesting take, guys. i look at the "OO-ness" of a language based on how well it supports the core concepts (polymorphism, inheritance, etc.), rather than the extent to which it prevents the user from doing non-OO things.

no worries, though, i was just curious about the thought process.

bousozoku
Feb 15, 2006, 11:14 PM
interesting take, guys. i look at the "OO-ness" of a language based on how well it supports the core concepts (polymorphism, inheritance, etc.), rather than the extent to which it prevents the user from doing non-OO things.

no worries, though, i was just curious about the thought process.

Well, I'd known people in the past to write a whole application with procedural code and try to convince other people that they were actually using C++, at least, until we made changes to the file extensions and compiled the same code using a C compiler.

C++ is definitely a hybrid language. Borland went out of its way to make their Object Windows Library work more like a Smalltalk framework than C++. It's rather obvious from the way the wind blew that more than a few developers on DOS were more comfortable with the haphazard C/C++ approach of Microsoft Foundation Classes.

zimv20
Feb 15, 2006, 11:33 PM
Well, I'd known people in the past to write a whole application with procedural code and try to convince other people that they were actually using C++
ahhh, the abuses. so, so many. like the guy i knew who "didn't trust" classes and kept using structs. or the guy who didn't quite understand inheritance and his baseclass ended up containing all the members of its derived classes.

good times :-)

zimv20
Feb 15, 2006, 11:42 PM
back on topic...

i see two big differences between c++ and java:

1. c++ was designed and maintained, for a long time, as a core language that tried to avoid forcing implementation on its user base. a friend of mine was on the standards committee for years, and he told me this was the reason they chose not to define standards for things like a string class (this was a long time ago), which gave rise to companies like RogueWave. Sun, otoh, had no qualms about adding all sorts of packages to java from the get-go, plus defining standards for things such as inter-machine communcation and even development environments.

2. java grew up in the internet age and focused to a high degree on portability and runtime environments. while the core of c++ (see #1) is portable, the things that developers code to make them run in an environment turned out to be very non-portable (an unfortunate fallout of the early committment to avoid forcing implemenation). to that end, i feel that learning java gives one a leg up on having skills that work on a variety of platforms as provided by the language, as opposed to, in c++, having to rely on 3rd-party vendors providing portability across platforms.

bousozoku
Feb 15, 2006, 11:58 PM
back on topic...

i see two big differences between c++ and java:

1. c++ was designed and maintained, for a long time, as a core language that tried to avoid forcing implementation on its user base. a friend of mine was on the standards committee for years, and he told me this was the reason they chose not to define standards for things like a string class (this was a long time ago), which gave rise to companies like RogueWave. Sun, otoh, had no qualms about adding all sorts of packages to java from the get-go, plus defining standards for things such as inter-machine communcation and even development environments.

2. java grew up in the internet age and focused to a high degree on portability and runtime environments. while the core of c++ (see #1) is portable, the things that developers code to make them run in an environment turned out to be very non-portable (an unfortunate fallout of the early committment to avoid forcing implemenation). to that end, i feel that learning java gives one a leg up on having skills that work on a variety of platforms as provided by the language, as opposed to, in c++, having to rely on 3rd-party vendors providing portability across platforms.

Considering the early days of C on the x86 systems, standard libraries were needed because even amongst functions with the same name, the functionality was sometimes widely different. GUI development is so (relatively) easy using Java because you don't have to learn multiple frameworks. I'm just surprised that the development of C++ shadowed that of C and generated a bit of chaos.

zimv20
Feb 16, 2006, 12:03 AM
GUI development is so (relatively) easy using Java because you don't have to learn multiple frameworks.
exactly. i know a bunch of guys who were experts in parcplace OI. and where did that get them? :-)

irrŠtišnal
Feb 16, 2006, 06:43 AM
I have been researching this question for quite some time and just to further that research I would like all of you experienced programmers opinion. I would like to make a career move, I have always enjoyed programming playing with VB, PHP, and the like but I am not a developer. Where should I start, in your opionion what languages will be most important to watch in the next few years. I want to make myself as marketable as possible however i know that may not be simple.

i;m gonna take in your question my dear fellow, with a not so humble opinion of mine... i propose you the following readmap:

i would 1000:1 beg you to start with Java. get involved to writing Java "applications" (i.e. bytecoded compilations to run on the JVM) that are some sort of translations of your favorite PHP scripts or Swing forms that do the same as your VB apps.

use the latest JSDK (1.5.0, aka Tiger - coincidentally) and get your hands on a nifty code editor, one without a visual form designer: else you will start just dragging and dropping buttons and scrollbars like a maniac with no sense at all. i PERSONALLY RECOMMEND JCreator for the Win32 platform.

most importantly. familiarize with the first 3 basic APIs of the framework, the Core (java.lang, java.io, java.util, etc), the AWT (all the java.awt.*) and the Foundation Classes (all the javax.swing.*)

a good way to do programming by means of real life necessities: when i started i was really a newbie and i wanted to make a database of all my images. i knew that making software that would (1) do the JPEG compression/decompression, image analysis; (2) do the databasing in SQL or whatever and (3) be **EFFICIENT** would be a formidable task. (one that until now, i have not completed :D .) but i was decided to start somewhere and there i began: i could do a program that traversed a folder structure, dump the image metadata, and put it in a XML file. at that time what was a good achievement, because i got me seriously in the field.

then start some multithreading, IO intensive, graphics programs; while at the same time you go for .NET in C#.

the .NET platform is REALLY a damn copy cat of the Java platform. at it;s beginning it was more like a Microsoft optimized implemetation of the Java paradigm. now it is a very robust an promising technology. Vista will be mostly based on it, and consequently direct development for will be much easier/strcutured/well documented/consistent/scalable/bug-free/etc.

not until you have mastered Java basics and C# (both of which will, almost by inertia give you an intuitive idea of what C is like - you would think it is like a primitive version of Java or C#) you can start C++

seriously, it;s not that i want to be alarmist giving an impression that C++ is difficult/complicated. a (serious) problem (for newbies) with it is that it really is a literal (HUGE) extension of C, and as such it inherited all the compilation/linking/optimization hassle of its predecessor, altogether with the first real encounter with the ideal of OOP. the memory management is ONLY one of the many issues that you would struggle with for a while. i mean it. just to begin with, in C, people get in trouble getting a clear picture of the pointer/array and array of pointer/pointer to array/pointer to pointer question...

in C++, the concepts of inlining, const-ness, (the infamous) references, copy/assigment/slicing, construction/destruction, dynamic binding, etc, etc, etc, etc, and more etc, will simply and utterly bloat the novice. and with this much hassle, chances are (s)he will end up not developing any **real** applications in any short time and will go frustrated :(

try C++ all the time, until you get it. but in the meantime, get serious job done and apply a serious effort on Java, .NET and more PHP... or Perl/Python etc...

cube
Feb 16, 2006, 09:28 AM
C++ is so bad I would even consider learning .NET if those were my only two options.

Which they aren't. Just stay away.

Forget about Perl, too. Best recipe for code nobody wants to look at.

zimv20
Feb 16, 2006, 10:09 AM
C++ is so bad [...]
what's "bad" about it? i think it's a fantastic language for large-scale development. if you know what you're doing.

Forget about Perl, too.
irrelevant to the discussion, but again: why? are you also going to have a go at sed and awk? if you want code that's nearly impossible to decipher, try lisp.

cube
Feb 16, 2006, 11:19 AM
if you want code that's nearly impossible to decipher, try lisp.

Lisp family languages are the only ones that get it right.

cube
Feb 16, 2006, 11:27 AM
what's "bad" about it? i think it's a fantastic language for large-scale development. if you know what you're doing.


There's too many things to list them here. Just google for "c++ sucks".
Just look at the crazyness people go about to do template metaprogramming. All that stuff is a piece of cake in Lisp, and way more powerful, as you can use the whole language for that, not a pathetic subset of types and operations.

cube
Feb 16, 2006, 11:37 AM
irrelevant to the discussion, but again: why? are you also going to have a go at sed and awk?

It's not irrelevant, as somebody before mentioned Perl as something he might want to learn instead of C++.
When I took a glance at awk, it didn't look so bad.
I use a bit of sed sometimes, and I have some little scsh (Scheme shell) script to apply a sed script to sets of files. I wouldn't write anything complicated in sed.
I do Perl-compatible regex in Java. One doesn't need to know the whole Perl language for that.

zimv20
Feb 16, 2006, 11:41 AM
Just look at the crazyness people go about to do template metaprogramming. All that stuff is a piece of cake in Lisp.
i dabbled in lisp some time ago (nearly 20 years ago, sheesh), so i'm probably quite out of date on the current state of the language. even so, i'm having a hard time imagining it being suited for the kinds of large-scale projects i've done in c++.

no worries on the perl thing, i hadn't remembered it was mentioned. but again, not really suited for large-scale, imo. apples and oranges.

cube
Feb 16, 2006, 12:04 PM
i'm having a hard time imagining it being suited for the kinds of large-scale projects i've done in c++.


If you need fascism, none of the currently available Lisp languages is going to help you, AFAIK (unless maybe you implement your own dialect on top of it). In that case, the right alternative used to be Eiffel (when I looked at Ada 9X, it was broken for OO). As it is possible to do Design by Contract with third party tools now, Java is the current best alternative, because of all the libraries available. As there are generics with 1.5, there's no more excuse.

BTW, aspect-oriented programming originated with Lisp. You don't need third-party tools for that there.

Soulstorm
Feb 16, 2006, 03:48 PM
I will be truthfull. The only programming I had done before I start C++ was HTML and Applescript, which were no way near the concept of C++. I started C++ and at the start, the concepts were easy to grasp but then... POINTERS APPEARED!

My God, I don't remember being so frustrated in my entire life. There are problems that I encounter even now in C++, 10 months after I had my first encounter in C++.

The other thing that frustrates me is C++ output to files.

And the last and very important thing: C++ is a total CHAOS! Is very picky, and doesn't forgive mistakes. Is not only is a superset of C, is a HUGE implementation of new information! Not only that, but it has so many things to learn, so many libraries, and so many programming techniques, that it may take years to master the language and actually make a program that it would really get you any money at all. If you do a search for C++ in google, you will find that apart from the things that the books tell you, there is also a vast amount of information that you must read and study in order to get profficient in C++

Do not make the same mistake as I did. Learn a simpler language first, like Java, which is cross-platform, then move on slowly to C++.

One thing I must tell you though. What i do like about C++, is the fact that lets you not only do anything, but when you finally manage to write some decent programs, you will see that it will have forced you to write a very clean codebase. Programs that are written in C++ are very clean compared to other languages...

Finally, I don't know if that matters to you, but I heard somewhere that Apple will not be continuing Java's implementation in OS X. It will leave it as is. Java was never meant to be implemented as one of OS X's native SDK's. They initially intended to provide support for Obj-C, C++, C. After that they only included Java to attact the Java developpers, but now, they want to drop support. I guess that explains why Java has always performed so badly on the Mac platform...

BOOK RECOMMENDATION:
After you have read a book that will teach you the basics in C++, you can download Bruce Eckel's "Thninking in C++" Vol1 and Vol2 for free on the internet. They are an excellent source of information and will teach you many things that will help you write some decent programs.

jsw
Feb 16, 2006, 03:55 PM
I want to make myself as marketable as possible however i know that may not be simple.
Given the original poster's intentions, I think we can forget about the "best" language. I don't think anyone will argue persuasively that Lisp is all that marketable a skill. C++ or Java are both good choices, and, around here, there are more C++ jobs than Java ones.

Quality of language is unimportant - the OP wants marketability. God help him, but .NET isn't a bad idea either.

Mr. Mister
Feb 16, 2006, 04:17 PM
If you're looking for one to start and stay with for your whole career, than you have to ask yourself what you want to be programming, since C++ is extremely popular with game design and desktop apps for Windows, while Java has a whole different set of applications.

(the above could be wrong, I only know a little bit about both, but got the overall impression that C++ is the mainstay for programming actual apps)

cube
Feb 16, 2006, 04:39 PM
From monster.com

Jobs in the US paying 100K or more:

Java: 837
C++: 685
.NET 410

jsw
Feb 16, 2006, 04:40 PM
From monster.com

Jobs in the US paying 100K or more:

Java: 837
C++: 685
.NET 410
Link? Just curious.

zimv20
Feb 16, 2006, 05:05 PM
The only programming I had done before I start C++ was HTML and Applescript, which were no way near the concept of C++.
right. scripting is different from procedural which is different from OO. all programming is not created equal. and once you get into real programming, pointers and references are needed. granted, C (and in turn C++) allows for all kinds of nutty pointer constructions, but it's also really powerful.

like any powerful language / paradigm, it takes time to get proficient. i came to C++ from a strong C background and that helped a good deal. of course, i had to unlearn some habits in order to properly learn C++ as an OO language, and it always helps to learn in steps.

my first C++/OO project was 3-tier client/server and i worked on the middle tier. that meant i wasn't messing with stuff like GUIs or file i/o. what i concentrated on was building domain objects, providing services to the front end, and persistence. the GUI group knew very little about the domain and nothing about persistence, their expertise was using our interfaces and displaying the data.

these separations are important not only from a design perspective, but also from a learning perspective. when you're messing with HTML, it's a hodge podge of data, display and (if needed) persistence. but it's not built for much beyond that -- ever try performing data analysis in HTML?

if HTML is what you're used to, then of course C++ is going to be overwhelming. but it needn't be, it just takes time. same for java; it's actually more involved than C++, imo, because of all the packages and environments it comes with. java is extremely powerful and can be overwhelming, but well worth any programmer to learn.

MarkCollette
Feb 16, 2006, 06:26 PM
It depends on what kind of programming you want to do? Web apps, embedded, client side software, scientific calculations, database apps...

Most likely your choice will be between Java and C#, not C++. Java and C# are sufficiently similar, that there's no reason to not learn both.

darkwing
Feb 16, 2006, 07:02 PM
Java sucks. Plain and simple. If Java was so great, why are JVMs written in C++ and not in Java? :rolleyes:

It really depends on what you want to do. You'll have more fun being a n00b with Java because you can get into some pretty easy GUI stuff once you learn the core of it. However, c++ produces much faster and more efficient code. The JVM on OSX sucks big time. My 1.67 GHz G4 chokes 100% cpu on the same thing a p3 running windows does with 5%. C++ always produces more efficient code than Java because it's compiled for that architecture.

I write medical device software for a living. I do everything in C/asm for small microcontrollers and C++ for small footprint PCs running embedded Linux (mips/x86.) When you start looking at I/O lines on a scope and wanting things to be within so many microseconds of each other, you start to figure out that a language like Java won't cut it.

If you want to make some little windows with pretty buttons to change the color in a box, use Java. Or, you can always try c++ with wxWidgets or something. At least that's a "portable" gui.

Just my 2 cents. Back to homework. bleh

zimv20
Feb 16, 2006, 07:22 PM
Most likely your choice will be between Java and C#, not C++.
i've not used c# -- what platforms is it running on these days?

i don't really understand so many people's aversion to c++. darkwing had a good response about performance, i know of a number of large projects done in c++ -- and not java -- for that very reason.

bousozoku
Feb 16, 2006, 07:36 PM
i've not used c# -- what platforms is it running on these days?

i don't really understand so many people's aversion to c++. darkwing had a good response about performance, i know of a number of large projects done in c++ -- and not java -- for that very reason.

I know that it has better performance and, in the hands of someone paying attention, it can be an asset but most programmers can't seem to keep from creating memory leaks and buffer overflows because they're not methodical enough. The same thing can be said for C and, to a lesser extent, Objective-C. C++ is especially targeted because of its high degree of usage and the ability to not create just one object with a leak but to create thousands.

How many leaking browser windows with leaking browser tabs does it take to bring down an operating system?

Is that overly dramatic? Sure, but without due vigilance, Java is safer than C++. From what I've seen of most C++ programmers, they should be coding in Java--it would make the computer a safer place.

MarkCollette
Feb 16, 2006, 07:39 PM
i've not used c# -- what platforms is it running on these days?

i don't really understand so many people's aversion to c++. darkwing had a good response about performance, i know of a number of large projects done in c++ -- and not java -- for that very reason.

I have no aversion to C++, in fact I learned it years before Java, and have used it in conjunction with Java since then. But, I would recommend learning C before C++, and so would not recommend C++ as a starter language.

Given no information on what kind of software this new programmer is hoping to write, I have statistically assumed that he'll want to write business software for a living. In that market, corss-platform Java, and Windows-centric C#/.NET are the two main players. As well, they're relatively good introductory languages for getting useful stuff done.

MarkCollette
Feb 16, 2006, 07:57 PM
Java sucks. Plain and simple. If Java was so great, why are JVMs written in C++ and not in Java? :rolleyes:

Wow. Could it be that JVMs are written in C++, because Java relies on a VIRTUAL MACHINE, which must at some point interface with a native system, for which the system APIs are only accessible in C/C++? Or would you prefer the JVM run in a JVM, run in a JVM, run in a JVM...


It really depends on what you want to do. You'll have more fun being a n00b with Java because you can get into some pretty easy GUI stuff once you learn the core of it. However, c++ produces much faster and more efficient code. The JVM on OSX sucks big time. My 1.67 GHz G4 chokes 100% cpu on the same thing a p3 running windows does with 5%. C++ always produces more efficient code than Java because it's compiled for that architecture.

If his goal was to do cool programming on OS X, then I would suggest Cocoa programming in Objective C would be a more direct route to that end, than Java or C++.


I write medical device software for a living. I do everything in C/asm for small microcontrollers and C++ for small footprint PCs running embedded Linux (mips/x86.) When you start looking at I/O lines on a scope and wanting things to be within so many microseconds of each other, you start to figure out that a language like Java won't cut it.

If you want to make some little windows with pretty buttons to change the color in a box, use Java. Or, you can always try c++ with wxWidgets or something. At least that's a "portable" gui.

Just my 2 cents. Back to homework. bleh

Java is mostly used on the server side, rather than in little GUIs with buttons. But, there's also a lot of MIDP stuff, where applications on cell phones are written in Java.

For embedded work, one has to know that C++ does have a runtime, whereas C does not, so when doing embedded work it's either assembly, C, or subsets of C++ that give you the functionality of C with some of the syntax of C++.

And if you want to do cross-platform GUIs in C++, there's also QT from TrollTech.

zimv20
Feb 16, 2006, 08:00 PM
From what I've seen of most C++ programmers, they should be coding in Java--it would make the computer a safer place.
yeah, that's a good point.

I have statistically assumed that he'll want to write business software for a living. In that market, corss-platform Java, and Windows-centric C#/.NET are the two main players.
i'd like to know if c# has really overtaken c++ in the number of jobs. regardless, you say it's "windows-centric". do you know if it's available on any non-windows platform? i thought it was designed to be, but i haven't really been playing close attention.

Josh
Feb 16, 2006, 08:15 PM
Although C was the first program language (besides simple visual basic stuff in high school) that I began to teach myself, and only got into it very little, the first college course in my CS program was 'Algorithms and Computing with C++,' which I am currently taking.

So, C++ is the first (as I see it) language I've really began learning.

That being said, I don't know of enough of another language to make comparisons, but so far it doesn't seem bad learning it. My course work is challenging, and I've made some fun stuff w/ it outside of class too.

I want to eventually pick up Cocoa as well, because I'd like to develop Mac applications.

Still not certain yet if I'd like to focus on web-centric development, or standard application development (or maybe somewhere in between), which will determine which languages I'll want to know really well.

bousozoku
Feb 16, 2006, 08:52 PM
i'd like to know if c# has really overtaken c++ in the number of jobs. regardless, you say it's "windows-centric". do you know if it's available on any non-windows platform? i thought it was designed to be, but i haven't really been playing close attention.

It's available anywhere the Mono environment is available, but you know the trouble with keeping up with Microsoft's changes--just ask anyone trying to provide perfect file translation for MS Office--even the Macintosh BU can't do it.

zimv20
Feb 16, 2006, 09:13 PM
iow, it's still only available on windows?

bousozoku
Feb 16, 2006, 10:37 PM
iow, it's still only available on windows?

Well, there are multiple answers. :p

The official version is only running on Windows for Windows. Supposedly, Microsoft was working on as Macintosh runtime backend but as far as I've heard, they've never even come close to deploying it.

Mono is available everywhere because it's an open source project.

zimv20
Feb 16, 2006, 10:58 PM
thanks, bousozoku.

ryan
Feb 16, 2006, 11:21 PM
around here, there are more C++ jobs than Java ones.

You keep saying that but Monster.com shows more Java jobs than C++ ones, at least in the Boston area (which I realize isn't *that* close to Andover but they don't list Andover in their city selector).

Anyway, back to the original question, why not try both? I prefer Java (although I've started doing some work with Ruby) simply because it has such a big user community and there are so many great tools and libraries available.

jeremy.king
Feb 20, 2006, 03:37 PM
Given no information on what kind of software this new programmer is hoping to write, I have statistically assumed that he'll want to write business software for a living. In that market, corss-platform Java, and Windows-centric C#/.NET are the two main players. As well, they're relatively good introductory languages for getting useful stuff done.

As a consultant for the last 9 years, C# (.NET) and Java are definitely two of the most common requested skills asked for from our clients. I personally prefer Java - been doing it since 1998, while I am learning C# on the side to see what the hoopla is all about. PHP is another up and comer, but hasn't really fully penetrated enterprise just yet - so far the trend has been SMB but if thats your thing, go for it.

The most marketable skill you can have is being able to solve problems using ___________ technology.

zimv20
Feb 20, 2006, 04:26 PM
The most marketable skill you can have is being able to solve problems using ___________ technology.
amen to that.

darkwing
Feb 20, 2006, 09:04 PM
Wow. Could it be that JVMs are written in C++, because Java relies on a VIRTUAL MACHINE, which must at some point interface with a native system, for which the system APIs are only accessible in C/C++? Or would you prefer the JVM run in a JVM, run in a JVM, run in a JVM...

Hence the joke. :)

If his goal was to do cool programming on OS X, then I would suggest Cocoa programming in Objective C would be a more direct route to that end, than Java or C++.

True I should have asked him what his goals are. I'm so used to thinking of things in a "portable" nature unless otherwise specified that I just assumed he was doing something non graphical.

Java is mostly used on the server side, rather than in little GUIs with buttons. But, there's also a lot of MIDP stuff, where applications on cell phones are written in Java.

Why would anyone do anything with java on a server side? Servers demand performance, and Java doesn't perform. I'm not saying you're wrong..I know they use it on the server side..however I think that runtime efficiency should always trump developer education.

For embedded work, one has to know that C++ does have a runtime, whereas C does not, so when doing embedded work it's either assembly, C, or subsets of C++ that give you the functionality of C with some of the syntax of C++.

C++'s runtime is deterministic as long as the new operator isn't being used. In a hard realtime system, all you really care about in the long run is determinism because that determines worst case latency.

And if you want to do cross-platform GUIs in C++, there's also QT from TrollTech.

What about wkWidgets? I want to use that one when I get some more free time.

ryan
Feb 20, 2006, 10:26 PM
Why would anyone do anything with java on a server side? Servers demand performance, and Java doesn't perform.

That argument might have been valid in 1995 but it simply isn't true any more. Try a Google search for "java vs c++" and you'll see examples where C++ is faster in some cases and Java in others.

darkwing
Feb 20, 2006, 11:00 PM
That argument might have been valid in 1995 but it simply isn't true any more. Try a Google search for "java vs c++" and you'll see examples where C++ is faster in some cases and Java in others.

I have googled that before, and it's all bunk. Hey, they make the same argument the pot-heads do. It's just to convince themselves. :)

I've done a lot of real world tests on sorting and searching algorithms and Java doesn't even come close..sometimes slower than 4000 times the C counterpart. Even with Java compiled for native machine code, there's still a VM on top of it.

I know from personal experience the OSX JVM is total crap and Windows machines much older and slower than my Mac eat less CPU cycles running Java.

ryan
Feb 20, 2006, 11:17 PM
II've done a lot of real world tests on sorting and searching algorithms and Java doesn't even come close..sometimes slower than 4000 times the C counterpart.

And I can write an application in C that is slower than one written in Java. So your point is what?

Anyway, as I said before, the OP should try out a number of different languages and see which one(s) appeal to him. Maybe it will be C/C++, Java, or another language entirely. Best of luck.

therevolution
Feb 21, 2006, 12:28 AM
Why would anyone do anything with java on a server side? Servers demand performance, and Java doesn't perform.
Whoops, somebody better tell the J2EE community!

Is Java as fast as C in every situation? No. Is the reverse true? No. (http://www.idiom.com/~zilla/Computer/javaCbenchmark.html) In the end, it's all about the best tool for the job. Java has the J2EE framework for developing server side applications - what does C have? In the business world, nobody is going to code things from scratch in C because it's the "right" thing to do. It would be a complete waste of time and resources.


I think that runtime efficiency should always trump developer education.

Developers should always be aware of common performance pitfalls, but it's only useful to a certain point. Outside of certain domains, nobody really cares about a few milliseconds anymore - not when the cost of hardware is so cheap. Rather than waste developer time squeezing out a few extra cycles, you can just throw some more servers onto the load balancer.

darkwing
Feb 21, 2006, 08:59 AM
And I can write an application in C that is slower than one written in Java. So your point is what?

Anyway, as I said before, the OP should try out a number of different languages and see which one(s) appeal to him. Maybe it will be C/C++, Java, or another language entirely. Best of luck.

All right. Tell you what. You show me a single thing that Java can do faster at runtime than C or even C++. Just one. Give me some common input file, a java file and a C file, properly written and optimized, that when compiled and run will produce the same output, and I'll time their execution. Just one. Then I'll gladly admit I was wrong.

jeremy.king
Feb 21, 2006, 09:10 AM
All right. Tell you what. You show me a single thing that Java can do faster at runtime than C or even C++. Just one. Give me some common input file, a java file and a C file, properly written and optimized, that when compiled and run will produce the same output, and I'll time their execution. Just one. Then I'll gladly admit I was wrong.

Show me a C program that once compiled can run on a variety of platforms and architectures...Two languages, two different purposes. Assembly is faster than C, so using your failed logic it must be a better language?

What value are you even adding to the OP question??? Um, that would be none. :rolleyes:

He wants to know what language would make him make him marketable, not which language is bigger/faster/better....

darkwing
Feb 21, 2006, 09:18 AM
Show me a C program that once compiled can run on a variety of platforms and architectures...Two languages, two different purposes. Assembly is faster than C, so using your failed logic it must be a better language?

What value are you even adding to the OP question??? Um, that would be none. :rolleyes:

He wants to know what language would make him make him marketable, not which language is bigger/faster/better....

Well, let's see. I did an independent study as an undergraduate where I wrote a computer game with openGL using SDL, a portable API to multimedia hardware. I demonstrated the game on three laptops: windows, mac, and linux all running side by side. SDL is ported to all three systems just as the JVM is ported to all three systems. It's the same premise, only it runs much much faster. The only downside is it requires a build on each machine. That's fine though. All those saved CPU cycles will more than make up for that as they add up over time. :) Would you like the source for it? That will meet your criteria just as well as Java does.

Sure I could have done the game in assembly, but it would have taken me much longer to do it. I could have done it in Java, too, but that also would have taken me longer. I know Java quite well, but I only use it when I need to make an applet for a web page. As far as I'm concerned, that's its only strong point.

The main reason I suggested the OP learn C++ is that it would aid in his transition to Objective-C should he pursue OSX development. However, there's no portable implementation of Obj-C that I know of, so he should start with basics. Besides, GUIs come later anyway.

cube
Feb 21, 2006, 09:27 AM
The main reason I suggested the OP learn C++ is that it would aid in his transition to Objective-C should he pursue OSX development.

C++ would only help in confusing him. Objective-C is a much simpler and better language.
C could be a stepping stone.

darkwing
Feb 21, 2006, 09:36 AM
C++ would only help in confusing him. Objective-C is a much simpler and better language.
C could be a stepping stone.

You think objective-C is simpler? I'm curious as to why. Do you mean language syntax itself or using the Cocoa classes? I find the language to be rather straightforward but the classes took a while to digest. I think I should have bought a book. I have managed to write a few good cocoa apps for school, but they all have memory leaks. I didn't bother debugging them because nobody would ever notice. I want to get it all figured out though before the "next best thing" comes out. The real problem now is finding time, because I'm already swamped with a full time job (using c++!) and double time graduate coursework.

jeremy.king
Feb 21, 2006, 09:42 AM
The only downside is it requires a build on each machine. ...That will meet your criteria just as well as Java does.

Well if you have to build it, how is that portable? And SDL is just an API, not the entire C language API. The fact you have to compile a program on x86 and then recompile for say, PPC or SPARC, then that - my C loving friend, is not considered a portable language. So I guess that doesn't meet my criteria...Anyways, you're obviously drinking too much of the C kool-aid to understand that the two languages have two entirely different purposes and the demand for Java programmers is much much higher than that of C programmers.

PS - some performance comparisons for you (http://kano.net/javabench/data) - seems C isn't all you think it is, but then I am sure you will find failed logic or bad optimization in this guy's test programs.

darkwing
Feb 21, 2006, 10:20 AM
Well if you have to build it, how is that portable? And SDL is just an API, not the entire C language API. The fact you have to compile a program on x86 and then recompile for say, PPC or SPARC, then that - my C loving friend, is not considered a portable language. So I guess that doesn't meet my criteria...Anyways, you're obviously drinking too much of the C kool-aid to understand that the two languages have two entirely different purposes and the demand for Java programmers is much much higher than that of C programmers.

PS - some performance comparisons for you (http://kano.net/javabench/data) - seems C isn't all you think it is, but then I am sure you will find failed logic or bad optimization in this guy's test programs.

Demand was higher for VB programmers once upon a time, and what happened to that language? You keep talking about "failed logic" and yet you yourself fail to grasp the simple reality of software layering. Let's review:

C program:

machine code

Java program:

machine code
JVM
bytecode

You also do not know the definition of a "portable" language.

http://en.wikipedia.org/wiki/C_programming_language

In reality, Java recompiles for your platform when you run something (JIT) which is the same thing as me doing it manually, therefore I guess Java must not be portable either.

Your link shows me a bar graph with no explanation of tests whatsoever. At the top it says "c++ sucks" so you expect me to think of this as some form of objective test site? Let's look at one of them...say, method call. Have you even read the JVM spec? In C++, even a virtual method call is simply an indirect jump from a class's vtable (which is defined statically). In Java, there's a whole lot more going on. If you have to use RTTI in C++, you should rethink your design. I always turn it off in my projects.

Outside of the web world, there is absolutely nothing that Java can do that C can't do, but there are a million things C can do that Java can't. Like write a JVM for example.

I can understand why people hate c++. It's got a lot of stupid ambiguities in it that can stump people. Of course, just because something is hard doesn't mean it sucks. Java has a lot of problems, too. For example, there's no equivalent for this:

void func(int **i)
{
*i = new int;
**i = 123;
}

Also, why does a language that claims to have no pointers have a NULL_POINTER_EXCEPTION? :rolleyes:

gekko513
Feb 21, 2006, 10:33 AM
Why would anyone do anything with java on a server side? Servers demand performance, and Java doesn't perform. I'm not saying you're wrong..I know they use it on the server side..however I think that runtime efficiency should always trump developer education.
Because often on the server side the demand for reliability, security, flexibility, scalability, development resources and maintainability is higher than the demand for performance on a single cpu. The overall performance is often more dependant on system design, I/O and scalability than on single threaded performance.

darkwing
Feb 21, 2006, 10:41 AM
Because often on the server side the demand for reliability, security, flexibility, scalability, development resources and maintainability is higher than the demand for performance on a single cpu. The overall performance is often more dependant on system design, I/O and scalability than on single threaded performance.

So what is inherent in the Java language that by defaults aids in scalability, I/O, or security? From a systems programming standpoint, a server running, say, Linux, is pretty good with I/O by default. Scalability? Java doesn't help you write threads that parallel well together, so using just pthreads or something similar is going to have the same issues. In most servers, there isn't really any parallel programming but rather threads dispatched to other CPUs or machines to aid in overall processing..so that has to be coded as well. Security? Java has some security mechanisms but my only experience with those is signing a .jar file with a bogus certificate so my online game project would work.

If you'd like to inform me I'd be glad to read it.

gekko513
Feb 21, 2006, 10:41 AM
void func(int **i)
{
*i = new int;
**i = 123;
}

No?

void doSomethingVeryStrange(ObjectHolder i) {
i.obj = new MutableInteger();
((MutableInteger)i.obj).value = 123;
}

class ObjectHolder {
public Object obj;
}

class MutableInteger {
public int value;
}

But what does this code solve?

darkwing
Feb 21, 2006, 10:45 AM
Lol sorry. I misread your code. I shouldn't have said there was no equivalent to what I did. I should have said it requires messy wrapper classes. Also, making data members public is a no no. :)

gekko513
Feb 21, 2006, 10:53 AM
Wow, an intelligent answer. Thanks.

So what is inherent in the Java language that by defaults aids in scalability, I/O, or security? From a systems programming standpoint, a server running, say, Linux, is pretty good with I/O by default. Scalability? Java doesn't help you write threads that parallel well together, so using just pthreads or something similar is going to have the same issues. In most servers, there isn't really any parallel programming but rather threads dispatched to other CPUs or machines to aid in overall processing..so that has to be coded as well. Security? Java has some security mechanisms but my only experience with those is signing a .jar file with a bogus certificate so my online game project would work.

If you'd like to inform me I'd be glad to read it.
I forgot to add that I don't necessarily think Java is always better for scalability, security and the other things I mentioned.

I'm just saying that single threaded performance isn't often the most important aspect to consider for server side programs. Java, C++ and other languages can have different strengths and in the end the choice of platform should depend on a weighted analysis of the advantages important to the task at hand.

I forgot the deployment environment as a variable in the equation. Application servers and such can fill in for a lot of the routine tasks in a server situation and make the development a lot easier.

Lol sorry. I misread your code. I shouldn't have said there was no equivalent to what I did. I should have said it requires messy wrapper classes. Also, making data members public is a no no. :)
But a C pointer is a public data member. I was just replicating the functionality. :p

darkwing
Feb 21, 2006, 10:56 AM
I forgot to add that I don't necessarily think Java is always better for scalability, security and the other things I mentioned.

I'm just saying that single threaded performance isn't often the most important aspect to consider for server side programs. Java, C++ and other languages can have different strengths and in the end the choice of platform should depend on a weighted analysis of the advantages important to the task at hand.

I forgot the deployment environment as a variable in the equation. Application servers and such can fill in for a lot of the routine tasks in a server situation and make the development a lot easier.

Well this may be my mistake, then. I figure that when you are setting up a server you want to keep the idea in mind that vast numbers of users may be using this, and you want as much room for growth as possible.

The only reason I see that Java has become popular is because it's "easier" to learn, and was hyped this way from the start, so a lot of people learned it. I'm also biased against Java because GridBagLayout sucks. :)

But a C pointer is a public data member. I was just replicating the functionality. :p

How is something not inside a class a public data member? :P

In my software engineering 2 course last year as an undergrad, we had to take a red/black tree C implementation and re-write it as Java. My friend and I had a race on it. I finished it in 2 hours, 20 minutes, and he finished it in about 2 hours and 40 minutes. What's funny is most people took a week+ to do it. The part that stumped everybody was the int** stuff. My friend and I both recognized it right away. I actually had to write a wrapper class because at the time 1.5 wasn't available for OSX, so I couldn't use AtomicInteger which would give me the functionality I needed. He got away with using that, the cheater.

I should point out, btw, that given the input from the teacher, the C version on my 1.5 ghz powerbook g4 ran the program in about 60 ms. The java version took about 1050 ms. On my friend's windows laptop (which isn't nearly as fast as my G4), it was about a 3:1 advantage for C using my java code. This goes to show why the OSX JVM stinks.

jtalerico
Feb 21, 2006, 10:59 AM
C#

gekko513
Feb 21, 2006, 11:07 AM
How is something not inside a class a public data member? :P
Of course it's not a public data member. It's not a member since it's not a class.

But the functionally equivalent to sending a pointer to pointer as a parameter to a function is sending a reference to an object with public data members.

jeremy.king
Feb 21, 2006, 11:09 AM
Your link shows me a bar graph with no explanation of tests whatsoever.


Its the link at the top of the page. :rolleyes:

http://kano.net/javabench/index

gekko513
Feb 21, 2006, 11:12 AM
Well this may be my mistake, then. I figure that when you are setting up a server you want to keep the idea in mind that vast numbers of users may be using this, and you want as much room for growth as possible.
Of course you do and that's why Java sometimes may be a good choice.

How much will it cost me to develop, set up and maintain a server system capable of serving 1000 transactions per minute the first year and then scale to a maximum of 10000 by the third year.

Sometimes the cheaper alternative will be Java. Sometimes it won't.

Edit: Hardware is most often the cheap part of the equation. Many server apps need to scale well over a server cluster. Adding nodes is cheap compared to other costs.

mwpeters8182
Feb 21, 2006, 11:16 AM
Yeah, java performance is absolutely putrid in OS X. I have no idea why, but I'd think it was something that apple would have fixed by now.

As for the C++/Java debate, I do most of my programming in C++, because it's what I'm most comfortable with. I've done some java, but for scientific computing, I'm always interfacing with C++ (or FORTRAN, yikes).

I think it's a matter of what you want to do with the language - Java's better for some things, C/C++ is better for otheres.

zimv20
Feb 21, 2006, 11:44 AM
Well if you have to build it, how is that portable? And SDL is just an API, not the entire C language API. The fact you have to compile a program on x86 and then recompile for say, PPC or SPARC, then that - my C loving friend, is not considered a portable language.
i've been reading but avoiding the c++ vs. java question. i've programmed both professionally (6 years c++, 2 years java), but i've been out of the industry for 6 years now.

HOWEVER -- i did want to address this notion of portability. i contend that C is, in fact, a portable language. in programming language context, 'portable' simply means 'able to be ported'. it doesn't, imo, imply any level of automatic-ness. in fact, it can be a real PITA.

that java hides a good bit of it doesn't change the definition. all imo, of course.

darkwing
Feb 21, 2006, 11:50 AM
Its the link at the top of the page. :rolleyes:

http://kano.net/javabench/index

Don't worry. You'll grow out of it someday. Some of us just do it faster than others. :)

Of course you do and that's why Java sometimes may be a good choice.

How much will it cost me to develop, set up and maintain a server system capable of serving 1000 transactions per minute the first year and then scale to a maximum of 10000 by the third year.

Sometimes the cheaper alternative will be Java. Sometimes it won't.

Edit: Hardware is most often the cheap part of the equation. Many server apps need to scale well over a server cluster. Adding nodes is cheap compared to other costs.

Well my problem with the notion that Java is cheaper to develop than C++ or even to maintain than C++ is that what it really boils down to is what your people know. I'd be much faster at c++ than at Java for just about everything when it comes to my development time. I know both really well, and I see nothing in Java that's going to speed things up significantly for me. The only nice thing about Java is that there is basically a central repository of code that handles things for me, and I don't have to "hunt" for things as much. However, I almost always write my own code anyway and so the only thing Java has, as a "native" component, helped me with, is displaying JPEG files.

i've been reading but avoiding the c++ vs. java question. i've programmed both professionally (6 years c++, 2 years java), but i've been out of the industry for 6 years now.

HOWEVER -- i did want to address this notion of portability. i contend that C is, in fact, a portable language. in programming language context, 'portable' simply means 'able to be ported'. it doesn't, imo, imply any level of automatic-ness. in fact, it can be a real PITA.

that java hides a good bit of it doesn't change the definition. all imo, of course.

It isn't really your opinion. You've just given the definition of a portable language. Good for you.:)

cube
Feb 21, 2006, 11:57 AM
i contend that C is, in fact, a portable language.

where language = Assembly

gekko513
Feb 21, 2006, 11:58 AM
Well my problem with the notion that Java is cheaper to develop than C++ or even to maintain than C++ is that what it really boils down to is what your people know. I'd be much faster at c++ than at Java for just about everything when it comes to my development time. I know both really well, and I see nothing in Java that's going to speed things up significantly for me. The only nice thing about Java is that there is basically a central repository of code that handles things for me, and I don't have to "hunt" for things as much. However, I almost always write my own code anyway and so the only thing Java has, as a "native" component, helped me with, is displaying JPEG files.
Yeah, what your people know, but also what libraries and available deployment environments has to offer for the project in question.

Sometimes C++ is the better choice.

I've been responsible for 3 rather small scale server type deployments. One in Java, one in C++ and one with a core of Java and C++ modules for performance critical computation.

I'm also biased against Java because GridBagLayout sucks. :)
What?! GridBagLayout is gods gift to the programmer!

cube
Feb 21, 2006, 12:12 PM
What?! GridBagLayout is gods gift to the programmer!

All popular GUI toolkits suck. They are really primitive.

If you want to see something that really rules for programming, check out CMU's Garnet (for Common Lisp). Because of silly budgetary reasons, they later
moved their focus to a C++ version called Amulet. Of course, the Common Lisp version is way better. In fact, I think Amulet is horrible, because of the constraints imposed by the language, but I would much rather use it than something like Swing, zApp, whatever.

There is no more funding for Amulet. Nor for a Java version.

zimv20
Feb 21, 2006, 12:24 PM
i changed my mind. i am going to comment.

my area of focus was the server tier in a 3-tier client/server architecture. i'm going to highlight two specific projects:

1. in 1997, i was the architect and lead developer for the server-side portion of a trading app. it was a c++/corba project. the server executables were deployed on a relatively slow Sun box running solaris. the ORB vendor was orbix. the client side (which i wasn't a part of) was an absolute mess of a project, done in c++ and running on relatively fast PCs running Windows NT.

this was a complicated server piece. it maintained entire domain models for clients and ran fairly complex calculations on them. user actions meant a lot of db reads and saves (Sybase). there was a lot going on.

2. in 1999, i was the lead developer for the server-side side portion of another trading app, much simpler than the above. this project was written in Java. both client and server tiers ran on fast NT boxes. the database was Oracle (iirc). client and server tier communication was RMI/IIOP. the ORB vendor was visigenics.

this was a simple server piece. the app was mostly a screen scrape with a few server-side calculations. i wasn't the architect here but i often wondered why we couldn't get away with 2-tier.

.....

on project 1, i never once got a complaint about performance. project 2 was a performance nightmare.

granted, project 2 was nearly 7 years ago, and i'm sure much has changed (including faster machines). but it was interesting to me how a much more complicated c++ app on slow sun servers could beat the pants off a simple java app on faster NT machines.

i've no idea if java's reputation for slowness is deserved today, but it was in 1999.

edit: changed db vendor in project 2 from sybase to oracle. i believe that's correct, though my memory is a bit fuzzy.

darkwing
Feb 21, 2006, 12:33 PM
Yeah, what your people know, but also what libraries and available deployment environments has to offer for the project in question.

Sometimes C++ is the better choice.

I've been responsible for 3 rather small scale server type deployments. One in Java, one in C++ and one with a core of Java and C++ modules for performance critical computation.

Uh oh. C++ modules. Now you lose the "portability". Some members will be upset and say that isn't real java! :rolleyes:

I wrote an online game for a class project last year (2 games in one year for school credit! fun stuff) and I used a c++ server running on Linux and a java applet for a client. Fun stuff.

What?! GridBagLayout is gods gift to the programmer!

You're crazy. :P The two times I've used it both took me about 4 hours to correctly get things to line up/display right. Having to set the weightx to 1 sometimes and 0 others and having things resize on their own when clicked..ugh. I hate it. :P

cube
Feb 21, 2006, 12:36 PM
For the C++ fans: I would take a look at Amulet and see it can be made better today by using the boost libraries (lambda et al).

darkwing
Feb 21, 2006, 12:38 PM
i've no idea if java's reputation for slowness is deserved today, but it was in 1999.

What is an ORB vendor? (I'm a hard realtime embedded systems guy, not a server guy.)

I know that Sun spent most of their money and resources on the Windows JVM, for popularity reasons. It outperforms all other versions from what I've read, even the Sun version. I don't know if this was the case 7 years ago, but today it seems to be such. Anyone ever play defender? That 80s arcade game? My friend made a simple java app that does side scrolling and the random mountain-lines in the background. On his p3 windows machine, it took about 10-15% of the CPU and was smooth as silk. On my at the time 1ghz G4 powerbook it took 100% of the CPU and was very choppy.

It's hard to see any Mac user on here defending the performance of Java when we're given such a crappy JVM by Apple.

Interesting story about your server projects. When you talk about a trading app did you mean stocks? Forex?

For the C++ fans: I would take a look at Amulet and see it can be made better today by using the boost libraries (lambda et al).

I googled around for it and their home page seems to have not been updated since the late 90s. I'm thinking I won't bother. :)

gekko513
Feb 21, 2006, 12:44 PM
You're crazy. :P The two times I've used it both took me about 4 hours to correctly get things to line up/display right. Having to set the weightx to 1 sometimes and 0 others and having things resize on their own when clicked..ugh. I hate it. :P
It does take some time to get used to GridBagLayout, but once you do it's a very convenient layout manager. The best one I've tried. I haven't tried that Lisp stuff that cube talked about.

It definitely beats static layout, BorderLayout and the primitive layout capabilities of Interface Builder for Cocoa.

cube
Feb 21, 2006, 12:51 PM
I googled around for it and their home page seems to have not been updated since the late 90s. I'm thinking I won't bother. :)

I told you they had no more funding. After that some open sourcerers took it and created OpenAmulet, which looks to be included in debian, but it doesn't seem to have gone very far.

zimv20
Feb 21, 2006, 12:52 PM
What is an ORB vendor?
ORB = Object Request Broker

it allows processes on different machines, written in different languages and running on different platforms, to talk to each other (make calls, exchange information). the interface is written in a simple language called IDL (interface definition language), which is then compiled on the target machine, in the target language, into client and server stubs. those stubs are compiled and linked in.

the ORB itself is a running process that brokers the communication across machines and processes (clients and servers can run on the same machine, fwiw).

neat stuff. on project #1, i set up a CORBA service to provide project data to legacy projects in the firm, helping them make the leap from batchfile processing to, well, the 20th century :-)

this was in addition to the plethora of CORBA services we implemented for our project.

(I'm a hard realtime embedded systems guy, not a server guy.)
like my first job. mostly C, but sometimes you just gotta program in assembly.

Interesting story about your server projects. When you talk about a trading app did you mean stocks?
i can't go into much detail, but basically yes, both projects were in the financial industry.

as a sidenote to #2, this was a project i joined about a year and a half after it had been going. i had to undo some design damage, and about a year later we had most of it in place, performance issues aside.

this was just as EJB was coming into being, so we brought in a vendor to demonstrate their stuff. another developer and myself spent less than two weeks, using EJB, to duplicate almost the entire server tier the team had spent 2 1/2 years coding. kind of a morale killer, actually. in the end, management decided not to go w/ EJB, with which i disagreed. i thought it was a great timesaver.

darkwing
Feb 21, 2006, 01:00 PM
ORB = Object Request Broker

it allows processes on different machines, written in different languages and running on different platforms, to talk to each other (make calls, exchange information). the interface is written in a simple language called IDL (interface definition language), which is then compiled on the target machine, in the target language, into client and server stubs. those stubs are compiled and linked in.

the ORB itself is a running process that brokers the communication across machines and processes (clients and servers can run on the same machine, fwiw).

So this is sort of like Java's RMI stuff, right? We had to learn RMI in a class I took with a professor who just loves Java and he mentioned CORBA had replaced it.

like my first job. mostly C, but sometimes you just gotta program in assembly.

Yep. :) Assembly is fun. I've had to do a boot loader or two.

this was just as EJB was coming into being, so we brought in a vendor to demonstrate their stuff. another developer and myself spent less than two weeks, using EJB, to duplicate almost the entire server tier the team had spent 2 1/2 years coding. kind of a morale killer, actually. in the end, management decided not to go w/ EJB, with which i disagreed. i thought it was a great timesaver.

They have made this decision for the reason you said..morale killer. How will people feel if the piece of junk they spent all that time on was replaced in 2 and 1/2 weeks? Still, I would have gone with the timesaver. Maybe management felt the time spent on the first one meant more people understood it and it had had more time for testing?

It does take some time to get used to GridBagLayout, but once you do it's a very convenient layout manager. The best one I've tried. I haven't tried that Lisp stuff that cube talked about.

It definitely beats static layout, BorderLayout and the primitive layout capabilities of Interface Builder for Cocoa.

I find Cocoa to be much better layout wise than Java, but that's because I get the IB. I prefer to handle things with pixels anyway. Let me put my stuff where I want to put it. :P

Cocoa does have some bugs though. Some of the stuff I've done with constraints to window resizing will get misplaced or stuck in some shrunken state. Maybe that's my fault and not Cocoa's, but it isn't as intuitive as I'd like.

gekko513
Feb 21, 2006, 01:05 PM
I find Cocoa to be much better layout wise than Java, but that's because I get the IB. I prefer to handle things with pixels anyway. Let me put my stuff where I want to put it. :P

Cocoa does have some bugs though. Some of the stuff I've done with constraints to window resizing will get misplaced or stuck in some shrunken state. Maybe that's my fault and not Cocoa's, but it isn't as intuitive as I'd like.
But then you could just use null-layout in Java and GridBagLayout isn't valid as one of your anti-Java arguments. :p

cube
Feb 21, 2006, 01:09 PM
in the end, management decided not to go w/ EJB, with which i disagreed.

For a look at how EJB blows read "Expert One-on-One J2EE Development without EJB".

Today it can only be advised if you really need the failover, replication, distribution features of the container.

So this is sort of like Java's RMI stuff, right? We had to learn RMI in a class I took with a professor who just loves Java and he mentioned CORBA had replaced it.


RMI is only for Java. CORBA is for any language to any language.

What is replacing CORBA is web services (SOAP, yuck!)

therevolution
Feb 21, 2006, 01:32 PM
What?! GridBagLayout is gods gift to the programmer!
Totally. (http://madbean.com/anim/totallygridbag) ;)

I am actually not a fan of it myself, but it has its uses. I often find myself using BorderLayout for real simple things, and BoxLayout (something about the way my mind works loves the nested boxes concept) or TableLayout (https://tablelayout.dev.java.net/) (not a standard Java class, but free to use as you please) for more complex things.

jtalerico
Feb 21, 2006, 01:49 PM
Has anyone worked with C#? I find it to be almost like java.. But is it not a variation of C? Sorry, i have no idea. I have only played with C#

zimv20
Feb 21, 2006, 01:57 PM
So this is sort of like Java's RMI stuff, right? [...] professor [...] mentioned CORBA had replaced it.
that's an odd assessment, CORBA predates RMI. they are similar, but RMI works only between java apps. unless it's running over IIOP, which is CORBA anyway.

RMI is nice. it's easier than CORBA. it just doesn't help you if you need to talk to a C++ app :-)

They have made this decision for the reason you said..morale killer.
afaict, there were two reasons:
1. management had already decided to kill the project (it was late and over budget, but surprise)
2. the firm had a tech board which hadn't yet approved EJB (reasonable, but misguided)

darkwing
Feb 21, 2006, 01:59 PM
But then you could just use null-layout in Java and GridBagLayout isn't valid as one of your anti-Java arguments. :p

What's null layout?

cube
Feb 21, 2006, 02:03 PM
Totally. (http://madbean.com/anim/totallygridbag) ;)


HAHAHAHA :D

zimv20
Feb 21, 2006, 02:03 PM
For a look at how EJB blows read "Expert One-on-One J2EE Development without EJB".

Today it can only be advised if you really need the failover, replication, distribution features of the container.
i fooled around with EJB for only a bit, never did use it in a real environment. i thought it was great for getting a prototype up quickly.

i did have a heap of trouble with the build environment. dunno if that was an issue w/ all vendors or just Persistence (the one we tried on project #2). basically, there was no make file and everything was built for each compile. for anything other than a toy project, this was unacceptable (i think the project compiles were around 40 minutes).

i pressed Persistence for a makefile, but they said it couldn't be done. "**** that ****", i thought, so i made one. actually, an entire build environment, some of the hardest environment work i'd done. i showed it to them and they offered me a job (i turned it down).

anyway, it's a shame if EJB didn't make it in the real world. i thought it a nice piece of technology, at least in theory.

darkwing
Feb 21, 2006, 02:04 PM
that's an odd assessment, CORBA predates RMI. they are similar, but RMI works only between java apps. unless it's running over IIOP, which is CORBA anyway.

RMI is nice. it's easier than CORBA. it just doesn't help you if you need to talk to a C++ app :-)


afaict, there were two reasons:
1. management had already decided to kill the project (it was late and over budget, but surprise)
2. the firm had a tech board which hadn't yet approved EJB (reasonable, but misguided)

The gridbag animation was hilarious to whoever posted it. Thanks. :) That reminds me of me, only not enough coffee.

I may have misremembered him saying CORBA replaced RMI. It was over a year ago, and that's such a small detail to get out of a class, anyway. :)

Maybe management killed it cuz marketing decided EJB didn't sound like a cool enough buzz word to keep it profitable? :)

gekko513
Feb 21, 2006, 02:04 PM
What's null layout?
setLayout(null)

It lets you set the coordinates of the components manually.

zimv20
Feb 21, 2006, 02:12 PM
Maybe management killed it cuz marketing decided EJB didn't sound like a cool enough buzz word to keep it profitable? :)
no marketing, it was an internal app for the traders. the real issue -- and this is repeated over and over and over from what i've seen -- is that the users couldn't decide what they wanted and management eschewed their management duties by trying to solve such issues with technology. i've seen that kill more than one project.

my managers must have gotten sick of hearing me say:
1. that's a user training issue
2. that's a management issue

and my favorite:
3. stop trying to solve management issues with technology

cube
Feb 21, 2006, 02:18 PM
i fooled around with EJB for only a bit, never did use it in a real environment. i thought it was great for getting a prototype up quickly.


Actually, for doing EJB one has to write a lot of boilerplate.

For a more modern approach to server-side development (well, I also use it in the client, actually), look at the Spring Framework (you can also combine it with EJB if you need it). Even BEA is hyping it.

zimv20
Feb 21, 2006, 02:40 PM
look at the Spring Framework
yeah, a friend of mine (development manager now, but was an excellent DBA and coder for years) was talking that up. been meaning to look into it, as a measure of curiosity (in case you didn't see what i wrote earlier, i'm no longer in the industry, so i'm a little behind in cases).

darkwing
Feb 21, 2006, 04:56 PM
setLayout(null)

It lets you set the coordinates of the components manually.

I had no idea you could do that. So then I could use setSize() and the other one..setLocation() or something?

Steven

gekko513
Feb 21, 2006, 04:58 PM
I had no idea you could do that. So then I could use setSize() and the other one..setLocation() or something?

Steven
Yes, and/or setBounds

darkwing
Feb 21, 2006, 10:30 PM
Yes, and/or setBounds

Thanks for the tip. Next time I use java/swing I'll try that if I don't need to worry about auto resize.

HiRez
Feb 22, 2006, 02:53 AM
Totally. (http://madbean.com/anim/totallygridbag) ;)Dude, I love the animated blog! Not quite sure what it was trying to say, but the format is great, seeing live code entry and illustrations. I'd like to see you do some actual (semi-serious) tutorials in this format.

bousozoku
Feb 22, 2006, 03:41 AM
Thanks for the tip. Next time I use java/swing I'll try that if I don't need to worry about auto resize.

You have to make certain that the window isn't zoomed/maximised because without taking explicit control, you end up with something quite odd looking.

cube
Feb 22, 2006, 04:05 AM
I forgot to mention that EJB3 improves things a bit.

demallien
Feb 22, 2006, 05:47 AM
I have been researching this question for quite some time and just to further that research I would like all of you experienced programmers opinion. I would like to make a career move, I have always enjoyed programming playing with VB, PHP, and the like but I am not a developer. Where should I start, in your opionion what languages will be most important to watch in the next few years. I want to make myself as marketable as possible however i know that may not be simple.

Ooof. It really depends on what you want to do. If you want to be doing Web apps you should be learning java, javascripy, perl, php, xml and all the other fun bits and peices that go into Web pages these days.

If you want to write database apps, financial apps etc, then you're probably looking at having to learn the biggies, lSAP and Oracle.

If you want to write games/consumer apps, welcome to the wonderful world of C++.

If you want to write cool hardware drivers, that make wonderful devices such as the iPod tick, go C!!!! Yay C, I love C :D (well, ok, the iPod was probably done in Objective-C, because Apple, god bless their cotton socks, gives us an OO driver development environment. But your mobile phone's embedded code was probably written in C)

demallien
Feb 22, 2006, 05:57 AM
Actually, a link to some comments from one of the industry's gurus, Joel Spolsky...
http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html

cube
Feb 22, 2006, 07:20 AM
Actually, a link to some comments from one of the industry's gurus, Joel Spolsky...
http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html

Of course. The best language to learn programming in is Scheme.

This is a good starting point: http://www.teach-scheme.org/.
With their textbook you will learn the all-important programming concepts, not how to hack in a particular language.

mwpeters8182
Feb 22, 2006, 08:13 AM
The first step in learning how to write code is to learn proper programming practice. I think you can do this with C, C++, C#, or Java really.

I'd read up on all of them, and get the O'Reilly book that corresponds to that language. I'd also maybe look into taking class at a community college or something, if you've never had a formal introduction to programming (though I can't vouch for how useful that'd be - I've taken worthwhile programming classes and ones that were a complete waste of time.)

darkwing
Feb 22, 2006, 09:22 AM
If you want to write cool hardware drivers, that make wonderful devices such as the iPod tick, go C!!!! Yay C, I love C :D (well, ok, the iPod was probably done in Objective-C, because Apple, god bless their cotton socks, gives us an OO driver development environment. But your mobile phone's embedded code was probably written in C)

Apple doesn't use Obj-C for drivers. It uses a stripped version of C++ suitable for a kernel environment, as was mentioned earlier in this thread. (No RTTI, no STL, etc.) I had to write a couple kexts for an OS class. I already had so much Linux experience I talked the teacher into letting me do OSX drivers so I could learn something new.

therevolution
Feb 22, 2006, 10:05 AM
Dude, I love the animated blog! Not quite sure what it was trying to say, but the format is great, seeing live code entry and illustrations. I'd like to see you do some actual (semi-serious) tutorials in this format.
Oh, I can't take credit. I wish I knew how to do that. :o I just thought it was funny, and it happened to be relevant to the discussion.

cube
Feb 22, 2006, 10:10 AM
The first step in learning how to write code is to learn proper programming practice. I think you can do this with C, C++, C#, or Java really.


But you cannot learn all programming concepts with those languages. That's why you need Scheme.

It's no problem that plain standard scheme does not have OO capabilities, as that can be added portably with something like tinyclos, which will also teach you about metaobject protocols. This is better than using the nonportable OO extensions of some Scheme implementations.
Also, the OO one gets with tinyclos is really object-oriented, dispatching on multiple arguments, not "subject-oriented" like those other languages.

zimv20
Feb 22, 2006, 10:30 AM
But you cannot learn all programming concepts with those languages. That's why you need Scheme.
what's lacking? i never learned scheme, but certainly can program pointers, recursion, OO, data structures and a whole bunch of other stuff, better than most from my experiences. what am i missing (personally, i mean, not what am i missing from my short list)?

mwpeters8182
Feb 22, 2006, 10:33 AM
Why can't you learn basic programming concepts with the above languages?

I'ts best to outline everything is pseudocode anyway. The implementation is really the only thing that's language-specific.

darkwing
Feb 22, 2006, 10:59 AM
Why can't you learn basic programming concepts with the above languages?

I'ts best to outline everything is pseudocode anyway. The implementation is really the only thing that's language-specific.

I disagree. Suppose you had pseudocode for some form of self modifying code. This would have to be done differently if you were going to use LISP than say, C. Don't you think?

zimv20
Feb 22, 2006, 11:09 AM
I'ts best to outline everything is pseudocode anyway. The implementation is really the only thing that's language-specific.
that's one of those "if it works for you" things. i tried it when i was learning, but it didn't do much for me, at least a part of my brain is always thinking implementation.

though i have found pseudocode to be useful in communicating a concept to those who can't context switch between implementation and design.

cube
Feb 22, 2006, 11:42 AM
what's lacking? i never learned scheme, but certainly can program pointers, recursion, OO, data structures and a whole bunch of other stuff, better than most from my experiences. what am i missing (personally, i mean, not what am i missing from my short list)?

The most obvious points are closures, and continuations. You also don't have anything resembling the power of Lisp macros. Those languages also lack a metaobject protocol (to extend the language with member daemons, integrated constraints, new inheritance rules, etc.).

With continuations and Lisp macros you can extend the language with new sophisticated control structures like coroutines and backtracking.

Scheme, regardless of its tiny size, is the most powerful high level language because of this (Common Lisp doesn't have first-class continuations). You can basically extend it to whatever you want.

zimv20
Feb 22, 2006, 11:50 AM
The most obvious points are closures, and continuations. You also don't have anything resembling the power of Lisp macros.

With continuations and Lisp macros you can extend the language with new sophisticated control structures like coroutines and backtracking.

good call, i have no idea what you're talking about :-)

can you explain a bit more? i dabbled in Lisp, about 20 years ago, but could use a refresher on some language features.

cube
Feb 22, 2006, 12:45 PM
good call, i have no idea what you're talking about :-)

can you explain a bit more? i dabbled in Lisp, about 20 years ago, but could use a refresher on some language features.

From this page (http://www.bookshelf.jp/texi/onlisp/onlisp_21.html):

"In Scheme, continuations are first-class objects, just like functions. You can ask Scheme for the current continuation, and it will make you a function of one argument representing the future of the computation. You can save this object for as long as you like, and when you call it, it will restart the computation that was taking place when it was created.

Continuations can be understood as a generalization of closures. A closure is a function plus pointers to the lexical variables visible at the time it was created. A continuation is a function plus a pointer to the whole stack pending at the time it was created. When a continuation is evaluated, it returns a value using its own copy of the stack, ignoring the current one. If a continuation is created at t1 and evaluated at t2 , it will be evaluated with the stack that was pending at t1 ."

The programming concepts bible (using Scheme): SICP (http://mitpress.mit.edu/sicp/) (but doesn't talk about reified continuations)

The most beautiful book on Lisp macros (you need to know Common Lisp):
On Lisp (http://www.paulgraham.com/onlisp.html)

The wonders of the Meta Object Protocol (you need to know Common Lisp): AMOP (http://www.amazon.com/gp/product/0262610744/ref=sr_11_1/102-9060316-2920903?%5Fencoding=UTF8)

Not sure what's the best introduction to Common Lisp, as there are several newer books I haven't read. Better ask in comp.lang.lisp

AlmostThere
Feb 22, 2006, 01:10 PM
From this page (http://www.bookshelf.jp/texi/onlisp/onlisp_21.html):

"In Scheme, continuations are first-class objects, just like functions. You can ask Scheme for the current continuation, and it will make you a function of one argument representing the future of the computation. You can save this object for as long as you like, and when you call it, it will restart the computation that was taking place when it was created.

Continuations can be understood as a generalization of closures. A closure is a function plus pointers to the lexical variables visible at the time it was created. A continuation is a function plus a pointer to the whole stack pending at the time it was created. When a continuation is evaluated, it returns a value using its own copy of the stack, ignoring the current one. If a continuation is created at t1 and evaluated at t2 , it will be evaluated with the stack that was pending at t1 ."


Hmm, I am not really clear how these significantly differ from exceptions and functors in C++ (just for example).

Any chance of some further clarification, highlighting the differences?

zimv20
Feb 22, 2006, 01:22 PM
From this page (http://www.bookshelf.jp/texi/onlisp/onlisp_21.html):
thanks for all that.

cube
Feb 22, 2006, 01:36 PM
Hmm, I am not really clear how these significantly differ from exceptions and functors in C++ (just for example).

Any chance of some further clarification, highlighting the differences?

A try/catch block is an escaping continuation. A full continuation like in Scheme is a function that you can call over and over again and jumps the program to the point where it was created with the stack values at creation time.

A function object is a simulation of a closure. Variables from their environment are not captured.

cube
Feb 23, 2006, 03:22 AM
Not sure what's the best introduction to Common Lisp, as there are several newer books I haven't read. Better ask in comp.lang.lisp

Here you can download for free one of the newwest introductory books that has many good reviews (although some constructs are used in examples before being explained). I haven't read it yet, so I cannot give you my opinion. As it's geared toward developing practical examples, maybe it's not so comprehensive in showing you the most advanced features:
Practical Common Lisp (http://apress.com/free/)

BTW, If you are going to try Lisp, please get an editor with a Lisp mode. For (X)Emacs, there is ilisp, which allows you to interact with the Lisp runtime from the editor. For Eclipse, there's the SchemeWay plugins (but I haven't tried them. Although geared towards Scheme, apparently some people used them successfully with CL; but I don't know if just for editing, not interacting).

But the best environment to learn Scheme on must be DrScheme. That's what it was created for. It supports restricting the language to different levels.