Difference between [alloc [init]] and [new]



Site Navigation

Is there a difference between these two syntax: [alloc [init]] and [new]. Apple uses [new] when they allocate the memory pool, so why do all developers use the convention [alloc [init]] instead of the short form [new] ?

I tried using [new] and it seems to do exactly the same thing as [alloc [init]]

1. I looked at CoreData as example – it is an excellent implementation but incomplete. If you are creating a data persistence store API, that API has to be able to connect to any back end – eg in .NET one uses ADO.NET which allows you to bind to any backend thus there is a level of abstraction where the developer focuses on creating the business logic rather than the intricacies of connectivity etc. Secondly ADO.NET surfaces up the appropriate methods related to database application development which is 80% of desktop application requirement such as forward cursor, back cursor etc. If CoreData framework is not supposed to be the Framework for such work than which framework does one use ?

2. I agree with you that possibly the time was not right as the power of desktop had not matured to handle the JVM. May be now is the right time. But for garbage collection is not necessarily relegated to just desktop app.

3. Properties – agreed is it candy, but less code and clearer code to read ie less clutter. nothing serious here.

4. As for documentation, I read the “Cocoa Fundamental” that book is exceeding well written as for the other I am not too sure. I am still looking at those docs. Although I do not see a proper sample of each and every class. This is a must when you are on the exploratory ground something I think that VS.NET has done well.

5. The observer pattern is a definite plus and that is how messages should move around!. Binding already is present on .NET. Obviously there will always be pros and cons in either development environment and one has to accept things as they come along.

6. I am actually writing some code – heavy stuff… will push it out in due course and NO I did not say nasty things.. I just expressed my thoughts loudly. I love the MAC platform – I started my career writing dbaseII applications and VISCALC templates on an APPLE IIe! and moved on to writing devices drivers in DOS and then to OS/2 and of course with no recourse to Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *