Your SlideShare is downloading. ×
Building Server Applications Using Objective C And Gn Ustep
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Building Server Applications Using Objective C And Gn Ustep

1,405
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,405
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1.  
  • 2. Server Applications
      “Server Applications” = programs with no GUI In GNUstep, server applications are based on GNUstep-base. GNUstep-base is the most complete and extensively polished and tested part of GNUstep ... … but is little known to the public.
        • People often identify GNUstep only with the GUI framework/development environment.
  • 3. Objective-C
    • it is a programming language
    • 4. it is a strict superset of C
        • it is C with some new additional constructs
        • 5. C code compiles as Objective-C code
        • 6. C libraries can be linked and used natively from Objective-C
    • it adds Object-Oriented features to C
        • Defining classes
        • 7. Implementing methods
        • 8. Instantiating classes and objects
        • 9. Invoking class and object methods
        • 10. Protocols, categories, selectors, forwarding
  • 11. Why is Objective-C so special ?
    • It is compatible with C libraries
    • 12. Is is a simple extension of C
    • 13. It is a hybrid between C and Smalltalk
        • It can be as fast as raw C if you avoid the object-oriented extensions
        • 14. It can be as high-level and flexible as Smalltalk if you use the object-oriented extensions
        • 15. It allows experienced programmers to mix different programming styles in the same program
    • It is extremely flexible
    • 16. Powerful “ Foundation ” class library
  • 17. Why use Objective-C for Server Applications ?
    • Very fast. You can freely mix it with C and even assembler if you need.
    • 18. High-level language. Organize your server code using high-level, object-orientated design patterns.
    • 19. Powerful Foundation library (GNUstep-base). The API originates from OpenStep and the implementation has been polished for 13+ years.
  • 20. OpenStep API - Foundation Kit (1994)
      Foundation Kit Non-graphical classes
      • Root classes : NSObject, NSProxy
      • 21. Basic data classes : NSString, NSNumber, NSData, NSNull
      • 22. Collection classes : NSArray, NSDictionary, NSSet
      • 23. Execution control classes : NSRunLoop, NSTimer, NSThread, NSLock
      • 24. I/O classes : NSTask, NSFileHandle
      • 25. Notification classes: NSNotification, NSDistributedNotification
      • 26. Serialization classes: NSArchiver, NSCoder
      • 27. Resource management classes: NSBundle, NSUserDefaults
      • 28. Distributed Objects Classes: NSConnection, NSPort
      • 29. And many more...
    Application Foundation Kit Application Kit Operating System OS Graphical System Objective-C Runtime
  • 30. GNUstep-base Application GNUstep Base GNUstep GUI Operating System (Any!) Graphical System (Any!) GNU Objective-C Runtime GNUstep Back
  • 31. Server Applications – what do you need ?
      gcc-objc
        • Objective-C compiler
        • 32. Objective-C runtime
      gnustep-make
        • Official GNUstep Building System
        • 33. Makefile library that automatically takes care of configuring and building on different platforms
      gnustep-base
        • OpenStep Foundation Kit implementation
        • 34. Provides “core” non-graphical Objective-C classes
  • 35. Important dependencies
      libffi
        • Required by gnustep-base
        • 36. You may need to download it and install it from www.gnustep.org
      libxml
        • Required by gnustep-base
        • 37. Install it from your GNU/Linux distribution
      gnutls or openssl
        • Allow gnustep-base to support https://
        • 38. Install it from your GNU/Linux distribution
  • 39. Typical Quick Installation (Ubuntu) apt-get libgnustep-base-dev
  • 40. Typical Manual Installation (RedHat) yum install gcc-objc libxml-devel openssl-devel wget ftp://sourceware.org/pub/libffi/libffi-3.0.1.tar.gz tar xfvz libffi-3.0.1.tar.gz cd libffi-3.0.1 ./configure make su -c 'make install' <edit /etc/ld.so.conf adding /usr/local/lib, then run ldconfig as root> wget ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-make-2.0.8.tar.gz tar xfvz gnustep-make-2.0.8.tar.gz cd gnustep-make-2.0.8.tar.gz ./configure make su -c 'make install' . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh wget ftp://ftp.gnustep.org/pub/gnustep/core/gnustep-base-1.18.0.tar.gz tar xfvz gnustep-base-1.18.0.tar.gz cd gnustep-base-1.18.0 ./configure –enable-openssl make su -c 'make install'
  • 41. “Hello World!” Program
      “Hello World” using Objective-C / GNUstep-base hello.m
    #import <Foundation/Foundation.h> int main (void) { NSLog (@“Hello world!”); return 0; }
  • 42. “Hello World!” Program
      “Hello World” using Objective-C / GNUstep-base GNUmakefile
    include $(GNUSTEP_MAKEFILES)/common.make TOOL_NAME = hello hello_OBJC_FILES = hello.m include $(GNUSTEP_MAKEFILES)/tool.make
  • 43. “Hello World!” Program
      “Hello World” using Objective-C / GNUstep-base Usual compilation commands
    make make clean make distclean make install make messages=yes make install messages=yes
  • 44. “Hello World!” Program
      “Hello World” using Objective-C / GNUstep-base Compilation results are in ./obj Let's try it out: Tutorial Compilation Session
  • 45. GNUstep-base coding: where to start
      GNUstep Mini Tutorials (Introduction): http://www.gnustep.it/nicola/Tutorials/index.html GNUstep Base Documentation (API Reference): http://www.gnustep.org/resources/documentation/Developer/Base/Reference/index.html
  • 46. GNUstep-base coding: basic classes
      Class cluster Design
        • Transparent way of optimizing classes without changing the public API
        • 47. When you create a NSString or NSArray you actually get an instance of a subclass optimized to perform best in your situation
        • 48. Method dispatch is dynamic, so that works
        • 49. You can implement your own subclasses for performance
      Mutable and non-mutable Classes
        • NSString vs NSMutableString
        • 50. NSString is for constant strings that never change
        • 51. NSMutableString is for strings that might change
        • 52. Allows a lot of optimizations inside the library
  • 53. GNUstep-base coding: basic classes
      NSString, NSMutableString
        • String class
        • 54. Full Unicode support
        • 55. Class cluster implementation means ASCII strings are still extremely fast
        • 56. Static strings
      • NSString *string = @”This is a test string”;
  • 57. GNUstep-base coding: basic classes
    • NSArray, NSMutableArray
        • Array class
        • 58. NSMutableArray provides arrays that grow dynamically
    • NSDictionary, NSMutableDictionary
        • Hashtable/associative array class
        • 59. NSMutableDictionary provides associative arrays that grow dynamically
      • {
        • Name = “Gorm.app”;
        • 60. Description = “GNUstep GUI Builder Application”;
        • 61. }
      • (“one”, “two”, “three”);
  • 62. GNUstep-base: Runloops and threads
  • 67. GNUstep-base: Notifications
    • GNUstep-base supports notifications and observers
        • Flexible way to connect objects
    • NSNotificationCenter
    • 68. Objects can “observe” a notification and specify which method
    • 69. they want invoked when that notification is posted
    • 70. Anything can “post” a notification
    • 71. The notification is delivered to all “observer”
      • See NSNotificationCenter documentation for more information
  • 72. GNUstep-base: Delegates
    • Objective-C and GNUstep-base encourage using delegates
    • 73. A delegate allows you to extend a class without subclassing it
    • 74. Subclassing can be heavy, and not that flexible
    • 75. Delegates are more flexible – you can delegate part of the code to
    • 76. an object of any class
    • 77. -setDelegate: (NSObject *)delegate;
    • 78. -delegate;
  • 79. GNUstep-base: Distributed Objects
    • Remote method invocation
    • 80. High-level
    • 81. You can expose objects in one process to other processes
    • 82. Other processes can then contact the object and invoke methods
    • 83. of the objects, as if they were local objects
    • 84. Very natural to use
    • 85. Excellent for building networks of processes that work cooperatively
    • 86. See http://www.gnustep.it/nicola/Tutorials/ for a tutorial on Distributed Objects.
  • 87. A look at some useful libraries
    • You can use any C library you want
    • 88. Objective-C libraries provided by GNUstep
        • check the dev-libs module in subversion
    • Objective-C libraries provided by other parties
        • SOPE (opengroupware.org)
        • 89. Apple Cocoa non-GUI frameworks can sometime be used
  • 90. GNUstep Database Libraries
    • You can use your own preferite C library
    • 91. GNUstep Database Libraries
    • SOPE
        • The best choice if you use the SOPE application server
        • 93. Not so interesting if you're not
  • 94. GNUstep Database Libraries
      SQLClient
        SQL Layer (low-level)
        • Standard SQL layer to execute SQL queries/commands
        • 95. “Backend bundles” (plugins) for the different databases (standard bundles: PostgreSQL, MySQL, SQLite, Oracle)
        High-performance features
        • Connection pooling
        • 96. Advanced transaction support
        • 97. Query caching
        • 98. Update Batching
  • 99. GNUstep Database Libraries
      GDL2
        • (GNUstep Database Library v2)
      • High-level features
        • SQL layer with EOAdaptors (plugins) for different database (standard bundles: PostgreSQL, SQLite)
        • 100. Object-to-relationship mapping
        • 101. Extensive use of KVC
        • 102. Supports and encourages MVC patterns
      • Rapid development/integration support
        • EOInterface
        • 103. DBModeler (GUI program)
  • 104. GNUstep Database Libraries
      SQLClient
        • SQL only
        • 105. You have to write your SQL code
        • 106. Performance-oriented
        • 107. Excellent for very high-performance servers where you write and tune each and every single SQL command
      GDL2
        • High-level framework
        • 108. You works with models and objects – you do not need to write SQL
        • 109. Can be a bit hard to get into, but people love it once they get used to it
        • 110. Excellent for large and properly structured OO projects
        • 111. Performance is generally good
  • 112. GNUstep WebServer Library
      WebServer Library
        • A library to implement quickly http/https server applications
        • 113. Appropriate to develop efficient APIs for your system
        • 114. Could be used for web pages but that is not the focus
        • 115. Provides a full web server
        • 116. Usually used with Apache in front as a reverse-proxy
  • 117. Jigs: GNUstep Java Interface
      • What is it
        • Allows you to use Objective-C libraries or objects from Java
        • 118. And allows you to use Java libraries or objects from Objective-C
        • 119. Objects and classes in Objective-C are mapped to objects and
        • 120. classes in Java and vice versa
      • Pros
        • Is very cool
      • Cons
        • Can be slow, use it with moderation
        • 121. Problems can be hard to debug
        • 122. Limited support for cross-language subclassing
        • 123. Not easy to port to other platforms
  • 124. SOPE
    • An extensive set of frameworks
    • 125. A complete “Web application server” environment
    • 126. Apple WebObjects compatible app server extended with Zope concepts
    • 127. XML processing (SAX2, DOM, XML-RPC)
    • 128. MIME/IMAP4 processing
    • 129. LDAP connectivity
    • 130. RDBMS connectivity
    • 131. iCalendar parsing
      • http://sope.opengroupware.org
  • 132. Questions ?
  • 133. Thank you For more information
      www.gnustep.org