DarthFubuMVC / fubumvc

A front-controller style MVC framework for .NET
http://fubumvc.github.io
Other
427 stars 151 forks source link

Default convention for finding actions #322

Closed jeremydmiller closed 12 years ago

jeremydmiller commented 12 years ago

If an application does not specify any possible action source or convention for action discovery, FubuMVC will infer that it will search the assembly containing the current FubuRegistry and look for any concrete class suffixed as "Controller"

Discuss ---->

mkmurray commented 12 years ago

Yes, there needs to be an OOTB convention.

chadmyers commented 12 years ago

I'd really like to get away from using the word Controller. FubuMVC is a front controller framework. There is one controller - the framework itself.

The only reason we use the word 'Controller' is to make it easier for converts from ASP.NET MVC and other frameworks.

Rather than encouraging the confusion and prolonging their disorientation when using FubuMVC, I think it's better to get them started on the right foot by getting them used to proper terminology.

Handler, Endpoint, etc. are all better alternatives, IMHO.

chadmyers commented 12 years ago

To be clear, I DO agree there needs to be a default convention. I like this idea very much. The only thing I'm not crazy about is using the word "Controller"

bbehrens commented 12 years ago

Makes sense. Might want to exclude abstract / interface types as well in that search? Once you supply an action source, would you then lose that behavior? IE -- would I still need .IncludeTypesNamed(x => x.EndsWith("Controller") in my FubuRegistry?

On Tue, May 22, 2012 at 8:50 AM, Jeremy D. Miller < reply@reply.github.com

wrote:

If an application does not specify any possible action source or convention for action discovery, FubuMVC will infer that it will search the assembly containing the current FubuRegistry and look for any concrete class suffixed as "Controller"

Discuss ---->


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322

Brandon Behrens 512.659.7171 (c)

ahjohannessen commented 12 years ago

Agree with @chadmyers wrt the suckiness of the name "controller" - handler, action or endpoint are better, imo. @bbehrens would it hurt if it was still present? If it was lost it would not be a big deal to add it explicitly because then one would already doing advanced stuff.

jeremydmiller commented 12 years ago

*****Endpoint

-- or --

*****Handler -- I don't like this one because it causes confusion w/ the Handler convention

-- or --

*****Action

/

*****Actions

???


From: Alex Henning Johannessen reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 4:32:51 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

Agree with @chadmyers wrt the suckiness of the name "controller" - handler, action or endpoint are better, imo. @bbehrens would it hurt if it was still present? If it was lost it would not be a big deal to add it explicitly because then one would already doing advanced stuff.


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5859582

bbehrens commented 12 years ago

@Alex -- It would help me if it was still present. I see that as desired behavior.

On Tue, May 22, 2012 at 5:30 PM, Jeremy D. Miller < reply@reply.github.com

wrote:

*****Endpoint

-- or --

*****Handler -- I don't like this one because it causes confusion w/ the Handler convention

-- or --

*****Action

/

*****Actions

???


From: Alex Henning Johannessen reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 4:32:51 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

Agree with @chadmyers wrt the suckiness of the name "controller" - handler, action or endpoint are better, imo. @bbehrens would it hurt if it was still present? If it was lost it would not be a big deal to add it explicitly because then one would already doing advanced stuff.


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5859582


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5860784

Brandon Behrens 512.659.7171 (c)

jeremydmiller commented 12 years ago

Brandon,

I'm thinking that the default behavior only applies if there is no other explicit configuration/policy for action discovery.


From: Brandon Behrens reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 6:56:17 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

@Alex -- It would help me if it was still present. I see that as desired behavior.

On Tue, May 22, 2012 at 5:30 PM, Jeremy D. Miller < reply@reply.github.com

wrote:

*****Endpoint

-- or --

*****Handler -- I don't like this one because it causes confusion w/ the Handler convention

-- or --

*****Action

/

*****Actions

???


From: Alex Henning Johannessen reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 4:32:51 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

Agree with @chadmyers wrt the suckiness of the name "controller" - handler, action or endpoint are better, imo. @bbehrens would it hurt if it was still present? If it was lost it would not be a big deal to add it explicitly because then one would already doing advanced stuff.


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5859582


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5860784

Brandon Behrens 512.659.7171 (c)


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5862081

bbehrens commented 12 years ago

Ok, that makes sense. What's your motivation with introducing that default behavior in the first place? Is it to make stuff easier for people trying to get their feet wet with Fubu so they don't have to worry about action discovery with whatever they choose to do with Hello World? I'm thinking that because I feel like projects beyond that quickly develop the need for a convention beyond "things that end with controller". Since it only applies if there's no explicit configuration you don't intend for it to be used in those scenarios.

What did you think about my suggestion to exclude abstract classes and interfaces from the default behavior in addition to the ends with controller convention?

On Tue, May 22, 2012 at 8:18 PM, Jeremy D. Miller < reply@reply.github.com

wrote:

Brandon,

I'm thinking that the default behavior only applies if there is no other explicit configuration/policy for action discovery.


From: Brandon Behrens reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 6:56:17 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

@Alex -- It would help me if it was still present. I see that as desired behavior.

On Tue, May 22, 2012 at 5:30 PM, Jeremy D. Miller < reply@reply.github.com

wrote:

*****Endpoint

-- or --

*****Handler -- I don't like this one because it causes confusion w/ the Handler convention

-- or --

*****Action

/

*****Actions

???


From: Alex Henning Johannessen reply@reply.github.com

To: Jeremy D. Miller jeremydmiller@yahoo.com Sent: Tue, May 22, 2012 4:32:51 PM Subject: Re: [fubumvc] Default convention for finding actions (#322)

Agree with @chadmyers wrt the suckiness of the name "controller" - handler, action or endpoint are better, imo. @bbehrens would it hurt if it was still present? If it was lost it would not be a big deal to add it explicitly because then one would already doing advanced stuff.


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5859582


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5860784

Brandon Behrens 512.659.7171 (c)


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5862081


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5863051

Brandon Behrens 512.659.7171 (c)

jeremydmiller commented 12 years ago

Brandon,

We need to be a bigger community to be viable over the longer term. I think Fubu comes out looking bad compared to something like NancyFx because our getting started story isn't as good and our concept count is so much higher. If you could be churning out working screens and endpoints faster, I think we compete better.

I definitely think fubumvc is much more capable than our competitors, but we probably shouldn't lead with all the advanced "look ma, I wrote my very own convention"

bbehrens commented 12 years ago

100% agree with that. I think my last message might have made you think I didn't. I was just asking who the target audience was.

On Wed, May 23, 2012 at 3:46 PM, Jeremy D. Miller < reply@reply.github.com

wrote:

Brandon,

We need to be a bigger community to be viable over the longer term. I think Fubu comes out looking bad compared to something like NancyFx because our getting started story isn't as good and our concept count is so much higher. If you could be churning out working screens and endpoints faster, I think we compete better.

I definitely think fubumvc is much more capable than our competitors, but we probably shouldn't lead with all the advanced "look ma, I wrote my very own convention"


Reply to this email directly or view it on GitHub: https://github.com/DarthFubuMVC/fubumvc/issues/322#issuecomment-5884158

Brandon Behrens 512.659.7171 (c)

uluhonolulu commented 12 years ago

As a recent convert to FubuMVC, I was able to get started pretty fast, because the default NuGet package included the explicit configuration, plus some comments. Now, there's a lot of implicit configuration that's just added by default; in order to figure it out, I had read the source code. But providing the sensible defaults in an editable form, together with the awesome configuration API, sold me immediately, because I could immediately figure what's going on, and make an informed decision. That's not because I'm one of the smartest guys in the world, but because I can read plain English and know what Action and View means.

Now, if I'm stupid enough to delete all the startup code that you guys gave me, and all of a sudden I don't have any actions registered, that's my voluntary decision. Perhaps I don't deserve a fallback configuration, perhaps I do, that depends on your infinite compassion. My point is, if you want a quick start for absolute beginners, you already have it. Having it explicitly written in the default bootstrap code makes the learning process simpler.

What would help starting churning out working screens and endpoints faster IMO is a Project Template. Perhaps (don't laugh) something like Asp.Net MVC does, with home and login and such. Because there are other things that are harder to figure out then the action discovery. For example, the Asset management stuff. If we had a project template with an asset.config added and jquery included, I believe it would help people a lot to get started.

emiaj commented 12 years ago

I have said it before: http://solutionfactory.codeplex.com/

emiaj commented 12 years ago

Before going to dinner, spiked something quickly, to be honest, solutionfactory didn't helped me that much. Took me around 2 hours to finish this, the tricky part was to figure out how to include the nuget packages into the vs project template. https://github.com/emiaj/FubuMvcSparkProjectTemplate

emiaj commented 12 years ago

A good article explaining the tricky parts: http://www.bluelemoncode.com/post/2012/01/20/Creating-custom-project-template-for-Visual-Studio-with-pre-installed-NuGet-packages.aspx

uluhonolulu commented 12 years ago

Just tried it. I think this is perfect.