<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
	<channel>
<title>y42 software developer feed</title><link>http://www.y42software.de/index.html</link><description>Latest ideas and thoughts about development of software especially with Cocoa and Objective-C</description><dc:language>(null)</dc:language><dc:creator>info@y42software.de</dc:creator><dc:rights>Copyright 2006 y42 software</dc:rights><dc:date>2006-12-02T20:14:56+01:00</dc:date><admin:generatorAgent rdf:resource="http://www.realmacsoftware.com/" />
<admin:errorReportsTo rdf:resource="mailto:info@y42software.de" /><sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<lastBuildDate>Sun, 30 Sep 2007 18:42:05 +0200</lastBuildDate><item><title>NSConnection and multiple threads (Distant Objects)</title><dc:creator>info@y42software.de</dc:creator><category>Obj-C</category><dc:date>2006-12-02T20:14:56+01:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-5</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-5</guid><content:encoded><![CDATA[Recently I had to deal with an error that was strange:<br />The situation was like this: There are many threads in a server application, for each client one, and there are separate threads for special jobs that kind of run in the background. We use distant objects and hence proxies. Usually communication from the server to the client is done from the thread that was created for this client of the proxy we get when the client registers. We use a NSConnection for this purpose and acquire the proxy that the client is offering.<br />To let our background processes use this proxy I had <em>enableMultipleThreads</em> called in the NSConnection object like the documentation states. But I always got an NSObjectInaccessibleException. Turns out you have to get the NSConnection from the proxy and call <em>enableMultipleThreads </em>there:<br /><code>...<br />&nbsp;&nbsp;NSDistantObject *myProxy = [[myClientConnection rootProxy] retain];<br />&nbsp;&nbsp;NSConnection *connection = [myProxy connectionForProxy];<br />&nbsp;&nbsp;[connection enableMultipleThreads];<br />...</code><br />]]></content:encoded></item><item><title>Attention: You will get back a pointer</title><dc:creator>info@y42software.de</dc:creator><category>Obj-C</category><dc:date>2006-12-02T19:57:58+01:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-4</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-4</guid><content:encoded><![CDATA[Sometimes you forget how old Objective-C really is. Nowadays it is generally considered a bad idea to give a client a pointer (or Object Reference in Java) to an object that belongs solemnly to the client. Usually you would expect a copy - that way the client ensures encapsulation.<br />But what I often stumbled on is that classes from the framework give back pointers instead. So be careful. Those pointers may only be valid a very short time. As an example:<br />You have a popup button and you'd like to change the content. But you also want to keep the selected item, in case it is still among the new content. You do something like this:<br /><code>...<br />&nbsp;&nbsp;NSString *selectedTitle = [[myPopupButton selectedItem] title];   // should make a copy here!<br />&nbsp;&nbsp;[myPopupButton removeAllItems];<br />&nbsp;&nbsp;[myPopupButton addItemsWithTitles: myArrayOfNewTitles];<br />&nbsp;&nbsp;[myPopupButton selectItemWithTitle: selectedTitle];  //will crash here because selectedTitle is no longer valid after the removeAllItems call!<br />...</code><br />The same goes for the FieldEditor. You usually need it when you want to check what the user entered in a textfield but without ending text editing. So you call the FieldEditor (only one instance per window) like this:<br /><code>-(void) controlTextDidChange: (NSNotification*) aNotification<br />{<br />&nbsp;&nbsp;NSTextView *fieldEditor = [[aNotification userInfo] objectForKey: @"NSFieldEditor"];<br />&nbsp;&nbsp;NSString *entry = [fieldEditor string];   // if you need this afterwards be sure to make a copy!<br />&nbsp;&nbsp;...<br />}</code><br />So don't be surprised if you get back a pointer that might change or gets invalid. Act safe and make a copy of what you need to be around!]]></content:encoded></item><item><title>Disturbances</title><dc:creator>info@y42software.de</dc:creator><category>Dev general</category><dc:date>2006-06-06T11:39:02+02:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-3</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-3</guid><content:encoded><![CDATA[One of my professors once said: <blockquote><p>"Disturbances have priority."</p></blockquote> Even though the context was different I think it can be applied to (agile) development, too. How?<br />Development is a team effort and every programmer has to be creative - in the sense of "creating code" and "finding a simple solution". Everything that disturbs this individual and group effort has to be focused on and eliminated forever.<br />Example: If you find that the old static libs give you trouble (some search paths missing, lost headers, conflicts between version etc) build a framework once and put it under SCM. The trouble will vanish. Otherwise development time is spent on fighting those disturbances over and over again. Once they pop up find a solution that will work.]]></content:encoded></item><item><title>Book recommendations</title><dc:creator>info@y42software.de</dc:creator><category>Dev general</category><dc:date>2006-06-05T22:12:53+02:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-2</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-2</guid><content:encoded><![CDATA[I wrote some <a href="../dev/dev/page9.html" rel="self">recommendations</a> on books I like and find useful.]]></content:encoded></item><item><title>First Tuorial: Pifalls in C</title><dc:creator>info@y42software.de</dc:creator><category>Obj-C</category><dc:date>2006-06-05T20:27:54+02:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-1</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-1</guid><content:encoded><![CDATA[As a first tutorial you will find a short description of possible pitfalls and trips in C in regard to Objective-C based on an article by Andrew K&ouml;nig. Take a look at the <a href="../dev/dev/dev/page7.html" rel="self">tutorial</a>.]]></content:encoded></item><item><title>Start of tutorials</title><dc:creator>info@y42software.de</dc:creator><dc:subject>Dev</dc:subject><dc:date>2006-06-05T14:17:34+02:00</dc:date><link>http://www.y42software.de/dev/dev.html#unique-entry-id-0</link><guid isPermaLink="true">http://www.y42software.de/dev/dev.html#unique-entry-id-0</guid><content:encoded><![CDATA[These pages will be filled with lots of tutorials about development and some tips and tricks. This will naturally take some time - so please be patient. Any comments and ideas are <a href="../about/about/contact.php" rel="self">welcome</a>!]]></content:encoded></item></channel>
</rss>
