<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technical Difficulties &#187; objective c</title>
	<atom:link href="http://greensoftware.net/blog/category/apple/objective-c-apple/feed/" rel="self" type="application/rss+xml" />
	<link>http://greensoftware.net/blog</link>
	<description>Solving my problems</description>
	<lastBuildDate>Fri, 23 Mar 2012 11:01:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Improving Qt&#8217;s properties.</title>
		<link>http://greensoftware.net/blog/2010/07/01/rfc-improving-qts-properties/</link>
		<comments>http://greensoftware.net/blog/2010/07/01/rfc-improving-qts-properties/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 16:40:46 +0000</pubDate>
		<dc:creator>digitalSurgeon</dc:creator>
				<category><![CDATA[nokia]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://greensoftware.net/blog/?p=284</guid>
		<description><![CDATA[I have known Qt for about 9 years now. My first encounter with Qt was as a normal user who was exploring Linux to find out what the fuss was all about. With KDE I got my first experience of Qt. But I have only very recently started to use Qt as a development tool, [...]]]></description>
			<content:encoded><![CDATA[<p>I have known Qt for about 9 years now. My first encounter with Qt was as a normal user who was exploring Linux to find out what the fuss was all about. With KDE I got my first experience of Qt. But I have only very recently started to use Qt as a development tool, and I have been very happy about that. Makes life easy, with Qt being ported to Symbian, Meego the gates are open for developers to make money. Since I like to experiment with all the platforms no matter who they are from, I also played around with Objective-C on iPhone some while ago.</p>
<p>While Qt offers many many nice features which make Objective-C look like from stone age. Objective-C has some nice features as well, one I mentioned in my <a href="http://greensoftware.net/blog/2010/02/21/one-good-thing-in-objective-c/" target="_self">previous pos</a>t, which Qt already solves rather nicely and in a better way as one of the commenter pointed out. Objective-C and Qt are quite similar in a sense that they provide improvements on top of an already existing language. Qt with meta object compiler and Obj-C with something similar.</p>
<p>So back to the point, I now use Q_PROPERTY macro in my QObjects based classes a lot:</p>
<pre name="code" class="cpp">
class Person : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)

public:
void setName(const QString&amp; aName) { iName = aName; }
QString name() const { return iName; }

private:
QString iName;
};
</pre>
<p>Now consider this Objective-C code:</p>
<pre name="code" class="c">// person.h
@interface Person : NSObject
{
NSString* name;
}
@property (nonatomic, retain) NSString* name; // same as Q_OBJECT 

// person.m:
@implementation Person
@synthesize name; // this generates getter/setter in the .m file

// rest of the code ...</pre>
</pre>
<p>So do you see what I see ? In the Objective-C version of the code I don't have to write the getter and setter methods, whereas in Qt i have to. I think all the information to automatically implement the getter and setter functions is already in the Q_PROPERTY macro, may be the moc compiler can go ahead and also generate the getter and setter methods for us ?</p>
]]></content:encoded>
			<wfw:commentRss>http://greensoftware.net/blog/2010/07/01/rfc-improving-qts-properties/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The iPhone OS 4.0 Agreement stink.</title>
		<link>http://greensoftware.net/blog/2010/04/10/the-iphone-os-4-0-agreement-stink/</link>
		<comments>http://greensoftware.net/blog/2010/04/10/the-iphone-os-4-0-agreement-stink/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 10:13:26 +0000</pubDate>
		<dc:creator>digitalSurgeon</dc:creator>
				<category><![CDATA[annoyances]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[webapps]]></category>

		<guid isPermaLink="false">http://greensoftware.net/blog/?p=253</guid>
		<description><![CDATA[So the internets are abuzz with the news that the new iphone os 4.0 developer agreement prohibits using any non apple endorsed programming language, framework for iphone/ipad development. This is hardly any thing surprising, given the way apple has been acting ever since jobs came back in control. When they were irrelevant they didn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>So the internets are abuzz with the news that the new iphone os 4.0 developer agreement prohibits using any non apple endorsed programming language, framework for iphone/ipad development. This is hardly any thing surprising, given the way apple has been acting ever since jobs came back in control. When they were irrelevant they didn&#8217;t have the power to make any rules, now that they have a good market share, they are showing it. It almost feels like a kid who lost a game in his teens taking revenge in his 50&#8242;s. </p>
<p>Some people are comparing this with the Window Phone 7 Series and how its limited to .NET and C#, well that&#8217;s not exactly the same thing, Windows Phone 7 has no market share as of now, it will be coming to market in the late 2010. Microsoft sets this standard before they have any kind of market share, and besides any language ( php, vb, python ) can be used to create CLR code and that can be used for making apps on wp7 ( yet ).</p>
<p>But I believe apple has every right to do what it is doing. It might be good for the company, but sad for most of the developers. I myself was looking at <a href="http://www.monotouch.net">monotouch</a> as a tool for doing apps for iphone, but I went with objective c instead, it was not that difficult to learn and I think if you are a good c++ programmer objective c would be a piece of cake to learn, in two or three days. Monothouch is also just too expensive in my opinion.</p>
<p>However, like google has said earlier and I believe it myself that webapps are the future way of doing apps. <a href="http://www.phonegap.com">Phonegap</a> for example is an awesome project and it has a lot of potential, what we need now is standardization of web apps / javascripts apis. W3C for example has now standardized the Geolocation api, I think we need similar standard apis for example to access the phone book, sensors etc &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://greensoftware.net/blog/2010/04/10/the-iphone-os-4-0-agreement-stink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One good thing in Objective-C</title>
		<link>http://greensoftware.net/blog/2010/02/21/one-good-thing-in-objective-c/</link>
		<comments>http://greensoftware.net/blog/2010/02/21/one-good-thing-in-objective-c/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 12:24:15 +0000</pubDate>
		<dc:creator>digitalSurgeon</dc:creator>
				<category><![CDATA[c]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[annoyance]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://greensoftware.net/blog/?p=248</guid>
		<description><![CDATA[While learning about objective-c. I came across a single feature of objective-c which I think if moved to c++ would make for a lot less coding. Consider this objective c code for a class declaration: // .h file: @interface classname { // instance variables } +(void)classMethod; @end // .m file: @implementation classname -privateFunction1{} -classMethod { [...]]]></description>
			<content:encoded><![CDATA[<p>While learning about objective-c. I came across a single feature of objective-c which I think if moved to c++ would make for a lot less coding.</p>
<p>Consider this objective c code for a class declaration:<br />
<code><br />
// .h file:<br />
@interface classname  {<br />
    // instance variables<br />
}<br />
+(void)classMethod;<br />
@end</p>
<p>// .m file:<br />
@implementation classname<br />
-privateFunction1{}<br />
-classMethod { [self privateFunction1]; }<br />
@end<br />
</code></p>
<p>While if you would have to do something similar in c++, this is how you would do it:</p>
<p><code><br />
// .h file:<br />
class classname<br />
{<br />
public:<br />
void classMethod();</p>
<p>private:<br />
void privateFunction();<br />
}</p>
<p>// .cpp file:</p>
<p>void classname::classMethod()  { privateFunction(); }<br />
void classname::privateFunction()  {}</p>
<p></code></p>
<p>Even if a function in a C++ class is private, you still have to declare it in the class declaration. why ?<br />
It would be so much better if all the private functions can just placed in the cpp file, and we dont have to put them in the class declaration.</p>
<p>Objective C has the benefit of using @implementation &#8230; @end to figure out such methods. But if in c++ if we just declare a function in the .cpp file and such function is not present in the class declaration, the compiler can know that its a private function. Like so:</p>
<p><code><br />
// .h file:</p>
<p>class sample<br />
{<br />
public:<br />
 void doSomething();</p>
<p>private:<br />
int x;<br />
};</p>
<p>// .cpp file:</p>
<p>void sample::doSomethingPrivately()<br />
{<br />
// has access to member data.<br />
x = 7;<br />
}</p>
<p>void sample::doSomething()<br />
{<br />
 /// ...<br />
doSomethingPrivately();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://greensoftware.net/blog/2010/02/21/one-good-thing-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

