Facebook Application Design Question - zend-framework

Iam coding a dating application for facebook. The application has to have a standalone web application part and a Iframe based part which runs inside facebook canvas.
I want to know good ways to design the application. Iam using zend framework, so here is my idea.
One approach that am planning to use is this -
The application folder to contain 2 controllers, index controller being the entry point of the standalone web application and another controller- FacebookController to be the entry point of the Iframe being run inside facebook canvas. Both of them calling the same view files which get written based on which controller is writing to them.
The second approach is to have one single controller as the entry point and use 2 layout files. One for the standalone web application and one for the facebook canvas app.
The reason for choosing these approaches in that the authentication mechanism of the two applications is different.
To get an idea, have a look at www.areyouinterested.com, Iam planning to do something similar to what they have done.
Please suggest me what would be the best way to go around this.

Your first choice is best.
Two Controllers. Two layouts. Common views.
This gives you flexibility to change around a lot of one or the other without breaking the opposite one.
If you feel ambitions, I would even go with two modules. If your application is structured well enough each module will have common components that are re-usable.

Related

Fully scalable website with micro-applications

I'm in the process of designing a cloud deployed website for a new solution my company is looking to provide. I have been attempting to answer a few questions and haven't had any luck, so when in rome.
First, I don't want the website to be stuck to any one particular framework. I know there is no way to completely future proof a website, but I would rather not put all of our eggs in one basket.
Secondly, I want to have a separation between the front and back end entirely. I have a list of reasons why I'm looking to do this, don't necessarily want to get into the conversation of what they are. Server Side rendering for the most part is out of the question.
So where does that leave me?
My initial thoughts on the design are to have a REST API that can be accessed for any API calls (this may be turned to GraphQL in the future).
The design decisions that I'm mostly wresting with are for the front end. The website will be a dashboard type system, where tenants can log in and see screens for them.
I was thinking that I would have a sort of shell, that hooks on to the index.html. This would have it's own routing, that would render micro-applications that are completely separate from the shell logic.
So for example, if I load index.html, path being "/"
It has some routes that it's responsible for, lets say
"/todos"
"/account"
If I accessed the /todos route, my shell application would then render that micro app. This application would be completely separate from the shell, except some data that might be loaded via the window. Once this application is rendered via the shell application.
So my todos route, for example, could be a redux application that's independent. It could have it's own routing, etc.
Is this is a common architecture? Are there any examples of this? Is there a better way of going about this?
Thanks for any insight!
Sounds like your well and truly over engineering this beast.
You may take on such an architecture for a HUGE build with many dev teams all working separately. Small agile team, the above would create so much overhead in boilerplate and brain ache in context switching between each "app"
Micro-service architecture is seriously great. Just don't break it up too small, read your use case well and break your services up accordingly.
For example: we are a team of 3. We have a pretty large-ish app devised into:
Php API
Backend management interface (redux)
Frontend website (html, react, php)
Search service (elastic search)
Cache (redis)
Data store (mysql)
All on running in multiple docker containers across multiple hosts. Pull down the backend.. Fine the frontend website is still up and running!

best way to embed LIGHTWEIGHT GWT 'widgets' into websites

I know this is similar to other topics, but I've not yet found a satisfactory answer.
I have a GWT / GAEJ application that essentially allows users to interact with the web app as if it were a desktop app. i.e. they login, and use the application in full-html mode (i.e. the GWT app occupies the entire html page). They are typically power users and so don't mind a few seconds dowload / login time when starting to use the app. Typically they might stay logged in for several hours.
I would also like to make available some small subsets of functionality, pointing to the same Back end, as widgets to be included in OTHER existing websites. I know one of the features of GWT is that you can either embed your GWT into existing html pages or go full page.
My question is how do I partition the GWT components into small tidy parcels so that only the relevant bits are downloaded for these embedded 'widgets' whist not having to duplicate my backend code. (for example I could create a new GWT project write only my small widget and copy the server side code - but I really don't want to do this!) Each widget still needs to interact with the same backend so none of them will be stand alone GWT. Communication is GWT-RPC.
anyone done this?
Seems like you want to split your GWT stuff into multiple GWT modules that you want to later combine in possibly more than one project. One way is having a multi-module maven setup (gwt-maven-plugin), there's no need to copy/paste code.

Symfony design question - how can I share forms between apps?

I'm developing a site in Symfony, and I'm not sure what the best way is to handle this scenario.
I'm creating a party bookings system. Anyone can go to my frontend app and submit a new booking. Once they're finished, they'll just get a confirmation screen, they can't edit it. Easy.
Only certain users will be able to get to the admin app (it might be secured simply by being on an intranet, but that's not important, just assume it will be only accessible by admin users). They'll be able to view the list of submitted bookings. Easy.
My problem is around code re-use when allowing admin users to edit existing bookings. When you do generate-module in Symfony, the generated module (which as a newbie I'm assuming is a good example of structuring things) creates the form as a partial. I've had to customize this form a lot for my usage (lots of Javascript, etc), so of course I want to re-use this code, to be able to load an existing booking into this form. But there doesn't seem to be a way to share this partial between the apps (I've seen people mention making a plugin...but this seems complicated for this use).
I considered using an IFrame to load the form from the frontend and just passing an "id" parameter to load it in edit mode, but this would mean that the edit mode is not secure - anyone could go to the form on the frontend and pass this parameter to edit a booking.
I also considered putting all of the form display code (HTML, Javascript, etc) in a method on the form object, but this doesn't seem very MVC - all of the display code is then in the form. But this is only because I'm thinking of the form in the same way as a model - is that right?
I feel like this should be a common situation. You can share models and forms between apps, why can't you share this common form display code too?
Thanks!
You should reconsider having 2 applications in the first place. Not only you run into the code reuse problem, but also i18n, testings and other issues. I find it much easier to have 1 application with different bunch of modules for frontend and backend users. You can configure security per module. You can have one sign in form for all users and redirect them to appropriate module based on their credentials.
You can reuse partials between modules inside the same application, but you seem to be talking about two different applications (frontend and backend) so as far as i know the only way is to copy & paste the partial from one application to the other...

GWT: Loading a view into main app from another app

Let's say you have two GWT applications: the first (which is on another server as the second) has implemented some views that can be used to change the configuration separately.
The other one can manage (and access) some of the first ones and should configure them without forcing the user to login on every site.
It would be bad to just copy the code of the configuration, because this would duplicate code and we have to maintain it for every version, because the configuration-dialogues can change between versions.
Is it possible to include / load that view into your main GWT app, so that the users can use it the same way as your main application?
You can - Display the second app in an iframe. But if you use cookies beware of same origin policy if the domains are different for the two sites.
The other solution is import the code into the new one and let it perform independently here.
(A lot depends on underlying architecture of the two apps of course)

Admin screens in Zend: controller or module?

I am going to create Admin screens in my ZF app.
Should I used separate controller or separate module to contain admin section?
My assumption is that this has something to do with application size.
If it's small, using a controller for Admin part is ok, isn't it?
I don't see the problem with that. Keeping each screen as a separate action, just an AdminController should suffice.
On the other hand, if the admin area is likely to grow to a much larger application, you might as well create a separate module for it now.
I think you're right. If it's a small site it wouldn't pe a problem. But for big sites I would recoomend to have seperate admin controllers.
I have always used a separate module regardless of application size, to me this just seems to make more sense. Given a typical application (such as a blog which seems to be the common howto) you would want to manage (as an admin) users, posts, comments, etc...
If the admin area is just controller, then posts would be the action, but that doesn't seem to make much sense. The admin section is the actual area (not what you are trying to control). You are attempting to control a post or set of posts (the controller). What you are doing to them (creating, editing, deleting, updating, moderating, etc...) would be the action.