C# From a Java Developer's Perspective 507
Microsoft's C# has raised eyebrows, interest and debate since its official announcement last year. The prolific Carnage4Life (Dare Obasanjo) has completed a detailed comparison of C# and Java, outlining the things that are identical, similar, nearly the same, or completely different between the two languages. If you're considering learning or applying either one, you might benefit by reading this paper first. There are some other excellent comparisons to be found linked from the Open Directory Project as well. Update: 11/20 03:35 GMT by T : Note: here's a mirror; interested readers who mirror the mirror get good seats in heaven.
Some more information (Score:3, Informative)
Re: (Score:3, Interesting)
Re:Some more information (Score:2, Insightful)
public class Direction {
public final static int NORTH = 1;
public final static int EAST = 2;
public final static int WEST = 3;
public final static int SOUTH = 4;
}
Usage:
int wall = Direction.NORTH;
The java method will compile/run a tad faster, due to the lack of an entirely new type.
That's because javac will translate the Direction.NORTH into a static constant 1 during compilation. The only problem that causes is it means you have to recompile everything that uses Direction's constants if the enumeration changes.
I dont know how C# handles it's enum construct - I've never used it (C# that is).
Re:Some more information (Score:2, Informative)
All static final primitives are substituted at compile time. They are treated as compile time constants. See the JLS 13.4.8 for reference.
(I just love being a language nazi)
Re:Some more information (Score:2, Informative)
Re:Some more disinformation (Score:2)
Nope, it can't - not unless the gettor and settor are trivial one-liners. And if they change from trivial to non-trivial, you have to chamge your public int foo; into public int getFoo(); public void setFoo(int fooVal); and break all the code that uses foo. Properties avoid this breakage, which is why they are a good idea.
For a non-trivial e.g. Label.font.bold = true; The settor could actually cause a refresh of the label as well.
The java method will compile/run a tad faster,
Will it? The enum is really just an int - with compile time range-checking. Compile-time checking won't make it run slower. BTW, in Java you could also write
int wall = Direction.NORTH;
wall += 43;
Which is clearly semantically dead wrong, but the compiler will never know. That is why enums were invented in the first place, not that Java's designers ever learnt that lesson.
Java enums - Why doesn't sun use them. (Score:2)
Re:Some more information (Score:2)
classes have the same data, thus thus the equals and hashcode object methods will
be wrong, which we screw up putting Directions into hashtables.
Direction.NORTH.equals(Direction.EAST) is true
Direction.NORTH == Direction.EAST is false
Direction.NORTH.hashcode() == Direction.EAST.hashcode() is true
Re:Some more information (Score:2, Informative)
how is it... (Score:3, Troll)
Alternate Site For Article... (Score:4, Informative)
PS: Mirrors encouraged, so if you manage to grab it and can host it at a site with beefier bandwidth, go ahead.
another mirror (Score:3, Informative)
It'll be off the front page tomorrow, so all these mirrors shouldn't be needed...
The lesser of two evils (Score:5, Insightful)
Although C# does deliver superior integration with Windows and
Just my 2c...
~wally
Re:The lesser of two evils (Score:5, Insightful)
Also, you'll be able to use all the newest 'must have features' that MS tries to shove on the consumer in C#.
For now, I'll stick with Java because it's libraries are much better. Not just the ones that Sun wrote, but more importantly, the ones that other people have written.
Re:The lesser of two evils (Score:2, Informative)
Re:The lesser of two evils (Score:2)
Re:The lesser of two evils (Score:2)
Your comment leads me to wonder something... if you code something in Java, or C++, or FORTRAN, or Perl, or sh, or any other language out there... Does the execution speed of your program necessarily say anything about the language you wrote it in?
I have a strong feeling that many programmers out there aren't very good at programming. Sure, some are geniuses and others are very good, but I think that most don't really have the level of respect for the hardware that I believe is required of a good programmer.
An example, off the top of my head: I once hired a programmer to write a compiler (and virtual machine) for a very simple language, used to operate a small embedded computer--the equivalent of a 486--for a piece of industrial machinery. After months of hard work and who knows how many thousands of lines of code (in C) later, a compiler was produced that could process about 300 lines per second (with about 40 characters in a line), and a virtual machine was produced that processed the compiled code so slowly that it couldn't keep up with mechanical equipment. After a lot of arguing, the programmer swore that it was impossible to make the code any faster.
Then I went in and started analysing the code. The thing that comes to mind first is a routine that, when given an ASCII character between 'A' and 'Z', tells you the number of the letter. For example, 'A' is 0, 'Z' is 25, and everything in between is something in between. A routine that was about 20 lines long was written for this purpose, where just about every string function imaginable was called. In C, this entire routine could be replaced by "string[index] - 'A';" (I don't remember the names, but that's the code.) And this code couldn't be made any faster?!
Yes, it was programmed in C. And C is supposed to be a fast language, right? Heh heh... the language has very little if anything to do with execution speed. It's the programmer's own code that accounts for 99% of the execution time. I rewrote the whole damn thing in six weeks and my implementation processed over 6,000 lines per second, and the code was written for readability with no emphasis on execution speed, and no optimizations. (The algorithm, on the other hand, was designed for speed.) My conclusion? If your banking app was painfully slow, maybe you didn't design or implement it correctly. On the other hand, maybe there was a bottleneck external to your application, like slow response times between you and some database backend. Whatever it was, I doubt that Java was at fault.
Come on now: Have you ever really used C#? (Score:5, Insightful)
Seriously though, have you? From your vague, unsubstantiated, no example posting it sounds like you use and know Java, therefore you can proclaim yourself knowledgable about C#. Your claims about the "bolted on" aspects of C# are particularly suspicious given the "hooks" into Windows are simply objects instantiatable from the .Net Framework (they're not "bolted on": Just like Java you include the unit and create objects from it). If anything C# takes some of the goofy aspects of Java, such as the interoperation with properties via methods, and cleans them up to make an abstract behind the scenes property handling system (ripped straight from Delphi's object pascal I would guess).
So how exactly... (Score:3, Insightful)
...do you use a language that won't even properly exist until February next year, when Visual Studio.NET will actually be released?
Re:So how exactly... (Score:3, Informative)
Well given that Beta 2 has been available for closing on a year now, and I've had RC1 on my machine for about a month now... That's how I use C#.
You're not using C# (Score:2)
You're not using C#. You're beta testing a product that has changed a lot over that year, and probably will change a bit more before it's released. You're aiming at a moving target, with no fixed definition.
Furthermore, that target itself aims at another target (.NET) in a similar situation. (Please don't spin me the pathetic argument that C# is independent of .NET; C# has no standard library worth speaking about, and there is no likelihood of a serious C# implementation on any other platform any time soon.)
It is simply not possible to develop applications properly in that environment. Until C# and .NET are properly released, you're not using a language, you're playing with a toy. Real languages for real use have concrete definitions, preferably of the status of a formal standard, and they don't change every five minutes on the whim of a senior engineer at Microsoft.
Do you know what an "RC" is? (Score:2)
An RC is a release candidate: Meaning that they're proposing that that is what they might actually release. That's closer to a real product than most products in the open source arena will ever be.
Having said that: Jesus Christ you zealots are a riot. I don't even really LIKE C#, nor am I sold on the ".NET" idea, nor have I advocated FOR it. I merely questioned what seemed to me to be a pure karma whore post because it obviously was written just to cater to the psycho zealots that frequent Slashdot.
And for all the dumb motherfuckers out there let me explain something: You "interoperate" (regardless of hilarious [sic] comments by trying-to-be-pretentious kids) with "properties" either via method, or via more abstract methods. I prefer the more abstract methods of Delphi, and also C#. It's amazing how many people will yap up their opinion on this when they have no clue.
Re:Come on now: Have you ever really used C#? (Score:2)
Why is this approach better and less goofy? I'm not familiar with object pascal, but this approach sounds like it would lead to spaghetti.
Re:Come on now: Have you ever really used C#? (Score:2, Informative)
Given that Microsoft hired away Borland's chief Delphi (and object pascal) architect, Anders Hejlsberg, and that Anders' name is on the C# language specification [microsoft.com], this should come as no surprise.
Naturally, Borland has been attempting to sue Microsoft [borland.com] for its systematic destruction of their company by recruiting all of their top people (mostly on the technical front).
Re:Come on now: Have you ever really used C#? (Score:2)
while this seems to have (Score:2, Insightful)
MS needs to hurry however, as Java continues to gain in acceptance (regardless of it's problems) in more mainstream sw arenas (Oracle, IBM). Let's not forget that technical superiority alone does NOT a successful product make. There are plenty of SmallTalk coders who think Java should have gone STRAIGHT to the junk heap.
I, like many others, do not particularly care for MS. I feel they provide low-quality product and user clever marketing combined with arm-twisting to maintain market dominance in the areas they control.
That said, as a Java programmer I'd really like to see some competition with Java. Who knows, Sun just may open in up to ensure that MS can't get a foothold!
Re:Would you trust a Microsoft apologist? (Score:2, Insightful)
Actually I'm hardly an MS advocate. For one I think they have a ridiculously lax attitude towards security (how many times do buffer overflows have to occur before someone says "Uh, maybe we should audit the IIS code where non-trivial stack variables are used....". I also am actually pushing at my company AGAINST a .NET initiative, or rather for at least seriously evaluating J2EE as a primary competitor.
Having said that regardless of my approach for them, I'm not a zealot. That means that I'm not an AC wanker running around trying to expose MS employees because someone says something good about MS (and regardless of your religious zealot opinion a lot of things MS does and has done ARE quite impressive).
BTW: I suspect you're just a Sun employee anyways.
Re:The lesser of two evils (Score:4, Funny)
Agreed - but Java at least attempts "write once, run anywhere," (with debatable success) whereas M$ C# attempts "write once, run on Windows XP, with Windows Messenger and a
I have a lot more faith trusting my applications and business to a company that isn't trying to take over every purchasing decision we make. If you have read the fine print that comes with Windows messenger - the other half of
One day your app or service isn't going to run, and all you see in your logs will be "Call Miscrosoft to obtain a license to run C#"
Re:The lesser of two evils (Score:2)
Re:The lesser of two evils (Score:2)
COM couldn't kill java, DCOM couldnt, VB could not, Delphi could not, ASP could not, IE could not. So far nothing MS has tried manged to kill java. I suspect this is because cross platform is actually a desirable thing for most corporations. As long as LInux continues to grow and corporations are using unix and mainframes java will be around and growing. The only way MS could kill java is to make the whole shebang cross platform and they will never do that.
not quite closed (Score:2)
While I cannot speak for C#, I can dispute your comment about Java. You can download and view the source to the JVM and other Java tools. But Sun's so-called "Open source" disallows distribution of changes to the code. (so you're partially correct)
But users can send in ideas via their BugParade. See http://developer.java.sun.com/developer/bugParade
I dont if that can be done with C# - but given MS's track record, I would be surprised if they do.
Re:The lesser of two evils (Score:3, Flamebait)
Re:The lesser of two evils (Score:2)
Re:The lesser of two evils (Score:2)
Re:The lesser of two evils (Score:2)
This has been something I've been holding against Java for a while myself, but the article makes an excellent point. C++, which was released for the public to 'run' really stagnated to a large degree. However, if a single corporation runs a language, the language can change with the times and adapt to the users' needs quicker since there is less politicing to be done. Since Sun seems to want as many people to use Java as possible, they have a strong interest in responding to developer demands. I'm interested to see the response to these two competitors. When faced with the closed systems, it might come down to a question of who do you trust. Between Bill and Scott, I've got my pick, but hey I'm biased.
C# and .NET vs. Java Enterprise APIs and tools (Score:4, Insightful)
I spend most of my time in the Java world (I have written 5 Java books, the latest of J2EE, and almost all of my consulting is done with Java.)
That said, C# and Visual Studio.Net are very cool.
Since Java is not my language of choice (hey, I would use Common LISP more if there were more consulting jobs requiring LISP!), I would not be too bothered if I had to use C# and the .Net stuff.
Really, what really matters is finding interesting jobs to do, not the development platform.
I also have high-hopes for interop between the Java J2EE world and .Net using SOAP. (I am working on SOAP support for Common LISP in my spare time so Lis can play nice with .Net and J2EE.)
Best regards,
Mark Watson
Correction (Score:2, Informative)
Re:Correction: Java byte = C# sbyte (Score:2)
Actually, it does: the char type is unsigned. But Java doesn't really need any unsigned types because it has the >>> operator.
Standardization? (Score:3, Insightful)
One cannot always tell beforehand how big the impact will be. Small movements have exploded once given a niche to fill... and then die once it was swallowed up by a new contender.
If the benefit of C# is only whats in this article, then I'm not convinced its going to change the world. I'll keep to my "unsafe" code blocks and maintain interoperability with non-Gatesian worlds.
I'll wait for at least a committee for standardization to form for this mess.
Why do I get the sinking feeling (Score:4, Funny)
Or in some ominous "Morpheous" like voice:
"The
Or maybe I'm just reading too much into it... after all, Microsoft is doing it for the good of the community and Developers (developers, developers, dev....).
BWAAAAHAHAHAHAHA...I actually kept a straight face while typing that...heh.
{sniff, wipes tear from eyes..heeeheee}
Re:Why do I get the sinking feeling (Score:3, Insightful)
in fact, one such port [go-mono.com] seems to be coming along very nicely.
Re:Why do I get the sinking feeling (Score:4, Insightful)
But will they be standardizing the libraries or just the language (and the CLR for that matter)?
The beauty of Java is that you write your code once to a set of libraries that are available on a lot of platforms. Even if you had to recompile the code on each platform, there would be no problems because there's a standard library to which you code.
But, if only C# the language is sent to the ECMA, won't we have another C/C++/ with different features? The code you write will still be specific to the libraries you choose to use (and thus the platforms those libraries are available).
Re:Why do I get the sinking feeling (Score:3, Insightful)
Microsoft has historically been pretty good at keeping their SDKs backwardly compatible and I don't see any reason why they would break the compatibility of future .NET runtimes (the non-ECMA bits). Some would say that they'd do that just to break the 3rd party implementations, but in reality they'd lose more by pissing off their own developers than they'd gain.
Re:Why do I get the sinking feeling (Score:2)
C# is really kinda cool stuff (Score:2, Insightful)
....
Of all the MSVC programmers I worked with once they all had a good chance to work with C# they said theyll never write another line of C++ again. For the windows platform it may indeed be great stuff, the one thing that piques my interest is its cross plattform future. MS included help files and other pices parts refrence Linux, no whether its MS or someone like Ximian with their mono project. The C# stuff is definatley cool. native speed and you can writer in any of the dot net languages you want VB C# and yes TCL and PERL have ports to the Dot NET runtimes, heres the deal even M$ says it, from a performance standpoint on a Win32 machine they will all run the same the language choice will be a matter of style.
Some slashdotters out ther perpetually bash MS and I do too from time to time, I run Linux at work and home, but the fact is Im in computers to make money PERIOD, If I could make a living out of racing my motorcycles full time Id never touch a computer again other than to surf for parts or events.
To the ends of making money at computers, C# will do great I am sure , the coders I know that have actually worked with it on a daily basis love it, and to all the NAYSAYERS out there that say "Oh just another MS product to have bugs" sure probably but the wholde of the VS 7 IDE and tools are written in C# , Im sure by the time its released it'll be pretty good. And best of all it will make ME MONEY, I write desktop apps , if its quicker and easier.more interoperable, which it is it has full inheretence.Im all for it. The fact that 3rd parties are already vigilantly porting the runtime to *nix systems tells you its not another Bob
MS languages for the most part run superbly on MS systems, they suppert both sides of the enviroment. Guess what C# is another example, in XP there are already kernel optimization routines for the DotNET stuff,
If you HAD to program and app for a MS system in a MS language, which would you preffer, C++, VB, VFP, well..... Or C# that even C++ programmers who use it on a regular basis say , (and from experience it does) rocks as far as MS languages go.
Re:C# is really kinda cool stuff (Score:2, Interesting)
yes actualy, I don't know the Lines of code but Jext is almost as robust as Emacs.
Jext [jext.org]
you have a vertual file hierarchy, an FTP client, a text editor with Hughlighting for almost every language and markup around, it has its own macro language, it has an embeded python interpreter, you can send e-mail, it divides your projects into seperate workspaces, and each workspace has its own Virtual file hierarchy. This is the text editor fo anyone who is in developing. what is realy nice is that it gets out of your way.
Re:C# is really kinda cool stuff (Score:2, Informative)
Both, depending. This holds true for all languages targetting the .NET CLR. The different cases are:
Item number 2 is likely the way things will go, because ISVs will be able to sell a single box of software and it will work on any platform with a compliant
For all supported languages, intermediate bytecode will always be generated (called IL, appropriately enough, for Intermediate Language). Whether you then compile that down to native immediately, do it at installation, or do it at runtime is up to the developer.
Power of Java, Functionality of Windows (Score:5, Insightful)
I admit that Microsoft is once again trying to dup Java, but, if you like Java and wish to work with platform-dependant API's that do more with Windows than Java, C# is your answer!
As the article mentions, C# has almost the exact same syntax and keywords that Java has (plus PERL's foreach operator...kudos). There is almost no learning curve. You can leverage the functionality of Windows with C# however, and it has great XML support; so, if you've worked with the MSXML parser, you'll have no problems working with XML in C#.
C# deserves a little more credit than many give, at least if you're working in a strict Windows environment. It's worth a look.
That's all I have to say, but I'll pile on the on wood for the flames that will arise!
foreach...kudos (Score:3, Interesting)
The senior designers repeatedly treated such suggestions with contempt. Arthur van Hoff told me, "If you want to use Perl, just use Perl!"
The MS people I spoke to in the early stages of C# were very interested in input like this. Where Sun's attitude toward "why can't we have X?" was "because we said so", MS's was "hmm, that would be popular, I wonder if we could find a way...."
Say what you will about MS, one of their standard techniques for locking you in is to try to make what people are asking for. Contrast this to Apple and Sun ("we're your superiors, so use what we tell you to use"), and Linux ("make it yourself, luser!").
Re:Power of Java, Functionality of Windows (Score:2)
C# deserves a little more credit than many give, at least if you're working in a strict Windows environment. It's worth a look.
If I'm working in a strict windows environment why would I not just use C/C++? I'm not trying to flame but I would like an answer as I've had no reason to even investigate C# since it was announced.
To put it another way, platform independance has always been Java's biggest drawcard. What is then the attraction of C# - simply the integration with .NET?
Even worse, if I write a program in c# it cannot be ported to another platform (as with C++), until C# starts working on it.
Re:Power of Java, Functionality of Windows (Score:3, Interesting)
Granted, C/C++ is my language of choice on any platform (unless you're designing cross-platform code, which Java works great for). You have to admit, however, that C/C++ requires greater thought and strong fingers for all the typing you have to do. C# is an abstract language like Java and requires less (and, yes, it does hide more, which can be bad in some cases).
Just like any language, each has its strengths and weaknesses. If you're looking for abstraction and rapid development on Windows, C# is worth a look. If you're looking for speed (and, seriously, once the .NET framework is loaded, C# isn't too bad on speed), go with C/C++ for faster code and lower-level calls and memory management and stuff.
Re:Power of Java, Functionality of Windows (Score:2)
Of course, I don't anticipate the Quake IV engine being written in C#!
Functionality of Windows? (Score:3, Flamebait)
Stupid slashdot lameness filter. Shouldn't a geek site support a means of posting source code??
Gee, you mean like being able to generate an app that causes a BSOD using a java-like syntax?
All kidding aside, there are some cool ideas in the language. Support for enumeration is one. Currently most enum-type things in Java are done with integers, and so you have to do bounds checking whenever you get a value. The foreach operator is another nice one. It's a minor change, but it makes certain loops much quicker to write and much more readable. I also like operator overloading. It has never seemed right that in Java "+" concatenates strings, which are objects, but they're the only special object in the system. I admit that in C++ doing operator overloading properly can be hard, but it's a really convenient OO feature.
The C# way of multiple interface implementation seems like it could be good, but will mostly just cause programmer errors.
public interface ITeller
{
void Next ();
}
public interface IIterator
{
void Next ();
}
public class Clark : ITeller, IIterator
{
void ITeller.Next () {
}
void IIterator.Next () {
}
}
To me that just looks like a bug waiting to happen. Under occasional circumstances it means you can do something you couldn't otherwise do, but this just looks dangerous to me.
Mostly though I look at C# and say to myself: "Shouldn't a language that was designed years after Java be better than Java?". Java got rid of the preprocessor. This is a good thing, C# brings it back. That's a bad thing. (I know, conditional compilation is nice, but don't do it with a preprocessor, ick!) And what about reflection and dynamic class loading? Those are some sweet features, especially in a networked language, but in C# they're missing/gutted.
And then there's just wierd-ass syntax pollution:
[AuthorAttribute ("Ben Albahari")]
...
class A
{
[Localizable(true)]
public String Text {
get {return text;
}
}
}
I can accept the strange getter/setter method, though I think it's dumb. It's just vb-like, with a strange and confusing mix of methods, functions and subroutines. But what's with that array-like crap? Btw, that's also how synchronized methods are declared.
I wonder if Sun would ever agree to put some of the nice features into Java, or if the language is essentially frozen, and they're going to work on the APIs.
Btw, the MSXML parser? It's certainly MS, and certainly not XML.
Re:Functionality of Windows? (Score:2)
The C# way of multiple interface implementation seems like it could be good, but will mostly just cause programmer errors.
The case you mentioned is when two interfaces have the same method declarations. This is by far a rare case, and probably is negligable. The "feature" you point to is just the workaround for explicit overriding Microsoft included, something which, I think, is impossible to do in Java since it won't let you implement two interfaces with identical methods. It's definitely not something to worry about or note as a problem though.
The bracket'ed stuff is meta information about the chunk of code itself. It's like "smart-commenting" such that other tools can use the data held within. Instead of reserving tons of keywords for things like sychronization, web methods, and god knows what, a lot of stuff uses the attribute feature. I don't see a problem with this, I think it's just because you're not used to it.
The getter/setter methods are a good thing for tired hands sick of writing method declarations over and over for each member of the class, IMHO.
You can instantiate objects on the fly, in fact, you can even create new classes and MSIL code on the fly using the Compiler classes! Advanced reflection stuff is all there.. working with Assembly meta data all the way down to method meta data.
I think you just need to find a better C# book.
Re:Functionality of Windows? (Score:2)
Big companies... (Score:4, Insightful)
I have a feeling that C# will be adopted by Microsoft's technology partners, but why would any firm that has spent time and money moving away from Microsoft products go running back because of a new product offering? Its not the products we're trying to get rid of, its the company.
I'm impressed by C# -- the language (Score:5, Insightful)
We need a modern, productive system for producing new high-performance GUI apps: apps that look and feel as if they'd been written in C++ -- without the crashes and slow dev cycle. I'd give up some of the flexibility of C++ (you can write drivers, create an OS, build a browser, it's a dessert topping AND a floor wax) for something truly optimized for what matters most in creating superb GUI apps quickly and well.
I've had high hopes for Eiffel and some others to evolve into the successor to C++ for GUI apps, but it never happens. The inertia of programming languages is immense.
The next to step up to bat is C#. I like the language a lot and think it lends itself to great dev systems. I'm suspicious of the bytecode aspect, though. ("Faster than compiled!", "It actually is compiled!", etc. Yeah, so why isn't Solaris written in Java?) I'm afraid that aspect will still require that "serious" apps be written in C/C++.
I like even less that it may remain Windows-only. If it does remain Windows only (for all practical purposes), I suspect the blame will belong just as much to MS haters dismissing it primarily out of bigotry as to MS for optimizing it for their own platforms.
I'd like to see the open source community look at it with the same eyes as if it had come out of some smelly hacker's basement.
Multiplatform increasing in importance (Score:4, Insightful)
Servers tend to run Unix or legacy OSes. Embedded devices run Palm OS or a free Unix like Linux or BSD. Phones run all kinds of custom software. The only platform that Windows rules is the desktop, and that market segment just shrunk for the first time in history. How can C# dominate if it only runs on one type of device?
Re:Multiplatform increasing in importance (Score:2)
my $0.02 (Score:5, Insightful)
For pure Windows programmers, C# wins there and will probably be picked up by lots of VB and VisualC++ programmers. But people who live in that world are already not using Java. For everybody else, Java seems to win hands down. I think C# will neither be a complete failure nor will it do much harm to Java.
Fundamentally different. (Score:2)
This belief is instilled by Microsoft Marketing, Java/C# only resemble each other on the surface, underneath they fundamentally different. This is the reason that this decision should be taken be an experienced technical professional.
the languages are so similar that they are basically interchangeable.
Whilst Microsoft are attempting to position C# against Java this is their marketing at work, technologically they are not interchangable. As you latter comment note C# it is in competition with products like C++, Delphi, VB, not Java.
Java's technological competitors are actually, Perl, PHP and Python. Since they are the only tools with any like Java's platform independence.
Re:I wish it were true! (Score:2)
Interesting, but there's an error... (Score:3, Informative)
Re:Interesting, but there's an error... (Score:2)
Re:Interesting, but there's an error... (Score:2)
Re:Interesting, but there's an error... (Score:3, Informative)
But Java and C# don't actually let you have jagged multidimentional arrays like this. They have like you said in your first post, an array of pointers, which is valid in C. One wonders what the writer of the article thinks argv is (typed char*argv[])
Re:Interesting, but there's an error... (Score:3, Informative)
type xarray=packed array[0..20,0..20] of integer;
var data:xarray;
That's a multidimensional array for you, with a data type so you can pass it to a function.
If you'd wanted, but didn't feel like passing it to functions (i.e. no data type so it couldn't pass correctly) you could write
var data:packed array[0..20,0..20] of integer;
and accomplish the same thing. Either is accessible with a somple
data[x,y] structure, that can be controlled by FOR/WHILE loops, IF statements, and the like. Last year, I was working in truely 3-dimensional arrays in PASCAL to store data for an airline seating chart.
type xarray=packed array[0..20,0..20,0..20] of integer;
var data:xarray;
data[x,y,z]
And even 4+ dimensional arrays "worked" but I'll be damned if I could visualize them in any coherant way.
type xarray=packed array[0..20,0..20,0..20,0..20] of integer;
It may have been a fluke that it worked at all, but I did a relatively simple program to fill up each space with random data and writeLn() it out, just to see if it worked. For that big of a data structure, you could probably do much better using records, or seperate linked arrays if Pascal can do such a thing.
I've never done any programming work in BASIC so I can't speak for it's handlig of multidimensional arrays. I don't recall them being too hard from a program I looked at though, something to the effect of
DIM variable%type% AS array (x,y) or something.
Re:Interesting, but there's an error... (Score:2)
Mod me offtopic for the
Did you know that this...
"
Pacifism is objectively pro-Fascist..."he that is not with me is against me."
- George Orwell
"
was essentially Orwell paraphrasing Leon Trotsky (who wrote the rant "Passivism is the tool of imperialism)(Either in context of passivism to the capitalist west or in context to Hitler.. can't remember)
Bet you didn't know that.
w00t? no dynamic class loading? (Score:4, Informative)
I design JBoss, the leading J2EE server and at THE HEART of it is the capicity to dynamically deploy new applications on our application server. I mean that is what application servers are ALL ABOUT.
in fact (plug) in JBoss we go the extra mile and allow you to hot-deploy (dynamically add classes) the server classes themselves, which neither IBM nor BEA, nor Oracle do.
So I was curious to know who would win the
Why? well imagine that ANY time you change your class in C# YOU NEED TO REBOOT THE APPLICATION SERVER, yes, boys and girls that is the simple thing that "dynamic class loading" affords you, without it, the VM is tied to whatever you have at startup.
GEEEEZZZ!
Re:w00t? no dynamic class loading? (Score:2)
If you're doing web services, you don't need to shut down the server. You can just copy the
No shitty XML, EAR, WAR, JAR, BAR, ZAR, XAR, PAR
Re:w00t? no dynamic class loading? (Score:2)
Re:w00t? no dynamic class loading? (Score:2)
Having used .NET (Score:3, Informative)
The first release of .NET will still be 2-3 releases from full fault tolerance and enterprise level computing. There are alot of complicated processes in enterprise computing and Microsoft's .NET platform as it stands today is far from meeting those needs. Microsoft has yet to define really useful modules and standards for complex processes that span multiple systems which include legacy VMS systems and modern solaris 8 applications.
SOAP is great for simple processes, but it is far from adaquate to handle distributed and transactional processes. Using standards like UDDI is a great step towards easing multi-platform integration. Instead of having different divisions of the same company design different API for publishing resources, it will be easier to have a common way of doing those things. It is not uncommon for financial institutions to store information differently. Take a simple think like address. Some places may store the number in a separate field, while others may replace "jr" with "junior". Anyone who has worked with large mixed environments knows this fact. SOAP is a message centric way of doing things. It is not designed for complex processes. The stuff IBM is building around SOAP is more complete than Microsoft's offering, but then again IBM has been at services longer.
Re:Having used .NET (Score:2)
This is not the first time this has happened to me. I have spent many hours on google looking to find out what they cryptic error message means and not finding a solution. Alas I am being forced to use this crap but I figure if they don't mind lost productivity then I don't either.
Perhaps this is what the author means when he says it's not "enterprise ready".
My take (Score:5, Interesting)
I just recently picked up C# about a month ago. The learning curve from Java was pretty damn low, only with a few different naming conventions and new language constructs. Things such as indexers, delegates, and the like (all of which I feel are positive additons to the language.) The event model, to my surprise, is better than Java.
Then after learning the language itself I started looking into Windows Forms and nearly spooged my pants. Finally Windows progammers get a clean framework of GUI controls with a powerful modern language behind it (ie, not C++ or VB.)
Usually if you wanted to make a powerful Windows app you were forced to use C++ since VB didn't really cut it. Now you can use C#. Complex Windows apps are going to be a whole lot easier to write now, nevermind the fact that they'll be able to do remote method calls via SOAP, and be deployed effortlessly (ie, create a Windows Installer in like 3 clicks or something.)
I have to say, for the stuff I'm writing that I don't need cross-platform compatibility (which I did surprisingly find to work in the case of servlets)
Re:My take (Score:3)
Langs the same. Companies differ. (Score:4, Interesting)
The things that make these two different as a language are pretty trivial. As a Chem. Eng. professor told me when I asked if I needed to bother with FORTRAN when I already knew Pascal, "They're all different dialects of the same langauge".
The only real difference is that you'll want to use the dialect best suited to your particular programming task. If you want to leverage code written in
The biggest difference isn't syntaxical. It's the mindset of the companies behind the code. No matter how many times MS wants to claim C# isn't a Java clone, the point is it's a well-done language based on lessons learned by programmers who are familiar with Java. My only fear is that C#, an excellent language in theory by anyone's measure, is going to be wrung through Microsoft's "profit maximization machine" and be made to do things that, in practice, aren't the best.
The neat part is that people familiar with C#'s concepts will also be able to quickly learn Java! I wouldn't be too surprised to see some VB programmers turned C# developers start to think, "Hey, you know it wouldn't be that hard to run this on [Linux/OS X/etc] by implementing this idea in Java!"
C# is slightly better than Java (Score:2)
However, this doesn't justify establishing an entirely new, closed language system for developers to have to deal with. I am disgusted that Bill and Scott could get together to resolve their differences. Now they've forced tens of billions of dollars of wasteful duplication on the world.
Slashdotted! (Score:3, Informative)
C# is what Java developers really want... (Score:5, Interesting)
Java really hasn't changed much since its inception. All we have are a few more libraries, a GUI framework that blows ass, and a server-side framework that we didn't really need to begin with. But we have no real additional language FEATURES.
Like a lot of people, I've been using Java since the beginning. I look at the C# language and I see everything I want in Java. The great majority of differences between C# and Java are purely syntactical sugar -- compiler candy. AND THAT IS WHAT WE WANT.
We've been asking for support for generics and parametric types since JDK1.1. And they still aren't in (they were removed from 1.4 at the last minute). We've been asking for A REAL CONST. We've been asking for assertions -- and finally got them.
But all in all... most SEASONED Java developers aren't happy with the progress. Java has been plainly behind the curve when it comes to evolving new and different features. Instead, Sun poured all of their effort into their bullshit J2EE framework which is a complete shambles, IMHO.
Its obvious. Microsoft simply went to Usenet... read a bunch of Java posts... and saw that Java was stagnant. They took advantage of it. They created a new language... based upon Java... adding everything that Java developers were complaining about. Voila! C#!
I wonder if this would have happened if Java were open source. Probably not.
But one thing for sure... Microsoft is an EXPERT at catching a company while it is asleep at the wheel... ripping of its product... making it better... and seizing an entire market.
They just might be doing it again...
M$ Astro turfer (Score:2)
I was going to rebut this purely on the grounds that generics are a crutch for people that simply don't get OO, but after checking out your posting history it's clear that you are clearly a M$ Astroturfer, so I've leave your fate to the moderators.
http://slashdot.org/~javabandit/
C# just a rip-off of Java? (Score:2)
I'd like to congratulate Dare Obasanjo on his extensive comparison between Java and C#. After reading it, and my anti-Microsoft bias aside, I've come to the conclusion that C# is basically a rip off of Java, with a few extra features that might make it an interesting development platform. As always, I feel that Microsoft has implemented a system designed as an integrated part of Windows, to keep the development community (and, therefore, the user community) at Microsoft's mercy.
I say this for the following reasons (and, again, I'm trying my best to place my anti-Microsoft bias aside):
Well, whatever. Forget it. I'll probably just get flamed by a bunch of people, and moderated as a troll or something. Oh well. My karma has been going down for the past few days because some really crappy stories have been posted on the front page, and when I read crappy stories, I write crappy comments. Or something like that. Oh well.
Laundry list of corrections (Score:4, Insightful)
My corrections:
A.2: Java doesn't have an "unsafe" keyword; C# and Java have a "volatile" keyword that is strangely missing. And don't you think it's strange that he doesn't equate C#'s "extern" with Java's "native"? They're approximately the same.
A.5: Neglects to mention here that C# has square *and* jagged arrays, it is stuck in section D.
A.10: The phrase "both languages have an inheritance hierarchy where all exceptions are derived from a single Exception class" is a tautology, because "all exceptions" *are* exceptions because they extend Exception! Whereas if he meant to say "all objects that can be thrown are instances of types derived from a single Exception class" he would be wrong, because in Java these all derive from java.lang.Throwable.
The sentence two sentences after that one, starting "Finally, both languages..." does not make sense.
B.8: The last statement in this paragraph is incorrect. Isn't it possibly in Java to simply write ArrayList.class, if java.util.ArrayList has been imported? Likewise in C#, where if System.Collections has not been using'ed it is necessary to write typeof(System.Collections.ArrayList).
C.1: This really should mention delegates here. It was inner classes v. delegates that heated up the Sun vs. J++ debate. Thus C# doesn't suffer a "lack" of inner classes, rather it suffers an ideological difference with Java, don't you think? And likewise, Java doesn't suffer a "lack" of delegates.
C.3: The criticism that, for example, it is possible to overload "", and this makes overloading bad, and C# has overloading, hence C# is bad-- is nonsense! In C# it is illegal to overload, for example "", or "==" but not "!=".
It also says "()" (I assume meaning cast) and "[]" can not be overloaded. This is again very precise and misleading language. They can not be overloaded, because custom conversions and indexers can be used instead!
It also fails to mention that "&&", etc. will call "&". The blanket statement that "&&", "||", etc. "can not be overloaded" is very misleading.
C.4: You can "fall through" in C#, with goto. Except unlike Java, in C# it is explicit (and more flexible).
Fails to mention Java's limited range of "switch" statements, whereas e.g. C# can switch on a ulong.
C.5: Seems to miss the distinction between *assemblies* and *modules*.
C.6: Some of these criticisms are unfair, e.g. that Java has thread-safe collections. In C#, a reference to a synchronized wrapper can be kept and the un-thread safe reference be let go out of scope!
Not mentioning boxing and unboxing here is a failure: one of the chief gripes with Java's collections is that it is necessary to wrap the primitive types in their class equivalents.
C.7: Java has a labeled goto of sorts-- break and continue. Thus some of the criticisms of the weakness of languages with goto may also be applied to Java.
C.8: Is this section intended to confuse? The fact that marking a method final in Java means that subclasses cannot contain a method with a similar signature is a *coincidence* arising from the fact that (a) final means methods can not be overridden and (b) Java does not have new/reintroduce semantics and relies instead of the name and parameters. Thus C#'s final achieves exactly the same as Java's in terms of dynamic linking and dispatch-- that a particular method can not be overridden.
D.3: Should probably mention that
Well, that's my $0.02. Apart from those glaring problems, the discussion is not bad.
Jagged arrays (Score:2, Informative)
After all, in C, I'd use:
int* array[2];
array[0] = (int*)calloc(sizeof(int), 3);
array[1] = (int*)calloc(sizeof(int), 9);
True, this doesn't use heap-based stack, but to me, the functionality is the same...
C# may be very good for Java (Score:2, Insightful)
2. Many VB and C++ developers will move to C#. They will then be in an ideal position to transition to Java with little effort if they have a requirement for cross-platform apps.
Re:Non Portable (Score:2, Insightful)
They have already sold their souls, and have nothing to lose.
Ouch! (Score:3, Insightful)
I've been forced to write sites in ASP/SQLServer on a number occasions because thats what the client asks for (they figure if its all IIS and VBScript it'll run better, I know, dumb). So before you decide to look down upon someone using C# or VB or anything else, realize that there are a number of factors that go into what technology is used.
(I wish I could say my morals could standup to such a request, but low and behold, I want money too.)
Seriously, why do you expect someone to only code in a certain language? I feel that the more you know, the better a job can get done. Just because its a MS language doesn't mean that it is useless. You should do what's best for the client.
Re:Ouch! (Score:2)
Well put indeed. At one of my old developer jobs, the company was a 100% Microsoft shop. NT servers, IIS on the web side, ASP for scripting, MS-SQL Server for database stuff. Needless to say, I tried time and time again to introduce *anything* related to *NIX and/or open source software, without any luck.
I tried bringing in PHP and Perl for scripting. I even set up a test server running NT 4.0 and ActiveState Perl, complete with a demo app that could be used for the customer's needs. Did they buy it? Nope. The customer was "sold" on Microsoft, and was convinced that anything else was second-rate.
Interestingly enough, from talking with a couple of friends still working there, they actually have a PHP coder on staff full-time now, and are running a number of Linux servers for various purposes. While it's frustrating that they couldn't "see the light" while I was there, it's also good to see them expanding their reach. Their primary focus is still on NT solutions, but I can't entirely knock that, since they *do* keep up with security patches and such far better than most "home grown" admins I know.
It all comes down to money. I run a web hosting company based on Linux. We don't do NT, period. Our customers are people who want Linux web hosting, plain and simple. There are hosts out there (lots actually) that only do NT. To each his own. All you can do is try to do the morally correct (in your own view, highly subjective) thing while still earning a living.
Web hosting by geeks, for geeks. Now starting at $4/month (USD)! [trilucid.com]
Yes, this is my protest to the sig char limit
Re:Ouch! (Score:2)
Best thing about Python , is it's got that easy readability thing that made all the suits switch from specifying COBOL to specifying VB (Which I believe has taken the role of the "New cobol" , but for windoze only {ie business logic lang}
Plus a good reason to encourage the suits to let you do the code in python is that its so damn easy-yet-powerfull that they don't have to lock down on a particular coder. Any new coder who can't ultra quickly learn python WILL NEVER learn to be a usefull programmer, due to mental deficiency.
Re:Non Portable (Score:2, Insightful)
And of course all the third party database bridges are native apps (at least if they go fast), so you are intrinsically dependent on a chunk of code that doesn' claim, or even want to be portable if you are doing any enterprise development.
Again, I have no real problems with java, but to me it is still "Write once, Test anywhere", and I'm not sure if there is any move to make the JVMs more similar (or even if that is a good idea). But what do I know, I'm just a crazy C++ hack
Re:Non Portable (Score:2)
Hmmm...
Yes the native thread models are different between OS environments. That might be because the OS's themselves use different threading models? Whaddya reckon?? Possible?? Switch it over to green (i.e. internal) threads and it'll be using the same code in all cases. Not that it means it's perfect, in the past I have seen (minor) differences.
As for databases, use a pure java implementation. If the vendor doesn't offer one, shout.
But we're currently building a huge distributed app under linux/win32/solaris, which will all be deployed on solaris. Nothing stopping us at the moment.
Re:Resist the Urge! (Score:2)
Java != Sun (Score:5, Informative)
If there are any good ideas in C#, there's really no reason it couldn't be adopted by Java. Someone just has to submit a request
Re:But what if.... (Score:2)
Re:urm yeah, 'up and coming dev guys' take some ad (Score:2, Informative)
Re:urm yeah, 'up and coming dev guys' take some ad (Score:2)
Like a fucking pipe dream, speaking as a former Java programmer.
Re:urm yeah, 'up and coming dev guys' take some ad (Score:2)
Really?
Just click on the first link of the C# results and tell me where you find C# in the job description.
Hint: Nowhere
Conclusion: Your method is completly flawed, presumably because their search engine just ignores '#' and '++'.
Btw., even if it worked, your C# and C++ results would be a subset of your 'C' results.
Re:It doesn't matter how good it is (Score:2, Insightful)
(I would also like to point out that MS is notorious for ignoring ANSI standards *cough* C++ *cough*, so what an interesting point that they finally "seen the light" -- but let's give them the benefit of the doubt).
Re:C# doesn't make any sense... (Score:2)
Huh? What the FUCK (your word, not mine) are you talking about?
I have never applied for a position in MS.
Before you insult someone, make sure you get your facts straight.
Re:Run Away Run Away (Score:2)
Excellent point. In fact, I have to say I agree with both of you. I really tried to give Carnage4Life a chance on kuro5hin, but he'd always come back and flame me, even when I agreed with him. He's so damned desperate to flame anyone who has Open Source ideals, mainly because he feels ostracised for having worked at Microsoft.
But you're right. Bob Young or (in years past...not true now) Larry Augustin aren't any more credible sources than Bill Gates. All of 'em like to spout business rhetoric. And hey, I live in America, where the "world" revolves around business.
The fact that the party in question here is Microsoft makes me question the motiviation no more than any other party.
(OT: dangit, I keep trying to middle-click-paste right now, and I'm running Win98 'cause I'm too lazy to install the silly CrossOver plugin to view a QuickTime movie trailer. Bah.)
Right. And I've got to think that there's developers working for MS scratching their heads about all the hate foisted upon C# just for being MS. Yeah, it's going to be used as a marketing tool rather than genuinely as an innovative tech tool. But how much was Linux used as a marketing gimmick in the last 3 years? And for all you people worried about C# taking over the world, look at the beating the Linux world has taken, mainly because companies used Linux as a marketing gimmick?
People, relax.