Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:20:40+00:00 2026-06-02T00:20:40+00:00

I am trying to implement the concept of component programming while writing my iOS

  • 0

I am trying to implement the concept of component programming while writing my iOS game.

In the book “Component Software: Beyond Object-Oriented Programming” by Clemens Szyperski, he mentions a tactic:

(not quote)
Start with a Duck class, which adds component Quack.
Class Quack implements an interface on whichever object that calls it, the interface specifies a method which uses Quacks quack()

With this setup, Duck has no reference or awareness about Quack except for when it’s instantiated, and is never used in Duck thereafter. Other objects can call duckObject.quack() and reach Quack while only being aware of Duck object.

So far, I’ve been trying to implement this without success. Preferably, Duck should need no more code than instantiation, the rest placed in Quack class. Can this be done in Objective-C (for iOS?), or am I better off leaving COP for other languages?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:20:41+00:00Added an answer on June 2, 2026 at 12:20 am

    I don’t think there’s an exact comparison in ObjC, but it sounds like you want to look into message forwarding. If an object is sent a message to which it doesn’t respond, right before an error is signaled, the runtime sends the object forwardInvocation:, with an NSInvocation argument that encapsulates the message and arguments.

    In forwardInvocation:, an object can pass along the invocation to another object which does handle that message. This allows a Duck instance to respond to the message quack, even though quack is not implemented by Duck, by holding a reference to an instance of Quack, which does implement it:

    - (void)forwardInvocation:(NSInvocation *)anInvocation
    {
        if( [myQuack respondsToSelector:[anInvocation selector]] ){
            [anInvocation invokeWithTarget:someOtherObject];
        }
        else{
            [super forwardInvocation:anInvocation];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to implement an MVC file upload example on Scott Hanselman's blog. I
I am trying to implement proxy re encryption for the proof of concept with
I was trying to implement the Sorry! board game using C++ such that 4
Trying to implement what I thought was a simple concept. I have a user
I'm trying to implement signals from Django ( http://docs.djangoproject.com/en/dev/topics/signals/ ), or its concept in
I have difficulties wrapping my head around the concept. I am trying to implement
I'm trying to implement a Question Answering System based on software engineering ontology. This
I'm trying to implement singleton concept in my play application. But before going into
I'm trying to implement messaging between my ViewModels My Proof of Concept Code is
The concept seems simple enough: I am trying to implement fixed header scrolling by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.