Slashdot Mirror


Java Creator James Gosling on C# And More

DreamTheater writes: "Java inventor James Gosling says he isn't losing much sleep over Microsoft these days, despite the software giant's effort to stem Java's popularity with its own Java-like language." Gosling talks about other things in this interview, too, like his current project of developing a good IDE.

52 comments

  1. SUN needs to loosen control of Java. Fast. by Astral+Traveller · · Score: 1, Troll
    C# has already geared itself up for a dominant position in tomorrow's enterprise development environment due to its ECMA standardisation and Microsoft's atypical encouragement of competing implementations (hence Mono, Portable.NET and other such projects). Microsoft's not stupid -- they know from history that open, standard systems almost always outcompete even the most entrenched closed systems eventually.

    Sun has scared off a large potential userbase for their Java platform with their obsessively protective and litigious treatment of their intellectual property. Only Apple is more ferocious in their protection of trademarks and copyrights, and we've all seen the marginalising effect Apple's insular attitude has had. Unless Sun has a rapid change of heart, .NET, C# and the CLR is going to vapourise Sun's marketshare in server applications and enterprise programming userbase due to sheer openness. And you can rest assured that, once Microsoft's asserted their dominance in the field, .NET won't remain an open standard for long.

    1. Re:SUN needs to loosen control of Java. Fast. by Anonymous Coward · · Score: 0

      What is SUNs control of java hindering?

    2. Re:SUN needs to loosen control of Java. Fast. by bahree · · Score: 1

      If Sun was so "worried" about MS "taking-over" Java, they probably should look at J#, http://msdn.microsoft.com/visualj/jsharp/beta.asp. Given the fact that nothing about it is mentioned is a bit surprising.

    3. Re:SUN needs to loosen control of Java. Fast. by TurboRoot · · Score: 4, Informative

      This is the common FUD spread by Microsoft regarding the Java standard, but you forgot one important thing... the truth.

      The truth is.. Sun can't protect an open standard. If Java was a totally open standard then Microsoft could "embrace and extend" Java into the ground and destroy it. Sun isn't stupid.

      The truth is, Sun makes every step possible to keep Java as standard as possible and documents it VERY VERY VERY well. Go to http://java.sun.com/docs/books and see for yourself. Scroll down, look at the bottom. THAT is the standard.

      Sun also goes to great pains to receive feedback from the community and industry. In fact a lot of the EJB and J2EE standards were dictated by application server companies.

    4. Re:SUN needs to loosen control of Java. Fast. by MarkMac · · Score: 4, Informative
      Microsoft's not stupid -- they know from history that open, standard systems almost always outcompete even the most entrenched closed systems eventually.

      What a BIZZARE statement regarding Microsoft. Never mind that Visual Basic - the most widely used programming language - is completely proprietary and Microsoft windows specific. Never mind that Microsoft has perverted every "open" standard they use to add their own extensions (often undocumented) effectively turning them into proprietary protocols. The C# language specification may have been passed off to an obscure standards group (that normally doesn't deal with computer languages) but it hardly opens up all of the APIs which really define .NET and the use of C#. "Embrace and extend" is a standard Microsoft policy - has been for a long time and will continue to be. It is not at all clear that CLR and .NET are open standards as it is given the possibility of hidden patents etc.

      Microsoft was caught doing the same thing to Java once they had licensed its use (SUN was pretty naive to have permitted this - maybe they didn't have good enough lawyers ...). As soon as the court found Microsoft guilty, Microsoft announced it would dump Java for their own language which turned out to be C# (that looks and works a lot like Java).

      Unless Sun has a rapid change of heart, .NET, C# and the CLR is going to vapourise Sun's marketshare in server applications and enterprise programming userbase due to sheer openness.

      While SUN has not given up the trademark "Java", this language is hardly as restricted in use as Microsoft would like to imply. Given the incredible number of licensees of various forms of Java would hardly imply that the user base is scared off by SUN's intellectual property. Indeed, Microsoft's past insidious behavior will haunt their promotion of .NET as the new "open" standard. (Who hasn't gotten over the years burned by Microsoft's business practices ...)

    5. Re:SUN needs to loosen control of Java. Fast. by Anonymous Coward · · Score: 0

      Javascript is also an ECMA standard and now we have different versions of this "standard." ECMA is not a cure-all for creating industry standards. While the JCP has not been enough for some, Sun has done an admirable job of listening to others and extending Java in a timely and efficient manner.

    6. Re:SUN needs to loosen control of Java. Fast. by Anonymous Coward · · Score: 0


      > The truth is, Sun makes every step possible to keep Java as standard as possible and documents it VERY VERY VERY well.

      No. Not really. For example, give me the documentation of semantics of the java.io.StreamTokenizer.nextToken() method. As a starter question: with `/` as a comment character and /* comments, how many tokens does this give you:

      /*
      a
      */

      In general: what ordering exists on token types when nextToken tries to parse a new token? what does it try first, and what next?

      The API docs are silent about that, the only source of information I could find is the java language specification, 1st edition. The API description section has been removed from the second edition.

      There are the Java Class Libraries Books, of course, which are very nice. Unfortunately, they only cover java 1.1 + parts of java 1.2 .

      If the language had a proper ISO standard I wouldn't need to waste time searching for API semantics.

      > Sun also goes to great pains to receive feedback from the community and industry.

      Yes and No. The interesting sections on their Java Development Corner web site are only available after registration. Their source code licensing schemes are not very helpful, and you need to buy a Java Compatibility Kit from them. If they are serious about setting standards they should make their test suite available free of charge, so their customers could check the quality of implementation for themselves.

  2. Flamebait? by Score0,+Overrated · · Score: 2, Insightful

    'You guys (at Microsoft) still don't get it,' because it's sort of Java with reliability, productivity and security deleted."

    Quite simply ... this attitude worked for Windows 95, so why should MS be rattled by these remarks?

    Once Microsoft have got the market share, they can work on the reliability and security.

    1. Re:Flamebait? by Anonymous Coward · · Score: 0

      > Once Microsoft have got the market share, they can work on the reliability and security.

      ...based on their track record in other products, I'd say that once they've gotten the market share they can forget about reliability and security until it becomes FREAKING HUGE public relations issue.

  3. my $0.02 by Adrian+Voinea · · Score: 3, Insightful

    I think from the level of people who make decisions about what programming languages to use on commercial projects (this includes me), the technical distinctions between Java and C# are of little concern: the languages are so similar that they are basically interchangeable. What matters is who supports it, what libraries are available, how mature are the implementations, whether it's a single-vendor or mult-vendor solution, how well it integrates with the platform, and how many programmers are available.

    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.

    1. Re:my $0.02 by Anonymous Coward · · Score: 0

      I would say (from what I'm seeing) is that most VB programmers are going whole hog on VB.NET, which is more like Java with VB syntax than it is like VB.

      Most Java types will probably stay on Java for the time being. That will leave C# as the odd man out, it will get the 'props' it's due, but the real market battle is still Java versus VB, just like last year.

  4. Er, No... by barnsleyBigUn · · Score: 5, Insightful

    "You guys (at Microsoft) still don't get it,' because it's sort of Java with reliability, productivity and security deleted"

    Er, no, Sun really don't get it. C# on top of .NET is a significantly more "productive" language than Java as it is based on a much higher level of abstraction. You can concentrate on immediately doing things your application (Web, Client, etc.) is supposed to DO than the plumbing to get to that stage. Visual Studio.NET is easily the most productive environment I have ever seen, but the article concentrated on C# so...

    Microsoft haven't forced people to use the highest abstraction, you can choose to do much lower level things ("unsafe code" for instance). I assume this is what Mr. Gosling is referring to with "reliability, ...security deleted". The .NET approach puts the onus on the developer (you know, the one with the brain) to decide what they want to do, and how they want to do it. In order words don't penalise all developers to script kiddie level, realise there are different problem spaces and different levels of developers and let them figure it out themselves.

    Yes I program in .NET, have done since Beta 1, and find it a joy to use. Stability even from the earliest builds simply was amazing (especially considering its an MS product) and brings a lot of the "fun" back to programming (doing stuff instead of writing or finding/using support libraries). But I do have a background in Java, having programmed in it for the past 4 years...put simply, I'll choose which language/environment to use depending upon the project.

    ...fire extinguisher ready and waiting...

    1. Re:Er, No... by TurboRoot · · Score: 1

      >NET is a significantly more "productive" language than Java as it is based on a much higher level of abstraction. You can concentrate on immediately doing things your application (Web, Client, etc.) is supposed to DO than the plumbing to get to that stage

      >But I do have a background in Java, having programmed in it for the past 4 years

      So umm.. you programmed in Java for 4 years and never used an application server to do the "plumbing" for you?

    2. Re:Er, No... by barnsleyBigUn · · Score: 1

      JRun and a little "play" with JBoss, but only in the past 14months or so. JRun does help immensely but you still end up writing significant plumbing which .NET and C# (using Metadata and lots of syntactic sugar) do automatically for you. I'd say my classes in Java are 3-4x size of the ones in C#.

      Of course, argument against would be that you can pick your "application server" on Java platform but not the .NET platform.

    3. Re:Er, No... by Anonymous Coward · · Score: 0

      Having been a C++ programmer for over a decade, I find C# to be useful and productive. I have also programmed in Java for a couple of years. I find the differences between the two languages to be marginal, with C# closer to C++ in its expressiveness and control, e.g., pointers.

      Mostly, I appreciate a language designer who doesn't remove my ability to express myself, but at once helps me to get my job done quickly. Removing a language feature to protect a developer is no favor. From this perspective, C# wins over Java.

      I'm taking a wait-and-see attitude as far as cross-platform availability of .NET CLR. Admittedly, C# is less a viable proposition without the CLR on other major platforms.

    4. Re:Er, No... by errxn · · Score: 1

      Yes, thank you! It's about time someone actually judged the language on its *merits*, and not who produced it!

      Every time I see a language advocacy debate, it amazes me how quickly it goes from "language X has this feature, while language Y does not", et. al., into "corporation X, who produces language X, is pure evil, so language X sucks" or whatever. It kinda reminds me of a local movie critic who uses his film "reviews" as a bully pulpit to whine and bitch about every aspect of life that he doesn't like. It really gets annoying to read through his drivel when really, all you want to know is how good the movie is. Same deal here.

      As far as the "unsafe" code that C# allows one to write, call me a cynic, but if this were allowed in Java (or any other non-M$ product for that matter), I wonder how many of the same people that are badmouthing it now would be calling it a "cool feature" that "allows great flexibility", yadda yadda yadda....

      Politics as usual, I guess.

      --
      In Soviet Russia, Chuck Norris will still kick your ass.
    5. Re:Er, No... by GPS+Pilot · · Score: 1

      Is there any task for which you would choose Java over C#?

      More to the point -- I'm a newbie when it comes to OO languages, and I'm wondering which I should study first, Java or C#?

      --
      That that is is that that that that is not is not.
  5. no vm won't help by Anonymous Coward · · Score: 0

    Don't forget that Microsoft is going to make it painful for Java whereever they can. This is evident in the lack of a JVM in XP.

    Sure you can go out on the web and download a Xmeg package and install it but remember that lots of folks are on 56k and won't be bothered.

    Of course the Java folks now say that it's really s server side tool anyway :->

    (and no, I'm not a M$ goon).

  6. Gosling's and Sun's problem with C# by Anonymous Coward · · Score: 0

    They don't seem to know what to make of it. They realize that it is Microsoft's "Java Killer", but they can't figure out how to defend against it, or even whether they need to defend against it.

    This is a result of their misplaced focus on Java. Java isn't strategic to anything Sun has to offer. They've poured so much time and money into Java in the hopes of unseating Microsoft by allowing users choice in operating systems, but it hasn't actually bought them anything substantial.

    Sure, Java is a nice language, but it never offered anything to the 95% of the computing public that doesn't even think to use another operating system (Windows and Mac owners, for the most part). Whatever small hole Java opened, Microsoft is filling it in with C# and luring other developers into .Net via Mondrian.

  7. So - Gosling invented Emacs huh? by gruntvald · · Score: 1

    Amazing!

  8. He wrote the original EMACS, huh? Whatta guy! by Linux_ho · · Score: 3, Insightful
    I was kind of the guy responsible for the original Emacs, 23 years ago.
    I think his brain is starting to go. If I remember correctly, he wrote a version of it in C, using a bastardized LISP for extensions, in the early eighties. Stallman wrote the original in... umm... 1976?
    --
    include $sig;
    1;
    1. Re:He wrote the original EMACS, huh? Whatta guy! by Linux_ho · · Score: 4, Informative
      --
      include $sig;
      1;
    2. Re:He wrote the original EMACS, huh? Whatta guy! by Anonymous Coward · · Score: 0

      the bastard wrote the original commercial version of emacs

    3. Re:He wrote the original EMACS, huh? Whatta guy! by cooldev · · Score: 2

      From the UniPress site (ca. 1995):

      UniPress Emacs is priced from $395 per workstation
      C/C++macs and FortranEmacs are priced at $695 per workstation
      AdaEmacs is priced at $995 per workstation
      Source code is available for an additional $600
      Site licenses, special university pricing and discounts are available

      ;-)

  9. fundamental distinction by Martin+S. · · Score: 2

    the technical distinctions between Java and C# are of little concern

    You have fallen for the M$ FUD; IMHO these distinction(s) are pretty fundamental.

    1) Java is platform agnostic, C(hash) is WOSA only; couple this with fact that WinTel platform is dying at the hands of a raft of alternative platforms(http://news.bbc.co.uk/hi/english/busines s/newsid_1767000/1767695.stm)
    2) Java is an industry wide product, C(hash) is from only one supplier.
    2) Java is OO, C(hash) is not. [It's encapsulation mechanism is broken, all members are essentially public].

    1. Re:fundamental distinction by Shimmer · · Score: 1

      It's encapsulation mechanism is broken, all members are essentially public

      That's news to me. Can you provide details?

      -- Brian

      --
      The most rabid believers in American Exceptionalism are the exact same people whose policies are destroying it.
    2. Re:fundamental distinction by Anonymous Coward · · Score: 0

      1) see mono.

      2) C# is a ECMA standard. Java is a single supplier system. I suspect this one was just a typo on your part, transposing C(hash) [sic] and Java.

      2) [sic] Java has primitive types, C# at least hides them via boxing. ergo, Java is 'less OO.' Your whining about encapsulation shows a profound ignorance of what you speak of. C#'s private fields and methods are fully protected, you're thinking of properties. Properties can use any combination of direct variable access or accessor methods for read and write, and change which method they use without breaking other code.

      This is far better encapsulation than you can get with Java: what if Sun wanted to change the nval and sval public variables of StreamTokenizer to be accessors? They'd have to break the public interface, breaking all code that ever used it.

      In the future, I suggest actually knowing what you're talking about before accusing people of FUDing.

  10. Should be (-1 Astrotufer) by Martin+S. · · Score: 4, Interesting

    C# has already geared itself up for a dominant position in tomorrow's enterprise development environment

    This reads like Marketing hype worthy of the FUD-Master General himself.

    ... its ECMA standardisation

    ECMA standardisation is a red herring when it comes to openness. ECMA is a closed organisation. As an individual expert Software Enginner I cannot join and influence language development at ECMA. However I can (and have) joined the JDC and bring my ideas to bear on the development of Java at (http://developer.java.sun.com/). This is open to anybody, including Microsoft.

    Furthermore you only have to consider the death of the ECMA standardisation of JavaScript which has been an abysmal failure to seem that, ECMA is not a guarantee of a successful standardisation.

    and Microsoft's atypical encouragement of competing implementations

    You've obviously not been keeping up on current affairs. Microsoft have been found guilty of anti-competative behaviour in the US and are about to get another nailed in the EU too.

    http://news.bbc.co.uk/hi/english/business/newsid _1 635000/1635317.stm
    http://news.bbc.co.uk/hi/english/business/newsid _1 697000/1697766.stm

    .NET, C# and the CLR is going to vapourise Sun's marketshare in server applications and enterprise programming userbase due to sheer openness.

    Hardly likely; Microsoft have minimal existing presence (or mindshare) in the heavy weight enterprise sector. As long as they stick to the attitude of stick security, robustness and quality, they never will.

    once Microsoft's asserted their dominance in the field, .NET won't remain an open standard for long.

    The only truth, in your entire post, Embrace and Extend.

    Perhaps we need another Moderation option (-1 Astrotufer).

  11. Just wondering by sinserve · · Score: 1

    How was Gossling "responsible for the original
    Emacs, 23 years ago"?

    I think I have been flaming the wrong hairy guy
    all this time ;-)
    :wq

  12. C(Hash) Encapsulation mechanism is broken by Martin+S. · · Score: 2, Informative

    It's encapsulation mechanism is broken, all members are essentially public

    That's news to me. Can you provide details?

    Yes, A private member may be accessed directly, just as if it is a public member, this breaks encapsulation, for example:


    localMember = anObject.privateMember ;
    anObject.privateCounter ++;


    http://searchnetworking.techtarget.com/sDefiniti on /0,,sid7_gci212060,00.html

    http://genamics.com/developer/csharp_comparative .h tm#2

    1. Re:C(Hash) Encapsulation mechanism is broken by Shimmer · · Score: 1

      Sorry, but I think you're wrong -- or at least confused about the difference between fields and properties in C#. AFAIK, C# does not allow direct access to private members.

      Thanks anyway.

      -- Brian

      --
      The most rabid believers in American Exceptionalism are the exact same people whose policies are destroying it.
  13. You're wrong by SimonK · · Score: 2

    C# has properties - a mechanism also seen in Delphi. The same chap designed both languages, but the features is not new. It was also in common lisp. A property looks like a public field to the outside world, but under the covers overridable accessor methods get called, so you can override the behaviour or make them read-only.

  14. JRun is only a servlet engine by SimonK · · Score: 2

    A full application server environment also contains an EJB container, JMS, etc. EJB in particular is tremendously useful for applications that require persistence, and it also does a certain amount to help with session management. If you write centralised web applications, the whole thing helps tremendously in the same way you describe for .NET.

    1. Re:JRun is only a servlet engine by Anonymous Coward · · Score: 0

      JRun is a full J2EE 1.2 certified application server. See in http://java.sun.com/j2ee/compatibility.html.

  15. Curious by SimonK · · Score: 2

    Can you give more detail, or a references (preferably a non-marketing-bullshit reference) on how .NET is more productive than Java ? I find Java - with the appropriate supporting tools - substantially more productive than most of the alternatives.

    As to the "unsafe" features in C#, I see what you are saying, but they still worry me. Aside from very deeply embedded stuff - and there's very little of that these days - there is no need for pointer arithmetic, or manual control over memory allocation.

    To say "if you don't like it, don't use it", is only one half of the story. The second part is, we live in an industry full over people with an over-confident view of their own abilities and an obsession with efficiency. Keeping dangerous features out of the language helps keep those people under control.

  16. C# and .NET will NEVER be cross-platform by javacowboy · · Score: 2, Interesting

    Hmmmm....I originally submitted this story this morning, about 6 hours before this story was posted on Slashdot, and it was promptly rejected.....

    Anyway, if you talk to just about any serious Java developer, they will tell you the same thing I'm about to tell you now. Noone will buy M$'s assertion that C# will be cross-platform for the simple reason that it's Microsoft. Microsoft depends upon a Windows monopoly, and for that reason, it will do nothing to support other platforms. If they did, they would have made Linux versions of Office, Internet Explorer, Media Player, etc. Noone trusts them to make *ANY* product cross-platform. Their history clearly demonstrates this pattern.

    The reason why most developers use Java is because they KNOW they can compile it on one platform, and then run it on another. I know it's not perfectly platform-independent, but it comes pretty close. Switching from Java makes no sense if this cross-platform utility is compromised, or even made uncertain.

    Besides, Java has a proven track record and is *EXTREMELY* well documented. If I need info on any class, package or utility, it's just a few clicks away in the HTML javadocs. Also, I can document my all of my OWN code with only a single text command: javadoc. Thus everyone will be able to read my own documentation in the same format and with the same easy of use as the Sun Java documentation. Every product Microsoft has attempted to document, especially Visual Basic, has been very difficult to get pertinent information on.

    I can run, compile and deploy a Java application using nothing but the free JDK and J2EE from the Sun site, a simple text editor, a command prompt (whether Windows or Linux), a text-line compiler (like Jakarta Ant), and a free application server (like Tomcat). I don't even need a GUI, save for the browser to test my web application. I don't have to shell out $1,000 for Visual Studio to learn, use, program and deploy a Java application. The web application I'm developing for my company has thus far cost us $0 in development costs (aside from my salary and maintaining the hardware it will run on).

    I'm sorry, but I don't believe that Microsoft will make any of their prodocols and/or products truly open, documented or free. The openness, documentation and free cost of Java, as well as its cross-platform capabilities make Java and excellent development platform, and these three advantages, by their intrinsic nature, conflict with Microsoft's intrinsic nature and will never be successfully duplicated by that company.

    --
    This space left intentionally blank.
    1. Re:C# and .NET will NEVER be cross-platform by Anonymous Coward · · Score: 0

      To counter a few of your arguments:

      MS does deliver various cross platform products already - Office for the MAC, IE for Unix etc. Most people would say Office for the MAC is actually better than the Windows version. It does not produce Linux versions however of anything.

      MS is already investing outside its WIndows base, eg XBox. It is not stupid, it realises Windows won't be dominant for ever and so is covering its bases in other areas.

      .NET and C# are its attempt to allow cross platform development. Applications written for .NET will be much easier to migrate than normal Windows apps.

      Ximian is already building a Linux version of C#/CLR. Corel are building a BSD version. Expect C#/CLR to appear on various platforms in the next few months.

      You can deploy/run/execute a C# application using the free .NET SDK, which includes everything except the Visual Studio IDE. If you want a fancy IDE, you have to pay money.

      Java documentation in my experience is a lot poorer than MS. I get Jumpstart from Sun and MSDN for Microsoft, and MSDN is miles better. Inside Visual Studio, I can hit F1 on a method call and get full documentation on it. In Visual Studio.NET it shows me context sensitive help in real-time as I type (if I want it to).

      You can also deploy .NET applications for free on a Win2000 server. You don't need to buy an expensive application server.

      Even after buying Visual Studio the major cost of any development (unless you're buying IBM) is the cost of labour. If an IDE saves 10-20% of time in development for an average developer then this can add up to 10's of thousands of dollars over the life of a project.

      I really would recommend trying .NET/C# and Visual Studio out - you may be surprised once you get over your anti-MS bias.

  17. Informative? by Shimmer · · Score: 1

    Who the heck modded this up as informative? It's just wrong. The bottom link goes to a page that describes the differences between "fields" and "properties" in C#. The top link simply defines the OO term "encapsulation". In neither instance is there any evidence that C# is not OO.

    -- Brian

    --
    The most rabid believers in American Exceptionalism are the exact same people whose policies are destroying it.
  18. Missing Point. by Martin+S. · · Score: 2

    C# has properties ...

    In OOP; a field, a property, a member, or what ever you care to call it are all the same thing. The terminology is different languages for different languages.

    They are ALL a variable encapusulated within an object.

  19. Fact based argument. by Martin+S. · · Score: 2

    It's just wrong.

    Care to back that up with a fact based argument rather than a blanket assertion ?

    The bottom link goes to a page that describes the differences between "fields" and "properties" in C#.

    Perhaps I should have beem more specific about what the links represented.

    The first link goes to a C# Advocacy site that admits the pertinent facts (though it attempts to dress them up as an ease of use advantage). Anybody with even remotest familiar with the concepts of encapsulation or OO, SHOULD understand the ramifications of this (summary below) and can draw their own conclusions.

    This mechanism allows members to be accessed directly outside the Object in the following fashion.

    anObject.aMember = anOther.aMember ;

    Since this can be done even when aMember is private, this is a blatant violation of encapsulation.

    The top link simply defines the OO term "encapsulation".

    Yes; since few slashdot readers are actually OO Software Engineers, this was an attempt inform those unfamiliar with the expression, of what it actually means.

    In neither instance is there any evidence that C# is not OO.

    The first explains what encapsulation is the second is how C# violates it, my post is the conclusion; that since C# violates encapsulation it is not an OO language. The links are most certainly the only evidence you need to draw that conclusion.

    1. Re:Fact based argument. by Shimmer · · Score: 2, Informative

      Care to back that up with a fact based argument rather than a blanket assertion ?

      Sure. I happen to have Visual Studio.NET right here. Let's give it a try, shall we?

      class B
      {
      public B() {}
      private int privateMember;
      }

      class A
      {
      static void Main(string[] args)
      {
      B b = new B();
      b.privateMember = 5;
      }
      }

      When compiled, this program produces the following error on line 12:

      error CS0122: 'B.privateMember' is inaccessible due to its protection level

      Any questions?

      -- Brian

      --
      The most rabid believers in American Exceptionalism are the exact same people whose policies are destroying it.
  20. More fundamental distinctions by Martin+S. · · Score: 2

    I'm going to assume your post is based on ignorance and is not a troll. Time will reveal the wisdom of this decision.

    Firstly the primary assertion of my first post was that C(hash) and Java are the essentially the same thing. Your post despite the errors, actually illustrates more differences.

    C# is a ECMA standard.

    So What? ECMA is not 'open'; and ECMAScript is a standard, but hardly anybody uses it, most Web Developers use propriety non-standard implementions of JavaScript/JScript/Flash etc.

    Java is a single supplier system.

    Not true! This is a list of ~26 supplies of Java Application Servers. This is about 25 more than the number of alternative implementation of C#.

    http://dmoz.org/Computers/Programming/Languages/ Ja va/Server-Side/Application_Servers/

    This is a list of ~258 Suppliers of Java Development tools.

    http://dmoz.org/Computers/Programming/Languages/ Ja va/Development_Tools/

    I suspect this one was just a typo on your part, transposing C(hash) [sic] and Java.

    No it was not a typo. Java IS platform agnostic, implementations are available on dozens of platforms from dozens of suppliers including all the biggest IT suppliers, IBM, HP, Netscape(IPlanet), Oracle, Fujitsu it's available open source, and last but not least Sun.

    Java has primitive types

    Java's primative should have been wrapped in an object, however wrapping anything in an Object is well within the capabilities of even the most junior programmer; and that deficiency is hardly a criticism in the league of a broken encapsulation mechanism. Encapsulation is Essential to OO, that all variables must be objects is not.

    Your whining about encapsulation shows a profound ignorance of what you speak of.

    Then best insult is to prove I am wrong not just assert it.

    C#'s private fields and methods are fully protected, you're thinking of properties. ...

    So you will be able to me the error message generated, when you try to access a private member of anObject with the following code:


    localMember = anObject.privateMember ;
    anObject.privateMember ++ ;


    In the future, I suggest actually knowing what you're talking about before accusing people of FUDing.

    1. Re:More fundamental distinctions by GnrcMan · · Score: 2

      I just tried compiling the following in Visual Studio.NET:
      public class AClass
      {
      private int privateMember;
      }

      public class AnotherClass
      {
      public void BreakAClass()
      {
      AClass anObject = new AClass();
      int localMember = anObject.privateMember;
      anObject.privateMember ++ ;
      }
      }

      Here's what the compiler told me:
      Build started: Project: testproj, Configuration: Debug .NET
      Preparing resources...
      Updating references...
      Performing main compilation...
      c:\testproj\class1.cs(18,22): error CS0122: 'testproj.AClass.privateMember' is inaccessible due to its protection level
      c:\testproj\class1.cs(19,4): error CS0122: 'testproj.AClass.privateMember' is inaccessible due to its protection level

      Build complete -- 2 errors, 0 warnings
      Building satellite assemblies...
      Satellite assemblies could not be built because the main project output is missing.

      Done
      Build: 0 succeeded, 1 failed, 0 skipped

    2. Re:More fundamental distinctions by GnrcMan · · Score: 2

      I suppose I should explain to you what the real deal is, so you don't make any more false claims about this subject. As you saw in my last post, private members are not accessible outside their class (they aren't even accessible in subclasses of their class. They need to be protected for that to work). Here is what you mis-interpreted:

      Accessors are basically methods in disguise. These are functionally identical:

      public int GetFoo()
      {
      return privateFoo;
      }

      public int Foo
      {
      get { return privateFoo; }
      }

      also, these are functionally identical:

      public void SetFoo(int foo)
      {
      privateFoo = foo;
      }

      public void Foo
      {
      set { privateFoo = value; }
      }

      combine them and you get:
      public void Foo
      {
      get { return privateFoo;}
      set { privateFoo = value; }
      }

      Now, the advantage of accessors, of course, is that you get to do this in your calling code:
      anObject.Foo = 7;

      instead of:
      anObject.SetFoo(7);

      Now, something a little more nontrivial. What if you want to do something when Foo is set? Like this:

      public int Foo
      {
      set
      {
      privateFoo = value;
      onFooChanged(this, new EventArgs()); //Fire an event when Foo is changed
      }
      }

      Or maybe the accessor isn't just mapping to a private member:

      Public DateTime CurrentTime
      {
      // if you don't implement a setter or getter, the accessor becomes read or write only
      get
      {
      DateTime dt = new DateTime();
      dt = SomeWackyMethodForDeterminingDateTime(); // in reality, this exists in the DateTime Object already
      return dt;
      }
      }

      So, that is what an Accessor is. Another cool feature is indexers, where you can use array notation for accessing elements in your own collection classes.

      Disclaimer: I didn't compile this code. It's basic enough that I shouldn't have screwed anything up, but don't cut-and-paste it into space shuttle software or something.

  21. No by SimonK · · Score: 2

    In C# and Delphi "property" has a special meaning distinct from "field". A field is a bit of storage set aside for storing a value. These, of course, should not be public because they are an implementation detail.

    It is common, however, in OO languages to expose getX and/or setX methods for a value X which may or may not be stored in a field. Thats OK, provided it is done for a good reason, and not abused to violate class invariants, because the implementations can be changed. So if getX starts off returning the value of a field X, I can later change it to return Y * 42, or whatever else I please. In the jargon, exposing setter and getter methods decouples the implementation from the interface exposed, whereas exposing the field X directly would not. It is this, and not slavishly hiding data values, that matters, because it makes software easier to maintain.

    The only problem is that writing a.setX(3) or p = a.getX() is clumsy compared with writing a.x = 3 or p = a.x. Thus a series of languages, starting with Common Lisp, and the most recent example being C#, have provided mechansisms by which the standard = notation can be used to call a setter method, and standard expression notation can be used to call a getter. Its only a syntactic convenience, though. The actual implementation - whether there is a field or not - is still hidden.

    To anyone who has developed a big application in language - like Java or C++ - without this feature, the attraction should be obvious.

    1. Re:No by Anonymous Coward · · Score: 0

      huh? C++ _has_ that feature - you can overload = to call whatever the hell you want on a per-class basis...

  22. You've misunderstood by SimonK · · Score: 2

    The point of encapsulation is not to slavishly conceal all the data possessed by an instance of a class. In many cases its quite legitimate to expose functions to get and set data values - although I can provide you with much abuse of programmers who do so thoughtlessly. Properties (as in C#) just provide a formalised mechanism for doing this.

    If this isn't clear to you, we need to examine what exactly encapsulation is, and what it is intended to accomplish. To do that, we need to do right back to the roots of modular programming, and the concept of coupling. Modules - including classes for these purposes - are meant to be decoupled from one another. Thats just a smart way of saying that a module should only depend on the interface of any any other module, and that interface should support all the possible alternative implementations. Decoupling matters because it allows the implementation of each module to vary independently of the rest.

    Encapsulation is just part of the OO way of allowing for decoupling. The implementation varies between OO languages, but the common theme is that they place what functions and data are exposed by a class under the control of the developer of that class, rather than its user. So, for instance, while in C if my struct foo has a field bar, anyone who imports the definition of foo can access bar, OO languages provide mechanisms by which the person responsible for foo can prevent this. The point is not "data hiding" as people often naively say, objects very frequently expose data (although not actual fields) but hiding of the details of how foo is implemented.

    Now, you're claiming that C#'s property mechanism removes this useful property of OO languages. That is not true, and won't become so regardless of how often you repeat the assertion. Much though I dislike the language and the politics behind it, I'll stop short of endorsing false statements about it.

    Developers of C# classes do not have to expose their fields as properties, nor are they committed, by exposing a property, to keeping the corresponding field in place. Thus, when I write code that makes use of a property, I am not preventing the developer of the class from varying its implementation. Both encapsulation, and the real reason for having it - decoupling - are still there.

    Reread the admirable definition of encapsulation you posted: objects publish their interfaces, and contain all the code and data needed to implement those interfaces. That is just as true in C# as it is in Java or C++.

  23. .NET, The _Next Great Niche_ by smagruder · · Score: 2

    .NET (+ C# & CLR), dead on arrival with CIOs, my consulting customers and smart developers everywhere. Besides, Borland beat them out the gate with web services, which is a good implementation to boot (as always with Borland development tools). And Java's slant on web services is ramping fast with the help of IBM and other players.

    --
    Steve Magruder, Metro Foodist
  24. C# confirms the brilliance of... by smagruder · · Score: 2

    Borland Delphi. I'll stick with the best Windows *and* Linux tool on the market. My small business and non-profit customers don't give a whit about what tools I use in my work.

    --
    Steve Magruder, Metro Foodist
  25. OK, Well done. by Martin+S. · · Score: 2


    Ok, I accept that i was mistaken over 'broken encapsulation'.

  26. you dont get it (its about speed + XML) by johnjones · · Score: 2

    sun thank you for java I personally like it and use it where I can

    BUT
    the CLR is well designed + engineered
    for speed and interoperability

    Perl.NET VB.NET TCL.NET and even C++.NET will all work and thats what we have around today think interoperability or in Microsoft terms BACKWARDS COMPATIBILITY

    it matters

    and with a transport stream that is XML what matters is tools and those tools will be on windows

    java's nice but until I see a tool that can debug C and java
    forget about it MS wins the services of the "net"
    (there are alot more fields that java wins in like phones and TV which is nice for java and means that it does not go away any time soon)

    regards

    john jones