Modules in Zend Framework 2 (ZF2) - module

Let's say that I'm building a social networking web site. Should I put the whole web site under SocialNetworking module should almost each page have its own module like ProfileModule, MessagingModule, and GalleryModule?
Or it is somethink differen like AvatarModule, UserToUserConnectionModule like FriendshipModule, PrivacyModule?

Modules are not containers of different "pages" of a website.
A module can literally be anything, but in most cases it provides "features" (services, listeners, events, classes, generally logic) for your application.
Don't separate modules thinking at them as separate URLs in your web application: instead, think of them about containers of reusable code.
As a rule of thumb, a Zend Framework 2 Module can be separated from the other functionality on your application if it provides logic that you may want to reuse in another project.
As you can see, it's all about producing reusable and decoupled portions of your application.

Just to add something to the good answer of #Ocramius, the examples you've given can ALL be modules.
You can have a "BlogModule". This module would handle BlogPosts. Then you could have an additional "CategoriesModule" that adds the option to give each BlogPost a Category. Then you could write another Module "MediaModule" that adds the functionality to attach Media to your BlogPosts

Related

Models in ASP.NET Core Web API

Why are models not in a separate Model folder in the api template? The original template comes with WeatherForecast.cs as a separate file just by itself.
Are we not supposed to have a folder for models?
In this template you actually get minimal settings for ASP.NET project as program.cs and startup.cs with minimum configuration.
Then you choose how your folders will be located, depending on what you are going to do. If you want to make a couple of controllers with couple of methods, and you are not going to expand the functionality, you can write all the functionality of your program there and create two folders: controllers and models. In the case where you need to build a large application with a lot of logic, you need to use common web application architectures.
You can read this article and find a right direction for searching, but it is more than just "separate file and folders", this is a very big topic for thought.

Sitefinity 4+ -- Standardizing intra-site modules in Sitefinity 4-5.x

We write a lot of intrasite modules and are noticing that they really deviate now in SF 4+ from the content-based ones. So, on that note, I have some questions:
How do you get the EXACT look and feel of the standard modules for the edit/create form? For example, how do you eliminate the menu above, center the form, etc, as in, say, the Events module?
How do you add an actions menu dropdown to a radgrid, same as you'd see in the grids for standard modules?
How do you incorporate Sitefinity fields into the usercontrols? For example sf:ImageField throws script errors when added to a control? Also, is there documentation on each of these fields and how to configure?
---finally---
If we really want that standardization, do we have to go with another module type?
4.Is there a module type that will allow us to access non-sitefinity data (ie separaate db
but also provide us with exactly the same functionality and UI experience as the content-
based modules?
intra site modules are simply custom user controls (ascx) placed into backend pages to add your custom functionality to the backend. To copy the look and feel of the rest of the site, I literally copy and paste the HTML into the control.
I did a webinar on this a while back, including code to recreate the backend editor. It appears to still be valid, and is available here: http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2011/06/30/sitefinity_intra-site_module_webinar_notes
the centered view is a bit different, and I don't have that html, but you could potentially do the same (copy it from another native page). I don't always get it 100% accurate (my controls are usually laid out different from what Sitefinity does) but I get close enough so that it doesn't break the user experience.
The actions menu could be recreated with javascript, but if you are looking for NATIVE integration that does all this for you, indeed you would be looking at inheriting or much better yet: simply using the module builder, which lets you build custom types that automatically install themselves into Sitefinity as if they were regular modules.
Fields are definitely designed to run inside the context of native sitefinity module definitions (the classes that make up the UI using the Sitefinity context). This doesn't mean you can't include Sitefinity content in your modules; it simply means if you do you'll have to implement the integration yourself using the API.
On your last question, the only way to use external data but still keep the "Sitefinity Content" UI is to inherit from Content, then create a custom provider that reads from your database and translates it into the Sitefinity content type. It is certainly possible, but is quite a big project.
Unless you are in full need of this tight integration, I recommend simply going intra-site, linking to Sitefinity content types,taxonomy, etc through the API and manage it separately.
I hope this was helpful!

cocoa-touch dependency injection and loading code dynamically

I'm looking into porting an existing enterprise app to iPad. One of the key requirements is that there is a basic functioning app that needs to be highly customizable/extensible. Also, the people working on the customizations and extensions are not part of the product team and do not have access to the base product's code (only interfaces, docs and the binaries). To achieve this, the current application uses a component based architecture where well defined components are used to compose the UI. For a given customer any of these components can be either extended and used instead of the out of the box ones or simply swapped with a new component that adheres to the interface.
Are there libraries in cocoa-touch that support a component model architecture ? (composing the app through a registry/configuration that can easily edited by others than the team developers)
Sebi
Perhaps you can create a root view controller and inject polymorphic children with: https://github.com/jasperblues/Typhoon

Writting My lightweight MVC framework

I have planned to write my own light weight MVC for PHP, that will be used as base for my sites I develop. I have no problem with PHP, OOP, et al. I have trouble on how to actually load Models In controllers and use them amd loading Controller values into Views. In short, I don't know how M-V-C interact behind the scenes.
Any tutorial (concentrating on that) or any contribution is welcomed!
Thanks!
ASP.NET MVC is open source: http://aspnet.codeplex.com/releases/view/58781
Edit: consider this: I believe you are trying to reinvent the wheel, thinking that those MVC framework out there are heavy and packed with uncessary features (acording to your double use of the word lightweigth). In my experience, I always ended up coding those extra "features" because a framework is required to evolve. Loading models In controllers, using them and loading controller values into views is just the begining. If you want to get started eventually, it would be a better investment to write some helper classes and methods: a popular pattern in the MVC world. Unless you are writing a MVC framework from scratch for fun and I am totally wrong (you said you needed a base to use for your sites ).
Best of luck!
Codeigniter is an open source MVC framework of php.
http://codeigniter.com/user_guide/overview/appflow.html
The major in MVC is first of all your controller class initiated and then calls view.
After google and check how other MVC works I decided to take this route. I redirect all my requests with .htaccess to index.php. Then there I define base paths. After all the definitions I include the core.php which in turn includes all core files to my mvc framework. Then in the same file I create Instances of Registry and router and the game starts from here!
Internals are a bit complex now but that is what I ended with!

Anyone know the Click Framework?

I've been recommended the Click framework from Apache. But I can't find any forums talking about benchmark, reviews, advantages, disavantages, usefulness, ease of implementation, etc.
I've been asked to use it to develop a web site, but I'm completly in the dark about its strengths and weaknesses.
And its damn name isn't helping !! Click ? Hey Apache ! Call your next framework "the" just for fun. I dare you.
So can anyone comment on his experience with Click ?
What I personally like about the Click framework is that it is fairly close to HTML/HTTP and the Servlet API. There is no huge abstraction to get familiar with. You have a Page class, a Form class, ... If you need to preserve state across invocations you put it in the session or you pass it through the URL... This makes it easy to start using it. It is also straightforward to control the HTML pages being generated. It may sound like it is a very basic framework but the simplicity is actually one of it greatest strengths.
Other frameworks (e.g. Seam) are more suitedr to create a very large web application with lots of reusable components and complicated pageflows but the learning curve is much steeper. So for me Click works well for small to medium sized websites.
It's an apache incubator project but that does not mean the project is not stable, rather it reflects that it is in transition to the Apache project model.
Click is Apache's version of a component based web framework equivalent to JSF (other component base Java Frameworks are Tapestry and Wicket)
Click is rated at Ohloh
There is an official blog and some Wikipedia references: Framework Comparision and info page