Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Thank you for resolving design decision, re camelCase and Hungarian notation

$
0
0

I've been playing around with Core 1.0, and noticed that the default ObjectResult serialization for JSON appears to automatically convert my member names into camelCase. Initially I found that pretty annoying (because it broke my ASP.NET 4 AngularJS app entirely), but I think it's probably ultimately a good change, because...

I'd been going back and forth on naming conventions for "model" data (from ASP.NET to AngularJS). Coming from C++, I'm used to Hungarian, but C# doesn't use it (preferring PascalCase, at least initially), and neither does Javascript (preferring camelCase). Initially I'd decided to use PascalCase, owing to the basis of the coding in C#, but obviously Core has broken that, and camelCase feels wrong in "good" code.

Fortunately, Hungarian is compatible with the JSON serialization case mangling, and feels right for "good" code... so I can use Hungarian everywhere and hopefully it will work. I don't know if that was an intentional design push from the ASP.NET designers or not, but it's nice to see Microsoft pushing Hungarian notation again, intentionally or otherwise.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>