help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C programming


From: Nicola Pero
Subject: Re: Objective-C programming
Date: Thu, 29 Sep 2005 04:06:37 +0100 (BST)

> 'allo,
> 
>       This might be considered off-topic, but I don't know anywhere else
> I should post this to.
> 
>       Is it possible to do any useful Objective-C programming, without
> GNUstep ?

Yes, but you'd end up rewriting your own string classes, your own array 
classes, your own dictionary/hashtable classes ... ;-)


  I'm interested in doing network based programming, maybe some
> curses stuff, interact with some databases like PostgreSQL/SQLite, all 
> on a Linux/NetBSD system.  Objective-C can make use of existing C 
> libraries, yes ?  What advantages do I get from developing on the 
> GNUstep platform versus just using the existing C interfaces ?

You probably want just gnustep-make and gnustep-base.  Ignore everything
else, you only need those two (plus whatever C libs you plan on using).  
With those you get:

 1. a very easy-to-use and very fast building system

 2. a world-class foundation library providing you with all the base
classes you need (strings, arrays, dictionaries, dates, sets, files,
network, etc) ... a fantastic API with a very well implemented and 
very well tested implementation. :-)

The advantages you get by using gnustep-base over using libc directly are
... well for example using strings directly via libc is very cumbersome
and error-prone.  Just appending / comparing / copying / working with
substrings is so error-prone and tedious with pure libc, as compared with
using gnustep-base.

Then when you actually start coding, you'll end up building your data
structures (arrays of strings ?  hashtables ?  etc).  Again, just consider
how tedious (and error-prone) it is to manage dynamically allocated arrays
in libc ... every time you add something to the array you have to check
the size, and realloc the memory if needed etc.  As the data structures
increase in complexity, so does the pain of dealing with all the reallocs
and boundary checks etc. ... and the problem is, if you get one of those 
checks wrong, your program might crash with a segmentation fault!  Those 
crash are often difficult to track and reproduce btw.

If you use NSArray, NSDictionary, etc. instead you get a very fast
implementation that is extremely well-tested, has got a nice API that is
easy to remember and use, won't crash, and will get all those low-level
things done in no time, so that you can concentrate on writing your actual
program (rather than on the details of how to hash strings in your
hashtable or how/when to realloc a hashtable of hashtables).

And yes, you can easily integrate pure C libraries such as network 
libraries or SQL database libraries with Objective-C code.  Using 
gnustep-base doesn't prevent you from doing so ;-)

My suggestion would be for you to try gnustep-make/gnustep-base out an 
write a few programs with it.  If you like it, keep using it ;-)

I personally love them and find them really good tools.

Thanks





reply via email to

[Prev in Thread] Current Thread [Next in Thread]