Monday, 6 June 2011

A look to XCode 4


«Boss, we update to XCode 4...»


If you're an iPhone developer (or a Mac OS X one), then you're using XCode. Recently, Apple released XCode new version (4), introducing a lot of improvements. I list just the more "impressive" and useful.

Refactor

Refactor is one feature I loved in Netbeans and I'm happy to have (finally) on XCode. Select a class name or a class property, right-click and choose "Refactor": XCode will search that word, how and where is used and will replace it, saving a lot of time and boring debug sessions.

New Interface

XCode 4 comes with a new user interface. Still based on Aqua, it looks like iTunes and it's more "rational" and ordered. Even targetoptions are subdivided with a drop-down interface, making easy searching a specific option.

Embeded Interface Builder

The interface builder is no more a stand-alone program: now it's a "feature" of XCode. Clicking on a interface file it will open inside the SDK, showing all informations (connectors, widgets, ecc.) on right side.

Drawbacks - Heavyweight

Obviously, there aren't just good things: XCode 4 is an heavyweight program: on my Mac Book Pro it eats 173MB and slows down my system. It's no a so drammatic, but it's boring.


Drawbacks - New Configuration

Do you remember how you sign your App to submit it to App Store? Well, forget it. Now the procedure is totally changed. Somebody says there's from a long time, but I seriously don't remember it. I don't like the new way to configure build and distribution. Maybe it's better, but it's certanly very different: a "soft" way to learn it would be useful. A good step-by-step guide was written on Stack Overflow.

Drawbacks - Immaturity

XCode 4 comes with a lot of new features. New features means less tests. Less tests mean more problems. I have many examples: with XCode 4.0 was impossibile to upload new binary with the embeded Application Loader. It gives an error related to com.apple.transporter.util.StreamUtil.readBytes(Ljava/io/InputStream;)[B.
I downgraded it to 1.3 version (as you can see here).
Another one was some crashes. Another one is when you "delete" a file from class tree: it's really deleted. No hopes to recover it, neither looking in trash can.
Another one is the mysterious "removed references" in a project. I can't understand why, but almost all references were deleted on a project. VERY boring!


Drawbacks - Slow

Finally (and more important), XCode 4 is slow. Damn slow! And heavy as an elephant. It makes slow my Mac Book Pro 2009 easly. All system suffers this memory-and-cpu hungry program.

Conclusions

XCode 4 has some interesting features, but suffers its youth. Probably this is the main reason for maintain a link to XCode 3.x on Apple Developers site. I hope XCode will be optimized, because its slowness is its main drawback.

Wednesday, 1 June 2011

iPhone Tutorials - "Duplicate Symbol _OBJ_IVAR_"

I am working on a personal review about XCode 4. Please, be patient!

XCode 4 gives me many troubles. The last one was a linker error

Duplicate Symbol _OBJ_IVAR_ a class

What happens?

  • Maybe you declare #import "Classname.m" (with a .m instead than .h)
  • XCode lists "Classname.h" and "Classname.m" two times. You have to "remove reference" for a copy from XCode.

It seems XCode4 gives many problems to iOS developers. I'll talk better in another post.

Tuesday, 19 April 2011

VIM vs EMACS - again


«Two snakes facing each other!»


Looking to my blog statistics, I realized visitors come here mostly because they're looking to "vim vs emacs". It's comprensible: this is one of most (in)famouse computer "wars".
In last months I used a lot VIM, because I had some problems with Aquamacs Emacs. So, I decided to write another post to these two max-weight editors, maybe helping you to choose.

EMACS

I became an Emacs fan since 1999, when I first heard about "a free, open source, configurable, programmable editor". I gave Emacs many tries, just because it was Emacs. But, let's admit it, it hasn't a quiete learning curve. Emacs has more options and controls than an SR-71 and has it's own default settings. This is the "beauty" of Emacs: to discover that a simple function (one-tab if I type tab key, e.g.) needs to be configurated.

VIM

Usually, everybody tries VIM after some frustration with Emacs and find a bit confortable with it. Editing file in a modal program is a bit weird, but become quite fast. You can have problems with some "complex" tasks, such as search-and-replace. To do this in VIM you have to type

:s^$/text to find/text to replace/gc

where, last 'c' stands for "confirm".

Conclusion

When I have to write an iPhone App, I must use XCode. When I'm working on a win32 platform, Notepad++ is the choice. To develop a Java application, I prefer Netbeans (and some friends of mine use it also for PHP development). I admit Emacs or VIM are fundamental to a programmer, but to use them for huge programs could be a delirium. So, as general line-guide I say:

  1. VIM or Emacs are good to write small/medium scripts
  2. For large applications, I'll use a SDK (Netbeans? Eclipse? XCode?)
  3. Emacs with cua-mode is easier than VIM, but you could have troubles with other tasks
  4. Do not be ashamed to use a simpler editor as gEdit, Kate, Bluefish or JEdit. Use what you prefear. A text-editor is just a tool. Real Programmers write programs

And happy programming! :)

Monday, 18 April 2011

Nobody can choose how to trash



Today I read an interesting letter sent from Ted Evans of Techrunch to Steve Jobs. He said


Please give us garbage collection



When you say "garbage collection" you always think to Java, to its slowness and to its inefficency. I think, instead, about days spent to detect a memory-leak error, when I was near to the deploy deadline. Working with iOS is wonderfull, but can also gives you headache if you aren't enough careful. Useless to say, when you have to realize a 4000-rows-of-code in two days, it's hard to be "enough careful"!

Ok, I admit a garbage collector could makes programs slow. But if I could use it when I want and if I could dealloc objects when I want, I could realize a "slow" version in time. Slow as you want, but it will not crash because of memory overflow, segmentation faults, ecc.
In next version, with more time, I could analize the code, optimizing memory use and detecting overflows and errors.
So, yes: I would like a Garbage Collector. But activable only when I want.

PS:
Can you recognize the man on the "wanted" poster on this TechRunch article? Well, our prime minister (I am italian) isn't very admired in other countries