6 ms·
from the people who bought you "if you don't want your contacts to use your wifi for free, change your wifi station name to something with "_optout" in the name
by dave2000 10y ago
from the people who bought you "if you don't want your contacts to use your wifi for free, change your wifi station name to something with "_optout" in the name.
They're using pretty shit programmers these days I guess. Don't Apple and Google use pretty smart guys? How were they hoping to catch up with these muppets running the show?
- cm2187 10y agoasp.net MVC is also entirely based on magic strings. They do not seem to read their own best practice guidelines.
- mattmanser 10y agoHow so? If you're going to make a wild claim like this you need to back it up with an example.
- cm2187 10y agoIf you mistype the name of the controller you will get the surprise at runtime: return RedirectToAction("Index","ProductManager", new { id=id }); Same thing in the Razor syntax, the IDE has no way to check that a class you assign to an element exists since it is a magic string instead of being a markup the IDE can validate. @Html.TextBoxFor(m => m.Name, new {@class = "title width-7" }) They built Entity Framework to get away from string based SQL statements and when they redesigned the web stack they went all-in on string based... As a result the IDE is pretty much helpless to spot errors in an asp.net MVC project before you compile (or to provide tooling - forget about renaming a controller).
- nalllar 10y agoT4MVC can help with this: https://github.com/T4MVC/T4MVC https://github.com/T4MVC/T4MVC
- cm2187 10y agoThey also partially fixed that in the new version of MVC by offering a markup alternative to razor (effectively going back to webform's markup syntax!). https://blogs.msdn.microsoft.com/cdndevs/2015/08/06/a-complete-guide-to-the-mvc-6-tag-helpers/ https://blogs.msdn.microsoft.com/cdndevs/2015/08/06/a-comple... Doesn't change the fact that it was bad design in the first place.
- douche 10y agoThis might be a Resharper thing, but I'm pretty sure I see errors in my editor if I try to reference an action or a view that doesn't exist. Although I've mostly bailed on MVC in favor of Nancy, since it's a lot easier to run that through a self-hosted OWIN webservice, rather than dick around with IIS.
- caseymarquis 10y agoNot a fan of Razor. Track down 'Json.net Decycle' and you can deliver your whole vm in javascript. With signalr and some effort you can then dynamically update a frontend object graph via automation (JS makes this easy). I've abstracted this all into a library which uses knockout (I like knockout!!!) for personal use that I'd like to clean up and share someday. You can do the same thing in .net, but you have to use dynamically compiled delegates to make it efficient. You can also make your own fluent style apis if you Google how. Those with dynamically compiled delegates (aka fast reflection) bridge the function to string gap. God I need people to talk to at work...
- cm2187 10y agoThat's all nice but doing it all in javascript (or a any dynamic language) is giving me even less help from the IDE, not more.
- mattmanser 10y agoWhat you're actually asking for is that you want urls and html to be statically typed, neither of which it makes any sense to be. Your first example is a bad example because you simply don't have to use that stuff, they're convenience functions for quick prototyping using the controller names. Action links are urls, that's all, and urls are strings. If it bothers you, with a tiny amount of code in a helper method you can make it all strongly typed, or use the horrific overkill that is T4MVC as suggested in another reply. Personally I completely avoid any MVC method with 'Action' in the method name, I use [Route] attributes and use hand-crafted urls rather than the controller autogenerated stuff. These can, again, all be hidden in nice statically typed helper functions and methods. Your example of `RedirectToAction` is simply a glorified `Redirect`, but the convenience method creates the url for you. That's the good thing, you get to choose. As for razor, it's the equivalent of complaining about misspelling html attributes. The whole reason that they're dynamic is so we can properly add whatever attributes we want to html, just like html allows us too. If we're using angular, we can easily add ng-attributes. If we want to make up a new data-thing-whatever, it will just work. When new attributes are released, we can simply use them without having to upgrade our MVC libraries. The whole point is that you should be able to add it arbitrarily, it's not magic strings, it's dynamic by design. It can't be statically typed. What you're asking for would require a new update for MVC every time they released a new html spec. It would be an utter nightmare.
- jdc0589 10y agoLast time a did a full on MVC app I ended up writing strongly typed extension methods to handle this. I don't suggest everyone do this themselves, System.Linq.Expressions is a deep dark hole, but surely there are some maintained open source packages out there.
- skrebbel 10y agoTrue, and that sucks. But then again, so is Rails. And Ruby and Python and JavaScript.
- cm2187 10y agoI don't know about Rails but for the others I agree. I am not a big fan of dynamic languages in general. It's a matter of taste. Some people only want a notepad and a command line compiler. For those there is really not much difference between a dynamic language or a statically compiled language, and the only difference to them between a magic string and an enum is one more character to type.
- caseymarquis 10y agoVim and a clc, I'll have you know!
- rglullis 10y agoI'd like you and the parent comment to provide one example of "magic strings" in Python and Javascript. Javascript has really bad type coercion, no doubt. But there is nothing on the language that is built upon these concepts. And I don't get the comparison between Rails (a framework that, indeed, does use a lot of "magic" in the naming of the classes) to programming languages.
- cm2187 10y agoIn a dynamic language, every function or property is a magic string since the IDE/Compiler has no way to tell that this function will exist or not until runtime.
- rglullis 10y agoThat's a total stretch. Stop moving goal posts, and please provide one example of function or variable in either python or JS that behaves in some special way only because of the name.
- TeMPOraL 10y ago> Don't Apple and Google use pretty smart guys? How were they hoping to catch up with these muppets running the show? Oh don't worry. Google will definitely add another insult with Android. They outsource dealing the injury to OEMs. As for Apple, I expect the next devices to be able to only connect with Apple's Wi-Fi devices. AFAIR they already did that with Bluetooth file transfer.
- Coding_Cat 10y agoAnd last I checked you cannot use the built-in nfc chip on your iPhone because $reasons.
- gambiting 10y agoHow is it that bluetooth file transfer still comes up in conversations? Obviously I could bring up a personal anecdote about the fact that the last time I have seen anyone using bluetooth for transferring anything was probably in 2005, when I used a nokia 6310i to transfer some contacts. Nowadays if you are on android you touch the phones together and the file is sent by "magic"(since the user doesn't care if it's wi-fi direct or bluetooth), and if you are on iOS you send an email(and again - regular customer doesn't care how the data gets to the other end). Is there really a group of customers who would like to have an explicit option for bluetooth transfer?
- tdkl 10y ago> Nowadays if you are on android you touch the phones together and the file is sent by "magic" Well this magic is actually mostly BT, because not every phone is Wi-fi direct capable. > and if you are on iOS you send an email That's exactly what parent is talking about, this is a "workaround" and not even admissible in all situations. For example, I wanted to print a photo last year on a photo printer in a store, you transfer the file there via BT, select size, then you pay the photo at the counter. After 5 years of Android, I wanted to try out the other side. Sadly I found out that the iPhone doesn't allow that, so I had to email my Android carrying friend the photo and he did it in couple seconds. Also I'd notice that as a user I do care how my data is transferred, specially because every business nowadays wants to offer their computer to serve as the mediator for that - a.k.a. the cloud. So no thanks, I'd rather use a protocol which sends the data locally in the vicinity, instead of shipping it around the globe or buying into proprietary ways of doing that.
- lagadu 10y agoThis is more of a product designer or product owner failure than a developer one.