11 Comments

Summary:

A couple semesters ago, I took a college Visual Basic class. It wasn’t bad – your typical programming course, and I’ve had my fair share of those. I liked VB.Net, because it was easy, and had a nice, clean object-oriented syntax. Basically, you type stuff to […]

A couple semesters ago, I took a college Visual Basic class. It wasn’t bad – your typical programming course, and I’ve had my fair share of those. I liked VB.Net, because it was easy, and had a nice, clean object-oriented syntax. Basically, you type stuff to the effect of “window.close”, and these simple statements can control quite a bit. Granted, comparing VB to Obj-C isn’t exactly the right idea, but the development environments that they use are what truly counts. If you’re using Visual Studio with VB, it’s pretty easy to get started laying out the form, and sending things back and forth between the objects on-screen. On the other hand, getting up-and-going with Cocoa can take a bit of a leap. I read a number of articles when I started out, and they were all mentioning, in some way or another, that Cocoa has a bit of a steep learning curve. Oftentimes, you must understand a lot more to do the same that VB would do.

So why would we even bother learning it then? If it’s so hard, what are the benefits of Cocoa? Well, after playing with VB, I realized – this is basically just a simple document-writing app language. It isn’t going to program any big games or intensive stuff. Cocoa, on the other hand, can do quite a bit. Once you’ve mastered the basics, you can paruse through Apple’s online documentation, and see how to use QuickTime, audio, web browsing, and even an iSight in your app! Visual Basic is clearly not as powerful as Cocoa and many other programming languages. And, yes, you can use Java with it, but it’s not really a good idea, as Aaron Hillegass has often said.

I’ve put out a couple apps so far, so I know what’s involved in getting Cocoa to do what you want. For a while before Tiger came out, bits of info were coming out that Apple had developed a bunch of cool new stuff in Tiger. It wasn’t until Tiger’s actual release that we got all of the scoop. Now, if you check Apple’s online documentation for developers, you can see how much has changed. Quite a few things are listed as being depreciated, in favor of newer methods, specific to Tiger.

Now that Tiger has arrived, Cocoa is getting even stronger. If you’ve purchased it, you’ve most likely recieved the Developer Tools CD with it. These have been free with every copy of Mac OS X for a while, and I hope Apple continues the trend. Also with Tiger was something that impressed me – QTKit. QTKit is most obvious in the new QuickTime 7. It’s pretty neat, from what I’ve played with so far. Developers no longer have to call Carbon for some things with QuickTime, and makes those simple things so much easier! This shows that Cocoa isn’t going away any time soon, and Apple is working to make it better.

In a future article, I’ll be going in-depth on some of the details – Cocoa has a lot of cool stuff behind the scenes. In the meantime, a good place to look for info is on http://www.cocoadev.com. It’s an awesome wiki with a lot of community involvement.

  1. Steven Marshall Monday, May 16, 2005

    I’m not sure I agree with various portions of this article…

    For one thing, you seem to confuse VB and VB.Net (or treat them as if they are one and the same), which are (despite their similar appearance) two very distinct languages – VB.Net is newer, has more object-oriented features, and compiles into .Net assemblies; “classic” VB is older, and compiles into native machine-code assemblies.

    Further, you seem to be confusing what you’re comparing to – one minute you’re comparing to Cocoa – an application framework – the next, Object-C, a C-based programming language.

    If you’re going to compare learning Cocoa to anything, you should compare it to learning GDI+ and COM, which are frankly vast.

    Well, after playing with VB, I realized – this is basically just a simple document-writing app language. It isn’t going to program any big games or intensive stuff.

    You say it best yourself – you were “playing” with VB. You can do everything you mention and more with both “classic” VB and VB.Net, if you know how.

    Visual Basic is clearly not as powerful as Cocoa and many other programming languages.

    First, as I’ve already said, Cocoa is not a programming language, it’s an application framework. Second, VB, if you know how to use it and know the environment in which you are working, is just as powerful as Object-C, C#, or C++ (although this obviously depends on the nature of the task, but, for the level of work you’re talking about, the difference is negligible).

    Share
  2. Jason Terhorst Monday, May 16, 2005

    I understand that there is a difference between VB and VB.Net, but it’s easier to just type “VB”. And, if I recall correctly, Microsoft’s efforts have been focused on getting VB6 developers to move up to the new environment.

    And even learning VB.Net, my professor admitted, may not be what the student wants, as it’s limited in what it can do. It’s not powerful enough to call up things like OpenGL at a decent speed to make the next Halo running at 100+ FPS. At our college (which gets hand-outs from M$ for computer tech), the students leave disappointed from the programming classes, because VB.Net stinks for heavy programming, and the teachers don’t cover deep enough concepts in C++.

    And when I use the term Cocoa, I am referring to using XCode, IB, and Objective-C together, because that is the path that Apple intends for Cocoa development. Any other path, including Java, isn’t really Cocoa, since Java and the like require bridges or porting tools to do the job.

    Share
  3. Steven Marshall Monday, May 16, 2005

    And even learning VB.Net, my professor admitted, may not be what the student wants, as it’s limited in what it can do. It’s not powerful enough to call up things like OpenGL at a decent speed to make the next Halo running at 100+ FPS.

    I’m sorry, but this is total FUD. It’s as powerful as C# which is as powerful as C++.
    The only difference is that most people (and it sounds like your professor is included in this number, I’m afraid) aren’t competent enough coders to understand how to work in the language.

    “It’s not powerful enough” is often an excuse given by people who just aren’t capable in any given language environment which is synonymous for “I don’t know how to…”. C# and VB.Net have this stigma at the moment, but, as many of my C++ coding friends have discovered of late, C# (and, as they’re both just wrappers for MSIL, VB.Net) can be as powerful and fast (if not faster, in some situations, of which complex 3D rendering is one – I know this from personal experience) as C++/OpenGL.

    I don’t mean to sound cocky and full of it, but it really does sound like your professor doesn’t know what he’s talking about.

    Share
  4. Steeve Morin Monday, May 16, 2005

    I would have to agree with Steve on this.
    Being a C#/C++ for quite a time now, I can say that yes, doing anything in C# can’t be slower (if not faster) that in C++.
    Talking about OpenGL, which is a C API, I am sure you CAN make a game run a 100+ fps with C#, hence VB.NET (it can be a little slower due to the language itself, because the compiler can optimize fairly more with C#).
    In fact, Age of Empire 3 is done in C#.
    Also, you can’t compare VB.NET and Cocoa. But you can compare .NET with Cocoa.

    Share
  5. Lets get real here if you knew anything about programming language and software design you would know that there is a real issue. As someone who has DESIGNED processors, written assemblers, and even done some compiler work. It is a FACT, yes a FACT that C is more optimizable and can be made to run faster on most if not all processors than C++, C#, or any other OO language especially those that are BASIC based. Most OO languages suffer because of their interface niceties, compromises like C++ clearly are faster than Smalltalk, Java, Obj-c, or even your beloved C#. Clearly both MS and apple go through great lengths to make the performance competitive with C and get about 80% of the performance when used as an OO language.

    With this in mind I know it is very difficult to optimize BASIC. Clearly MS has vast resources and there is no reason simple code should not run as fast as C, or that windows calls will not be as fast because they are WRITTEN IN C FOR A REASON. That said complex programs will be SLOWER in BASIC for good reason. Also the language lacks many features which make programing a large project easier.

    MS has a way to go before .NET can stand up to cocoa it is simply put the cleanest, nicest, most complete framework out there. For example it is the environment for OS X, where as in XP things involving lower level OS access are difficult and from what I have seen of managed C# it is not terribly clean.

    While .NET and C# are good steps, I will not deny that, MS needs to say enough and make NT as good as it can be by dumping MFC, Win16, Win32, the whole DLL mess and make a nice clean OS. Hell if apple can do it why can microsoft not just say this is the new way, lets run the old software in a sandbox that will go away. Also drivers in the user space might be good given the windows driver issues. any who here is the answer Cocoa is better because it works with the OS and has a far superior object model, Cocoa allows code to be written faster than anything else and allows for easier maintenance of said code.

    Share
  6. Steeve Morin Tuesday, May 17, 2005

    For example it is the environment for OS X, where as in XP things involving lower level OS access are difficult and from what I have seen of managed C# it is not terribly clean.

    This is not true. Let’s take a simple example: list all NICs in the Computer, and retrieves infos about them.
    public void ListInterfaces()
    {
    NetworkInterface[] netInterfaces = NetworkInterface.GetAllNetworkInterfaces();

    foreach (NetworkInterface networkInterface in netInterfaces)
    {
    IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();

    Console.WriteLine(" Name : " + networkInterface.Name);
    Console.WriteLine(" Type : " + networkInterface.NetworkInterfaceType);
    Console.WriteLine(" Speed : " + networkInterface.Speed);
    foreach (UnicastIPAddressInformation ipInfo in ipProperties.UnicastAddresses)
    Console.WriteLine(" Address : " + ipInfo.Address.ToString());
    Console.WriteLine(" Operational Status : " + networkInterface.OperationalStatus);
    }
    }

    You clearly see that it is REALLY simple to access low level OS data.
    Is it clear, indeed, that C++ is slower than C, OO programming has a cost. But, let’s compare what’s comparable here.
    You seem to forget that C# is not interpreted, but is recompiled to native code. That said, MSIL itself is type and objet aware. This results in a BETTER optimization at the end. Of course, program written in pure native code, and optimized for a specified processor WILL run faster than anything else. But you have to think that coding is just NOT done for one processor.
    Let’s say you enable SSE optimizations on your C++ project. Then everyone without SSE won’t be able to run the program. In C#, the program is recompiled (JITed) for the specific processor. You know where I wanna get.
    And from what I’ve seen (running the tests myself), C# is 5% slower on matrix multiplications than C++. And that 5% is completely known, if you know .NET.
    You see, the problem is, from all the people I’ve heard talking about .NET, and spitting on it, NOT A SINGLE ONE didn’t even knew enough to have a proper opinion of it. They stick to garbage collection and MSIL (like I did some time ago). But if they knew more, they wouldn’t talk nonsense.
    What I’m saying is, for sure Cocoa seems cool, but if you’re saying that it’s the best, you should knew .NET better before talking out loud.

    Share
  7. Steeve Morin Tuesday, May 17, 2005

    Talking about dumping Win32, it is simply nonsense. Don’t forget that Microsoft and Apple DOESN’T HAVE the same customers. In fact, A LOT of companies running Windows wouldn’t be happy if Microsoft decided to dump Win32, MFC or Win16. Before they are A LOT of people still running it nowadays.
    Talking about drivers in the user space, this is completely crap. You can’t allow access to critical hardware from the user land, this is a big security hole. Anyway, XP is already supporting user space printing drivers, but they are not really drivers. They are using an special API to use the microsoft generic printer driver.
    Btw Longhorn will run a special code that will allow the system not to crash is a driver for non critical hardware crashes (I’m not saying you won’t have a bluescreen if the display driver crashes).
    Also, why dump DLL ? After all, I don’t see why .so files are a problem. Why would DLLs be one ?

    Share
  8. What’s wrong with DLL’s? Ask Microsoft:

    There’s also an excellent Wikipedia description of the types of problems that DLL’s can present:

    Share
  9. Wow, fast forward three years since this article and Cocoa is just now appearing on the landscape where programmers are needed. I guess it didn’t take off quite that quickly but it may still prove a strong language in the future.

    Meanwhile, .Net has gone steller with new features and functionality. Mainly used for business but also for everything else (with success) it far outweighs Cocoa in usage (real life) and usefulness.

    Also, look out for the new cross platform funtionality .Net will be taking on soon. It seems .Net was always designed from the start to support multiplatform usage as they subscribed to the ECMA international standards when they created their syntax, semantics, assembly format, core namespaces, and mechanics required of a runtime engine to support .Net assemblies on other platforms. That means it could appear on Mac OS X, Linux, Unix, BeOS, Solaris, etc.

    The only weakness in .Net is all that bad press Vista is getting which puts a stain on all MS products.

    Share
  10. loosely_coupled Saturday, July 19, 2008

    It is now July 19 2008.

    As far as the original arguments, I agree with both “Steves” that the author doesn’t (or didn’t) appear to really understand the relationship among VB, C#, .NET and the CLR. Although lacking some language features of C#, VB.NET does compile down to the exact same MSIL code as C#. Now there may be certain situations where the C# compiler is able to make MSIL optimizations that VB.NET can’t, but as far as I’m aware, for most operations, the MSIL from compiled VB.NET is just as fast as the MSIL from C# (and in fact, many times it’s identical code.) So there shouldn’t be any reason that applications written in VB.NET would run significantly slower than C#, including apps utilizing DirectX/OpenGL.

    As far as “Comp Eng” saying BASIC-based languages are hard to optimize, I assume that doesn’t apply (or apply as significantly) to VB.net because it compiles down to MSIL, and is not interpreted in a BASIC runtime. I’m unsure of this, as I don’t have the requisite experience to be completely confident. This person does seem knowledgeable, but as “Steeve” pointed out, it appears he doesn’t have enough experience with .NET to be able to legitimately criticize it with statements such as: “For example it is the environment for OS X, where as in XP things involving lower level OS access are difficult and from what I have seen of managed C# it is not terribly clean.”

    As far as his statement: “MS has a way to go before .NET can stand up to cocoa it is simply put the cleanest, nicest, most complete framework out there. “, I would have to say that it is definitely subjective, although not having significant experience with Cocoa, I’m not one to judge.

    I have heard that Apple’s development platform of Obj-C/Cocoa/XCode is indeed excellent once you get your head around it — very modern, clean, and functional. However, most of the appraisals come from C/C++ guys, So I don’t know how that perspective would change through the lens of a .NET/C# developer.

    Either way, as “Paul” from above refers to, Mac OSX and therefore Obj-C/Cocoa is *definitely* going to become very popular, with the latest report showing Mac computer sales representing over 8.5% of the market, and iPhone 3rd party development taking off. And I only expect that growth to continue, especially in light of the disaster of MS’s Vista release.

    I’m definitely pulled between the two platforms. I’ve only recently become a fledgling software developer, and I have mostly been working with C#/.NET (in addition to some Python) and Server 2003/2008. At the same time, I’ve become very turned off by Vista and Windows in general, and will definitely be running OSX soon, virtualizing XP for development. I know the Mono project has come a long way in getting C#/.NET onto Linux and OSX, but it is still incomplete, very buggy, and hard to interface with the native GUIs. As OSX becomes more popular, I really hope either the OSS community and/or Microsoft is able to get C# and .NET to be first class citizens on OSX, so developers are able to cross-develop much easier. That would be a win for everyone.

    Share

Comments have been disabled for this post