Is Objective-C the same as C#

Discussion in 'General Mac Discussion' started by VegetaPunk, Mar 21, 2003.

  1. VegetaPunk macrumors 6502

    Joined:
    Dec 30, 2002
    Location:
    AZ
    #1
    Is Objective-C the same as C#
    are these the same and just different names for each other??
     
  2. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #2
    NO.

    OBJECTIVE-C is much more powerful, even though its older.

    C# is Microsofts' cheap copy of Java with all the security removed...anyways, they are similar in someways (mostly cause Java borrows from Objective-C)...

    I like to call it D-Flat
     
  3. VegetaPunk thread starter macrumors 6502

    Joined:
    Dec 30, 2002
    Location:
    AZ
    #3
    Thanks

    Thanks someone told me that they thought that they were but anyways thanks again
     
  4. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #4
    Heh. .NET is not such a weak attempt. From what I've heard it ranks alongside Cocoa as one of the nicest to use APIs ever. C# also fixes some of my personal problems with Java, although it apparently maintains some of the weaknesses of C.

    In answer to the original question, they're almost completely different (although with very similar syntax).
     
  5. dricci macrumors 6502a

    Joined:
    Dec 15, 2001
    #5
    And Java runs on just about anything, where C# will only run on.. well I think you can figure this out :-D
     
  6. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #6
    That wouldn't be nice to a project called D-Flat, though. That was a textual user interface (TUI) plus IDE for C interpreter by Al Stevens of DDJ.

    Objective-C was written by Brad Cox back in the mid-1980s and takes a lot of what it is from Smalltalk but looks more like C.
     
  7. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #7
    I didn't say .Nyet I said C#. Perhaps it is good as cocoa, but its no Java replacement. Also, Cocoa is basically an open system (OpenStep Based, so you can use GNUstep on Linux to run some recompiled cocoa apps) while .Nyet is owned by MS...only C# is open, and not yet in GCC (iThink) so I don't really care to try it out.
     
  8. parenthesis macrumors member

    Joined:
    Mar 22, 2003
    Location:
    Here and there
    #8
    eeww

    I'm taking C# as a tech elective at college. I really don't like it. C++ was easier to understand, has better security, and I can actually use C++ on my mac.
     
  9. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #9
    C# vs. Java (and the rest) myth debunking...

    As others have said, they are not the same language.
    Objective-C and C# have two entirely different purposes. Neither are more powerful than each other. They have their own merits.

    C# isn't a cheap "copy" of Java. Yes, C# is similar to Java, but not everything that went in C# is directly from Java. What do you even mean by "security removed." Security isn't a language's concern, it's the runtime's and programmer's concern. In fact, .NET run time is more secure than plain C/C++/traditional binaries because .NET is run in a managed memory pool and is buffer-overrun resistant.

    I will point out the differences between Java and C#:

    foreach:
    Enums:
    Therefore, the Java version is less type-safe because it allows you to accidentally assign wall to any integer value without the compiler complaining. Plus, when debugging the Java version, you would get the integer value, instead of a human readable one, like in C#, it would return the enumeration values like "North", "East", etc. instead of integers they return.

    The above quoted examples are taken from Ben Albahari's "A Comparative Overview of C#". He also has a list of other examples, if you would bother. Albahari is one of the authors of C# Essentials.

    Most languages are mostly similar, C++ adds on to C, Java borrows from C/C++, objective-C borrows from C and Smalltalk, and so on. However, most have their own purposes.
    So can C#. C# is just a language, not a binary/run time. In fact, you can create and run .NET-compiled binaries on Mac OS X and FreeBSD with ROTOR from Microsoft and on Linux with Mono, the GPL'ed .NET framework for UNIX. In fact, .NET is both language and platform independent. Well, technically, so is Java, but not many people really use Jython, etc. Very specific niche.
    .NET isn't even owned by Microsoft. The trademark, perhaps, but Microsoft .NET is Microsoft's implementation of EMCA-334 (C#) and ECMA-335 (CLI). Who cares if it isn't in gcc. gcc is perhaps the worst compiler when it comes to usability and user intuitiveness. Plus, it's so damn slow. In fact, you don't need gcc to do .NET, nor do you need Microsoft compilers. You can use Mono on Linux.
    Better security on what? Please refer to my above comments. What if you make a mistake in C++ (a buffer overrun), the compiler wouldn't complain, and congratulations, you have a security flaw! Besides, you CAN use C# on your Mac.

    Moral of this: different languages and programming platforms have different goals. Choose the best one that fits your own goal.
     
  10. parenthesis macrumors member

    Joined:
    Mar 22, 2003
    Location:
    Here and there
    #10
    What compilier do you use for C# on the mac? I was always told that you couldn't.

    Also, I remember reading somewhere (C|NET news more than likely) that .NET Programming Tools have many security problems.
     
  11. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #11
    C#/.NET on Mac OS X

    You would use ROTOR (download page) from Microsoft/Corel.

    Instructions on how to install it are available here.

    I've heard that ROTOR compiler/runtime is very slow on Mac OS X, but I've never done it personally, so I couldn't tell you. Maybe it was the guy's lowly 400ish MHz G3. ;)
     
  12. parenthesis macrumors member

    Joined:
    Mar 22, 2003
    Location:
    Here and there
    #12
    Dank

    *bows* dank (Thanks)

    Now I can use my iBook in programming again! whoo
     
  13. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #13

    Um, dot.net is a framework. Hence the moniker ".NET FRAMEWORK"


    Yeeaahhh, so what?
    Adding a little more simple logic on the programmers' end can get the same results...
    Big deal!

    ................GCC can be wrapped to a GUI (like Project Builder), and if it is so bad then why is it that all those MS-beating Linux benchmarks (Linux OS) were compiled on GCC, yes GCC might not be as fast as some proprietary junk from Intel (cant compile linux with it...) or codewarrior, but its not that bad....and who want to use ROTOR (hint. YOU MAY NOT WRITE ANY COMMERCIAL APPS WITH IT) and MONO is not done...who in thier right mind actually beleives MS will stick with thier published standards (hint. they didnt if anyone remembers COM and COM+, JAVA etc) I have learned to stay away from MS as much as I can.


    Exactly right!
     
  14. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #14
    The original author didn't even bother to put "framework." Yes, .NET is a framework, but so is Mono's .NET implementation. Therefore, .NET isn't wholly owned by Microsoft. Just the trademark and it's few classes which are proprietary to Windows (i.e. Windows.Forms) but that isn't stopping Mono from doing a Windows.Forms compatibility layer. It's completely possible.
    It is a very big deal when working on a large project. Why the hell should I give arbitrary numbers to something and have a million others like that, oh, which property should it be? Wasn't 4 = North?

    Or suppose you have a large enum? It's very time-saving. Time == money == true.

    I mean:

    myObject.direction = North;

    is much more meaningful than if it were to = 1.

    You're comparing it as if it were UNIX with TWM as the desktop OS for everyone instead of Mac OS X's Aqua.

    In short, why not include this useful feature. Simplicity is good.
    Yes, gcc may be wrapped with an UI, But I haven't seen a *GOOD* IDE for UNIX/Mac OS X (with an exception of CodeWarrior) that clearly competes with Visual Studio .NET. Show me one that is as good or even better than Visual Studio .NET and proves to be more productive for me, I'll switch. It's just more intuitive and efficient, in my opinion. Whatever floats your boat.

    And actually, you CAN compile Linux with icc, it has been done before.

    Microsoft will stick with .NET and it will be compatible. Compatibility within the .NET Framework is awesome, its versioning control is much better than Java's, IMO. In fact, anything .NET can act as a COM object, so even more backwards compatibility. Hell, you can even use a COM object in .NET.

    Remember, Microsoft brought up a lot of standards. SOAP wouldn't be here if it weren't for Microsoft, and so on.

    .NET is the future of Microsoft.
     
  15. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #15

    This is completely irrelevant as long as MS doesn't release anything (thier key apps) for linux. And just because .NET features are being implemented in MONO also doesn't mean that developers would even care to release thier apps for Linux/Unix...notice the lack of apps that are compiled with the WINE librarys, or the almost non-existent library of cocoa apps on GNU-Step/Linux...


    Yes, it is more meaningful, but any programmer worth 2cent can get around that pretty easily.

    Compatibility within .NET framework awesome? Yea....so. Thats like saying the compatibility within the cocoa framework is awesome...whats your point????I would consider COM objects in .NET pretty much a necessary item...


    Yes, it is. And 15 years behind Steve and Avi LOL...
     
  16. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #16
    .NET gibberish

    Wrong. Not irrelevant at all. If the Mono guys can do Windows Forms compatibibilty pretty damn good, applications written for Windows Forms in .NET should run perfectly. It's like developing Java with Swing, a developer may not care that it works on Mac OS X with no change, but the end user might care.
    Let me ask you this: why the hell should we get around it? Why can't we simply have it already implemented. Saves time, for Christ's sake!
    Yes, compatibility within the .NET framework is superior to Java:
    Much better. Plus it's irrelevant to Cocoa/Objective-C. Objective-C compiles to pure binary, not to an intermediate language.
    Right, 15 years behind when Apple doesn't have this kind of technology. WebObjects is badly outdated as it is the only thing that Apple offers that is similar to the .NET Framework, and it's only a fraction of what the .NET Framework can do.
     
  17. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #17
    -SHOULD- notice that word...you think any company is going to put thier chances on SHOULD WORK??? Well, I guess shooting in the dark is par for the course when dealling with MS "standards..." forms are just the begining...ask yourself this: if MS was so interested promoting real compatibility why they would keep thier jewels to themselves? Gimeabreak.

    Just like the internet today...thanks to MS. (They don't care if it doesn't work on Mac OS X, we have to shoot into the dark to find ways of compatibilty with Windows Specific JAVA and other IE only garbage)


    Like what, a minute?

    WebObjects is just a server side application server, it wansn't meant to cover the area .NET is. NeXT had OO technology and framworks like .NET way back in 88, tho it wasn't meant to compile to an intermediate language, you can use Java-in-cocoa now. And OpenStep was around along time ago...

    Secondly, you can bet that once MS drops Java and includes .NET only, websites will use .NET and "the rest of us" will be screwed. MS is very smart about these kinds of things, they only give enough information away to get you in, and once you fall in line, they pull the rug out from under you and make another "extended" implementation that locks you in to to thier system. They did it with dos, office, java, IE, COM, and if history is any indication, .NET will be next. I am tired of it. Why should we sell ourselves to MS's reinvention of the wheel when we already have the same thing, and its open and supported by multiple vendors...

    Well, I shouldn't count on that...a monopoly can do wonderful things for adoption rates...
     
  18. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #18
    .NET gibberish continuation

    Yes, should. Any company could take chances by making sure it works and providing support. In fact, you don't have to use Windows Forms to use GUI on Mono. There's GTK# and QT#.
    You're twisting my words there. I said the developer itself does not care if it works, not the opposite. If product X was designed for Windows, but works perfectly on Linux, both developers and users benefit. Developers get more money, users can use the programs they need.

    Yes, thanks to Microsoft we have SOAP/Web Services, DHTML, CSS, etc.
    Have you ever worked on a large scale software project? A minute for one occurence, perhaps, but when there are several millions of lines of code. Multiply that by a large n. Hours, weeks can be saved. Which results in a lower Time-to-Market span.
    Yes, .NET can do server side stuff. Ever heard of ASP.NET? Far more powerful than WebObjects.

    And guess what, OO has been around since the 1960s, so it wasn't innovative for objective-C. It's like blaming Sun for copying objective-C because OO was a good programming pratice.

    Thank you for correcting me on Java-with-cocoa, I had completely forgot about that. Although I was focusing on objective-C, I will accept Java.
    In case if you haven't listened to the news, Microsoft is forced to include Sun's Java Runtime. This is a good thing, IMO. Only appeals will tell if the law will still enforce the Sun distribution requirement.

    And yes, you do get multiple vendors with .NET. Mono, dot GNU, ROTOR, Microsoft .NET, etc.
     
  19. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #19
    But there is no underlying motivation to do so. Until DELL, or HP start selling millions of linux on the desktop, no one will really care. I've seen this kind of optimism before...logic does not play out it the real world.


    Not if its unsupported by the company writing the software. If you call in for support and they ask you questions and your answers are different with what they expect and they ask you "are you running on Windows?" and you answer "no" they will say "I am sorry we don't support productX on platformY, you use it on your own risk, if you want support use it on windows."

    The point is: if the behavior of their .NET applications are guaranteed by MS in Windows, but not in any other implementation, don't expect corporation to support linux/OS X anywhere in their workplace like they do windows, where the real money for software lies...in large corporations where you can audit licenses etc. The only chance OS X may have is if MS/MBU releases a fully supported "MS-Backed" .NET implementation, which is what I heard somewhere they were looking into.

    It is over simplistic to think "If I build it they will come." It is more like "If I have 90 percent market and full technical support they will come."

    Yes, and web-services never existed before MS came along...we were just talking about webobjects.

    Yes, I have, but at least I can run WebObjects apps on any certified J2EE server... am not locked into IIS on Windows.

    Perhaps....

    Yes, but no one had implemented it as well as NeXT back in the 80's until recently with .NET...
    I am not blaming them, I just wonder what took MS so long.


    ROTOR is useless. dot GNU is unfinished, MONO is unfinished, only MS is at the plate. Make no mistake .NET will be making changes and taking names later, while everyone else tries to keep up with them. Just look how long it took apple to release 1.4.1 because Sun doesn't support OS X! They will always be lagging behind MS, and that is unacceptable for businesses, especially as they get larger (they are more conservative).

    And I have little faith in McNealy, he's just a litigation happy CEO who got screwed by MS and thinks 1bn dollars really gonna hurt MS... Its not.
    What MS says, vendors do. Its that simple. Its reality. At least steve is able to push (Apple/ex-NeXT) hard enough (probably by screaming at them..) that a tiny company (compared to MS/SUN/IBM) is able to so well against all odds...dropping the law-suit apple had with MS was his best move next to the iMac.
     
  20. eric_n_dfw macrumors 65816

    eric_n_dfw

    Joined:
    Jan 2, 2002
    Location:
    DFW, TX, USA
    #20
    Java typesafe enums

    FWIW: How I do enums in Java:
    Code:
    class Direction
    {
       Static Direction NORTH = new Direction('N');
       Static Direction SOUTH= new Direction('S');
       Static Direction EAST = new Direction('E');
       Static Direction WEST = new Direction('W');
    
       private char type;
    
       private Direction(char type)
       {
          this.type = type;
       }
    }
    . . .
    if( theDirection = Direction.NORTH )
    {
        . . . 
    This gives you complete control over the enumeration and keeps the next code geek from gloming an int or char in the place of the enum.I believe I got this from Effective Java Programming Language Guide by Joshua Bloch.

    Given, this is not as simple as what you've described for C#, but I've always found that on large, enterprise OO based applications, coding time is irrelivant. Valuable requirement gathering and design are where most of the time is spent. Once this class is implemented, you just use it.

    Just curious, can C#'s enums be non base types? For example, is this possible (forgive the syntax, I don't know anything about C#):
    Code:
    public enum Foo {Alpha=new AlphaClass(),
       Beta=new BetaClass(), Gamma=GammaClass()};
     
  21. MacCoaster macrumors 6502a

    MacCoaster

    Joined:
    Jul 15, 2002
    Location:
    Washington, DC / Rochester, NY / Lexington, NC
    #21
    .NET gibberish continuation continuation ;)

    If there is no underlying motivation to do so, then why would all those open source .NET Framework projects be worked on at a very vigorous rate.
    Exactly, it's all about support. If product X isn't supported in platform Y, but works perfectly. Neither sides would care.
    About the guaranteeing: not even the GNU GPL provides guarantee that software X will work or not. So it's irrelevant. However, as you have pointed out, it IS relevant in the business world. But remember, someone could be Red Hat for Mono, which Ximian is exactly for. Ximian is most likely providing support for Linux (thus guaranteeing that a designed-for-Linux .NET program will work 100% as it should on Linux).

    Did you know that even Red Hat will demand its rights to audit the licenses for its enterprise suite of Linux operating systems. Wouldn't we agree that this is, uh, weird for a Linux company? ;)
    Very true.
    Au contraire! Web Services/SOAP was a standard even before Microsoft .NET was released, there have been several server-end applications/servers that supported Web Services. Microsoft just took time to make sure they don't screw up majorly this time.
    Bzzt. Wrong again, sorry bud. You're not locked into IIS, well, actually for now, sure, that I know of. However, I remember Microsoft claiming they are going to release a full release of ASP.NET for Apache/UNIX support a while ago. Plus, it's entirely possible to run ASP.NET on Mono/ASP.NET plugin for Apache. Of course, it's extremely buggy, but hey, it's coming. [btw, I'll look for the URL about Microsoft and Apache/UNIX and post it later, I'm a bit tight on time right now.]
    Again, it's like saying what took Sun so long to get something similar to objective-C. I'm confident that Microsoft wanted Java to prove itself reliable before they do one, especially so they can see the flaws of Java and prevent these flaws from occuring in .NET. objective-C may be the first of it's "genre," but is it the most popular? It probably has many flaws (example developer's opinions) many find annoying so they prefer Java/C# to objective-C. Microsoft likes to see something proven first and find its flaws and make a better product to make the world more competitive. Of course they have that damned monopoly. ;) Also, IIRC, Microsoft worked on .NET for a while, I heard 10 years, but I'm not sure about that. I know they announced it as NGWS in 2000.
    Useless for what? So are you saying the entire open source community is useless because they're way behind commercial UNIX but copying them and trying to catch up? What's the difference? Wasn't open source mainly for research/students/etc. with gaining corporate recognition.

    By the way, very good point on Sun! Yes, very unacceptable. But remember, companies exist to earn money. Sun has to, even when Java is literally "free." Sun is known to break things in Java to force people to upgrade, just like Microsoft. All about the money, and unfortunately, open source won't change that, IMO.
    Whew, someone who finally agrees with me about McNealy. :D I've said it myself, and I will say it again, Sun is shooting themselves in the foot.
    Very good points! 100% concur.
    Thanks for the hack. I'll have to take that in mind the next time I consider an Enum in Java. Yes, it's not as simple as C#. I think Microsoft emphasized that C# is really all about, as Ralph Waldo Emerson would say: simplicity, simplicity, and simplicity!
    Now that I think about that, I don't think so. I believe Alpha, Beta, and Gamma all have TO be integer. And of course, classes can't be integer, am I wrong?
     
  22. Fukui macrumors 68000

    Fukui

    Joined:
    Jul 19, 2002
    #22
    Last post on this subject...

    Because they know from the past that you can't fight Microsoft and win, you can only assimilate and play nice, otherwise you just become another bug under their shoe. Its called motivation by necessity: they have no choice.

    Thats why there are companies like Redhat, Ximian, IBM, and Apple around to provide guarantees of support for their Linux/Unix implementations and a minimum level of reliability that can be expected from these companies. I agree.
    But, I think its just going to be fun watching them chase the coattails of MS every time they alter their .NET implementation on their own whim....once MS gets the support they need, they won't care whether those other companies complain to the Pope!


    We will see won't we.

    Well, according to you post I am right. And you don't actually believe that they would support apache as well as IIS...do you? They are not stupid enough to give a serious competitor a leverage against them, just bones to "hungry dogs" as far as MS is concerned.


    Um, not so sure about that, Win95 anyone???
    How about IE 1,2,3,4??
    How about IIS 1-5?
    How about WinCE 1 and 2?
    It took MS 12 years to go from win 1.0 in what 83 to win95 in 95 which was still buggy as hell?
    How about Java...they sabotaged that one right out of the bag (hint, anti-competitiveness).
    The only way they got the NT kernel was by letting IBM write it, and MS let them sell OS/2 with Windows compatibility (IBM was so stupid-!!) I don't think they care about competition in the world as long as they are the only ones viable in the end. They got it by default when they aligned with IBM from the beginning. I can guarantee you that if MS didn't have their monopoly from the start, things would be very different. Gates is more of a cunning "strategist" than a technology forecaster: he lets others innovate and then xerox it via monopoly.

    I am sure its been around since at least java was announced by SUN, they got Java in windows because as a monopoly they were the only ones big enough who could make it backfire on McNealy, and pave the way for a "their way."

    No, just ROTOR, it doesn't allow you to run commercial apps, its just a toy. UNIX is gaining corporate recognition because it allows them to compete and not have to reinvent the wheel every time they want to implement a custom solution, and they don't have to bend over every time MS comes over to shove another licensing 6 up their arse.


    No, opensource will not change it, open source will though allow small companies to rapidly develop solutions on top of those open technologies and sell them competitively. It will be similar to how the standard PC is today, not one company has more than 30% of the overall market, hence competition actually exists at lower and lower costs. While Microsoft continually raises and raises the costs because they can. It will not last forever though.

    They are like apple in the early-mid 90's, they need a brain transplant.
     
  23. eric_n_dfw macrumors 65816

    eric_n_dfw

    Joined:
    Jan 2, 2002
    Location:
    DFW, TX, USA
    #23
    Re: .NET gibberish continuation continuation ;)

    I think, if you look at languages and their complexity, you always find that simplicity comes with the trade-off of flexibility.

    • Assembler: As flexible as you can get, also about as complex as nuero-surgery at times too!
    • C/C++/Objective-C: All extremely flexible but can be very complex (i.e. double dereferneced pointers and the like)
    • Java: Somewhat flexible but much easier to code and debug when doing OO (the VM lends a lot to this ease of debugging)
    • C#: ??? Can't speak to this much as I don't know it but it sounds like it is a little easier to use than Java - how restrictive is it though?
    • VB/PowerBuilder/other 4GL-like languages: Extremely easy to learn and use but very restrictive and, usually, slow as they often are interpereted.

      No, they can't. The only reason I've had to use that kind of aproach was when I had a factory class who could return any one (or an array of) of bunch of different object instances. All of which extended a common base class. The "type" class's "enumerations" all were like my direction example exept that they passed a String containing the package.class name of the objects which each enumeration represented into the private constructor. The type class, istelf contained a private Class instance which the constructor set using a Class.forName( passedInClassName). (Exception handling was nessesary to handle missing classes at run time)
      Then, the factory could just ask the type enum for it's Class and could instantiate one of them without having to know anything about the subClasses.
      My desription sucks, it actually ended up very clean and allowed the factory class to be small and easy to understand with very low coupling to the subClasses it was creating.
     

Share This Page