In a strongly typed world, why is ASP.NET MVC not a fragile dependency on naming conventions frowned?

Since forever, strongly typed objects have been the basis of object-oriented programming. Fast-forward up to 5 minutes ago when working with Entity Framework and MVC3 I was forced to add this to my Web.config:

<connectionStrings> <add name="_MY_EXACT_CLASS_NAME_DbContext" connectionString="Data Source=blahblah.../> </connectionStrings> 

Great, my whole application depends on an arbitrary name in the XML attribute. Is this really what modern programming looks like? The lack of a class name is a serious violation, one of which leads us directly to commit, but in this case I just get a runtime error. If Mr. called the message about the exceptional situation a good mood, he will point me towards Mordor, and I will trudge to the other Doom mountain, spent working hours to destroy the invisible rule of the same type for everyone. / p>

The same goes for controllers:

 routes.MapRoute("BE_CAREFUL","{controller}/{action}/{id}", new { controller = "ONE_FALSE_MOVE_AND", action = "BUT_I_SWEAR_IT_SAID_BUILD_SUCCEEDED" } ); 

Everything seems to come and go in waves. Strongly printed objects had their day in the sun, and now we are all girls next to the anonymous "var." I admit that by gossiping about your type, you are aroused by many sexual scenarios - especially knowing that you do not need to do any tuning tasks - but here. Actual question:

How do the ancestors of object-oriented programming feel our “advancement” of their art, adding a bunch of desirable styles, do-sorta - regardless of anonymous constructions and at the same time creating fragile dependencies on the naming convention?

For everyone we know, MVC4 may suddenly require that all names be preceded by exactly 4.7 spaces, followed by the art of AOL LOLCAT ASCII. What for? Because yes, that’s why. Take a moment and marvel at the fact that you have just witnessed the birth of a naming convention. Obviously, this is a serious fundamental material for the flagship structure.

So, if there is one thing, I want my whole code base to be functionally and philosophically dependent, there is nothing more important for mathematical programming logic than ... Microsoft® naming conventions for English!

 </sarcasm> </griping> <!-- resume enjoying all of MVC amazing features, after eating any humble pie served up in the comments --> 
+4
source share
2 answers

My entire application depends on an arbitrary name in the XML attribute.

This is called "convention by convention" or "configuration convention" ... you select a few things that need to be set up, and then everything else just "falls into place." Like using a razor and having _layout.cshtml in / views / shared. Or, for example, use a razor and have mySpecialController with ActionResult Index and /views/mySpecial/Index.cshtml ... this is just a way to let you work.

Since forever, strongly typed objects have been the basis of object-oriented programming. Strongly printed objects had their day in the sun, and now we are all girls next to the anonymous "var."

var variables are just a shorthand to make things a little more readable, the compiler still strongly and statically injects things at compile time. Consider the difference here:

 foreach (var c in Customers) { /* do stuff */ } foreach (CustomerDataItem customerDataItem in Customers) { /* do stuff */ } 

As you can see, the first one says: “Receive the element c from the customers”, and the second one says the same thing, but a good man-lord. I already wrote two more lines of code while you are still printing a long one. Of course, with ReSharper this advantage disappears, however ...

For everyone we know, MVC4 may suddenly require that all names be preceded by exactly 4.7 spaces, followed by the art of AOL LOLCAT ASCII. What for? Because yes, that’s why.

Har.

How do ancestors of object-oriented programming feel our “advancement” of their art, adding a bunch of stylish, do-sorta-anonymous constructs and at the same time creating fragile dependencies on naming conventions?

Okay, so that was mostly a disappointment, but I will bite. The guys who started work need a simpler code (BASIC, COBOL to see what this means), and therefore they want things to be simpler and more mathematically. Where things move (LINQ is a given math and higher order calculus, also see F # and Python)

Therefore, they will LOVE what we are doing now. Get out of the procedural code (algebra) and switch to set-oriented logic (adv calculus). Also see Event Handlers ;-)


So, having said all this: I was in your place. I asked these questions. I studied at the feet of the masters. I like where the languages ​​go.

In the next life, I want you to learn about node.js. I want you to learn asynchronous processing, and I want you to understand how they no longer rely on ANSI-C. We have made great progress in this industry and everything is going up. Things look every day. I love where we are and I think that is right for our industry.

Cheers and hth.

+2
source

My answer is "because of successes in automated testing."

0
source

All Articles