Any complete amfphp example?

Migs's Avatar

Migs

12 Nov, 2011 05:23 PM

Hello,

I'm trying to get started with robotlegs. I started a project using mate and I realised it's not really matching my expectations so I would like to start over using robotlegs. My project uses amfphp and I would like to keep using it with robotlegs but I haven't found any example implementing amfphp and the best practicies to use it with robotlegs.

Could you give me link to a tutorial, an article or anything that could help me start the right way?

Thank you,

  1. Support Staff 1 Posted by creynders on 13 Nov, 2011 08:00 AM

    creynders's Avatar

    I don't know of any examples, but there's really just one "rule" you need to keep in mind when it comes to amfphp: all communication with the back-end should happen through services. Commands pull data from the models and pass them to the services that subsequently call the appropriate remote services.
    There's one thing you need to keep an eye on (but this is also true for non-RL projects):
    You should isolate the VO's you use for communication with the back-end, and not use them as VO's in the rest of your system, since any necessary modification to a VO structure used by the backend will have it's impact on your front-end and vice versa.

    I worked with amfphp for a pretty long time, but IMO it fails by design, it tries to synchronise the frontend to the backend while in my experience it's far more beneficial to have a translation layer in between both.

  2. Support Staff 2 Posted by Ondina D.F. on 13 Nov, 2011 08:18 AM

    Ondina D.F.'s Avatar

    I’m using something similar to Joel’s https://github.com/joelhooks/robotlegs-examples-UnionPlatformChatCl... ( a RemoteObjectFactory to set the remote object and channel)

    1. mapping LoginEvent to LoginCommand
      org.robotlegs.examples.bootstrap.controller.configuration.ConfigureCommandsCommand.as
      commandMap.mapEvent( LoginEvent.LOGIN, LoginCommand, LoginEvent );

    2. configuring a RemoteObjectFactory and mapping the service
      org.robotlegs.examples.bootstrap.controller.configuration.ConfigureServicesCommand.as

    3. RemoteObjectFactory
      org.robotlegs.examples.bootstrap.service.factories.RemoteObjectFactory.as

    4. Service
      org.robotlegs.examples.bootstrap.serviceUserService.as

    5. using a command to call the service
      org.robotlegs.examples.bootstrap.controller.user.LoginCommand.as

    Now, if you are completely new to robotlegs that might look a bit too complex at first. Reading the Best Practices document and looking at some examples would help a lot.
    Best Practices: https://github.com/robotlegs/robotlegs-framework/wiki/best-practices

    Tutorials and examples:
    http://knowledge.robotlegs.org/discussions/examples/6-links-to-robo...

    Joel’s Service Tutorial:
    http://www.developria.com/2010/06/an-introduction-to-robotlegs-a-2....

    I hope this helps to get you started with robotlegs and Services. Come back with questions if you need more assistance :)

    Ondina

    P.S. I see creynders answered your question while I was writing this, but I'll post it anyway

  3. 3 Posted by Migs on 13 Nov, 2011 05:08 PM

    Migs's Avatar

    Thank you for your long answer Ondina I will have a close look at your links. Is the UnionChat example really using amfphp? I didn't take the time to analyse the example in depth yet but from I see there are no service-config.xml. I saw some AFMChannel stuff though so I will have a look at how it's implemented.

    Thank you creynders for the advices. I personnaly have experience with building my own translation layer and it was such a loss of time and hassle! I'd rather have it simpler for a start and tweak it a little bit after if necessary. So far I'm pretty happy of my experience using amfphp and that's why I would like to keep going with it.

  4. Support Staff 4 Posted by creynders on 13 Nov, 2011 05:45 PM

    creynders's Avatar

    So far I'm pretty happy of my experience using amfphp and that's why I would like to keep going with it.

    Sure, was just my 2 cents. If you have any more specific RL-amfphp questions just let me know!

  5. 5 Posted by Timur on 13 Nov, 2011 11:51 PM

    Timur's Avatar

    Hi creynders, what would be your suggestions as an alternative to AMFPHP (not necessarily requiring AMF as its protocol)? AMF has its supporters and detractors in the Flex/Flash community it seems. But having looked at the transmission speeds of JSON, for example, AMF is not that much better. And with JSON, you could use all sorts of RESTful services, I imagine. Curious to hear others' take on Flash Remoting technologies of choice.

    Migs, I think the above example that Ondina referred to (UnionChat) is using WebOrb, which is an alternative to AMFPHP.

  6. Support Staff 6 Posted by creynders on 14 Nov, 2011 08:43 AM

    creynders's Avatar

    @Timur: plain JSON can't be beaten IMO. It's fast, readable and easily translatable. Most proxy, throttle, sniffer and debugger clients can parse it so it's also easily debuggable. And developing the translation layer only takes a little longer than creating the back-end VO classes and making sure they synchronise correctly to the front-end VO classes, but the translation layer requires less time in maintenance and refactoring if something changes.

  7. 7 Posted by Timur on 15 Nov, 2011 12:37 AM

    Timur's Avatar

    @ creynders: thanks for your input. I agree about using JSON over AMFPHP.

  8. 8 Posted by Migs on 19 Nov, 2011 05:58 PM

    Migs's Avatar

    Just wanted to let you know that I have successfully implemented amfphp in a robotlegs project prototype :)

    Thank you all for your help.

  9. Support Staff 9 Posted by Ondina D.F. on 21 Nov, 2011 09:19 AM

    Ondina D.F.'s Avatar

    You are welcome:)

  10. Ondina D.F. closed this discussion on 21 Nov, 2011 09:19 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac