{"id":16262,"date":"2024-05-30T10:23:45","date_gmt":"2024-05-30T04:53:45","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=16262"},"modified":"2024-06-06T15:06:46","modified_gmt":"2024-06-06T09:36:46","slug":"objective-c-programming","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/objective-c-programming\/","title":{"rendered":"Objective C Programming\u00a0"},"content":{"rendered":"\n<p>Objective C is well known general purpose language which is developed on top of C Programming language by adding the features of small talk programming by making it an object oriented language. It will be primarily used as the developing iOS and Mac OS X operating system and well known applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Object-Oriented Programming<\/strong><\/h2>\n\n\n\n<p>Objective-C will is fully supported by object oriented programming, includes the four pillars of object oriented development:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Encapsulation<\/li>\n\n\n\n<li>Data hiding<\/li>\n\n\n\n<li>Inheritance<\/li>\n\n\n\n<li>Polymorphism<\/li>\n<\/ul>\n\n\n\n<p>For example<\/p>\n\n\n\n<p>#import &lt;Foundation\/Foundation.h&gt;<\/p>\n\n\n\n<p>void main (int argc11, const char * argv[]) {<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;NSAutoreleasePool1 * poo1l = [[NSAutoreleasePool1 alloc] init];<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;NSLog (@&#8221;hi world&#8221;);<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;[pool drain];<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>Foundation Framework:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Foundation Framework will provide a large set of features which are listed as:<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It will include a list of extended datatypes like NSArray, NSDictionary, NSSet.<\/li>\n\n\n\n<li>It has rich set of functions manipulating files and strings etc.<\/li>\n\n\n\n<li>It provides many features for URL handling,utilities like data formatting, data handling or error handling.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Learning objective C<\/strong><\/h2>\n\n\n\n<p>The very important task to do when learning objective C, is to focus on the concepts and not get lost in any of the technical details. The main objective of learning a programming language is to become a better programmer more effective in designing and implementing new systems are at maintaining the old ones.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Use of Objective C<\/strong><\/h2>\n\n\n\n<p>Objective C is mentioned as earlier that is used in an iOS and also MAC OS X. It has large base of iOS users and largely increasing Mac Os x users and since Apple focuses on quality first and its wonderful for those who will start learning objective-C.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The environment setup<\/strong><\/h2>\n\n\n\n<p>We can also install Text Editor and the GCC compiler on the computer.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Text Editor<\/strong><\/h2>\n\n\n\n<p>This is a type of program. Examples of few editors that include windows notepad, OS Edit command, Brief and Vim or may be vi.<\/p>\n\n\n\n<p>The text editor\u2019s name and version is different for different operating system. Consider an example notepad will be used for windows and vim or vi used on linux and unix. The files where we can create with our editor are called source files and contain program source code. The source files for objective-C programs are typically named with extension \u201c.m\u201d<\/p>\n\n\n\n<p>Before starting our programming make sure that we have one text editor in place and we have enough experience to write the computer program, save it in file, compile it ,finally execute it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The GCC compiler:<\/strong><\/h2>\n\n\n\n<p>This source code is coded in a source file can compile to turn into human readable form a program. It requires to be \u201ccompiled\u201d to turn the machine language so that your <a href=\"https:\/\/en.wikipedia.org\/wiki\/Central_processing_unit\" rel=\"nofollow noopener\" target=\"_blank\">CPU <\/a>can actually execute the code the program as per the program per instruction. The GCC compiler will be used to compile the source code into the final executable program where the basic knowledge about the programming language compiler.<\/p>\n\n\n\n<p>The GCC compiler is used to compile your source code into final executable program. It is available for free on various platforms and the procedure to set up on various platforms explained as<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installation on Windows<\/strong><\/h2>\n\n\n\n<p>To execute the objective C program on windows we need to install MinGW and GNUstep core. Both will be available at\u00a0<a href=\"https:\/\/gnustep.github.io\/\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/www.gnu.org\/<\/a>.<\/p>\n\n\n\n<p>We have to install the MYSYS\/MinGW system package. Then we need to install the GNU step core package. Both of which are provided a windows installer, which is self explanatory.<\/p>\n\n\n\n<p>Then use of objective-C and also GNU step by selecting start-&gt;All Programs-&gt;GNUstep-&gt;Shell<\/p>\n\n\n\n<p>We have to switch folder containing Hi world<\/p>\n\n\n\n<p>We can compile the program<\/p>\n\n\n\n<p>$ gcc `gnustep-config &#8211;objc-flags`&nbsp;<\/p>\n\n\n\n<p>-L \/GNUstep\/System\/Library\/Libraries hello.m -o hello -lgnustep-base -lobjc<\/p>\n\n\n\n<p>we can run the program by using<\/p>\n\n\n\n<p>.\/Hi.exe<\/p>\n\n\n\n<p>we will get the output as<\/p>\n\n\n\n<p>2022-09-01 10:48:39.772 iitworkforceA[1200] Hi world<\/p>\n\n\n\n<p><strong>Installation on UNIX or Linux<\/strong><\/p>\n\n\n\n<p>This is the first step to install the GCC compiler along with GCC objective C package.<\/p>\n\n\n\n<p>$ su &#8211;&nbsp;<\/p>\n\n\n\n<p>$ yum install gcc<\/p>\n\n\n\n<p>$ yum install gcc-objc<\/p>\n\n\n\n<p>The next step will be to set the package dependencies using the following command<\/p>\n\n\n\n<p>$ yum install make libpng libpng-level libtiff libtiff-level libobjc&nbsp;<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;libxml2 libxml2-devel libX11-devel libXt-devel libjpeg libjpeg-devel<\/p>\n\n\n\n<p>To get the full features we have install GNU step by <a href=\"https:\/\/www.gnu.org\/\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/gnu.org\/<\/a> and we have to unpack the file by<\/p>\n\n\n\n<p>$ tar xvfz gnustep-startup-.tar.gz.<\/p>\n\n\n\n<p>Then&nbsp; switch folder where gnustep-startup that gets created<\/p>\n\n\n\n<p>$ cd gnustep-startup-&lt;version&gt;<\/p>\n\n\n\n<p>then build and configure<\/p>\n\n\n\n<p>$ .\/configure<\/p>\n\n\n\n<p>$ make<\/p>\n\n\n\n<p>And set up the environment by<\/p>\n\n\n\n<p>$ . \/usr\/GNUstep\/System\/Library\/Makefiles\/GNUstep.sh<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Questions<\/strong><\/h2>\n\n\n\n<p>1. What is C objective?<\/p>\n\n\n\n<p>2. Explain the features of C objective?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Objective C is well known general purpose language which is developed on top of C Programming language by adding the features of small talk programming by making it an object oriented language. It will be primarily used as the developing iOS and Mac OS X operating system and well known applications. Object-Oriented Programming Objective-C will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":16263,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-16262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-qa-tutorials"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/16262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=16262"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/16262\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/16263"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=16262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=16262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=16262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}