|
I think the horror is using the ViewBag that much or even at all.
|
# ? Dec 15, 2014 19:04 |
|
|
# ? May 24, 2024 23:18 |
|
nuvan posted:That isn't XOR. This is XOR. I like to visualize the two-argument truth functionals as a 16-long table code:
Pretty sure this is all in Knuth somewhere. Also I can never remember what implies what in 2 4 11 and 13 but who ever uses those.
|
# ? Dec 15, 2014 19:06 |
|
Chill Callahan posted:I think the horror is using the ViewBag that much or even at all. I'm leaning towards it being the lack of code tags.
|
# ? Dec 15, 2014 19:57 |
|
C# code:
|
# ? Dec 15, 2014 20:01 |
|
Honest Thief posted:The problem is they have a method signature setting, I guess, the flag to false to force the new logic, and yet kept the method signature as it is and the whole code. Because, I dunno. The only other place its used the flag is always true, so I dunno, either it's leftover code from whenever or.. It's not forcing the flag to false, it's setting a default value, so if a caller doesn't specify the flag it'll be false, but if they want it to be true they can set it.
|
# ? Dec 15, 2014 20:12 |
|
This is a dangerous thread to post in. If you're going to post a horror, you better know your poo poo!
|
# ? Dec 15, 2014 20:13 |
|
Knyteguy posted:
For what it's worth, the activity indicator in a browser used to be called a "throbber." Dating back to when Netscape 1.0 used a throbbing N.
|
# ? Dec 15, 2014 20:15 |
|
Chill Callahan posted:I think the horror is using the ViewBag that much or even at all. This sort of thing ain't my Bag baby!
|
# ? Dec 15, 2014 20:38 |
|
Oh ViewBag is an actual Thing? I thought it was hilariously lovely naming for that particular method. My bad. what the hell is a ViewBag?
|
# ? Dec 15, 2014 20:56 |
|
A ViewBag is what they put your models in when you buy them at the data store
|
# ? Dec 15, 2014 21:02 |
|
I've brought shame to my (un)fabled .net skills, but it still makes no sense to me since the method is only called twice, and in both cases they explicitly set the flag.
Honest Thief fucked around with this message at 21:12 on Dec 15, 2014 |
# ? Dec 15, 2014 21:04 |
|
fritz posted:I like to visualize the two-argument truth functionals as a 16-long table Let's express this in boolean logic, because! (also, added the implications you mentioned [I hope I'm remembering all my logic right]) | (0,0) | (0,1) | (1,0) | (1,1) | Logical Statement ------------------------------------------------------- | 0 | 0 | 0 | 0 | A ∧ ¬A | 0 | 0 | 0 | 1 | A ∧ B | 0 | 0 | 1 | 0 | A ∧ ¬B [aka ¬(A → B)] | 0 | 0 | 1 | 1 | A ------------------------------------------------------- | 0 | 1 | 0 | 0 | ¬A ∧ B [aka ¬(B → A)] | 0 | 1 | 0 | 1 | B | 0 | 1 | 1 | 0 | (A ∨ B) ∧ ¬(A ∧ B) [aka ¬(A ↔ B)] | 0 | 1 | 1 | 1 | A ∨ B ------------------------------------------------------- | 1 | 0 | 0 | 0 | ¬(A ∨ B) | 1 | 0 | 0 | 1 | ¬(A ∨ B) ∨ (A ∧ B) [aka A ↔ B] | 1 | 0 | 1 | 0 | ¬B | 1 | 0 | 1 | 1 | A ∨ ¬B [aka B → A] ------------------------------------------------------- | 1 | 1 | 0 | 0 | ¬A | 1 | 1 | 0 | 1 | ¬A ∨ B [aka A → B] | 1 | 1 | 1 | 0 | ¬(A ∧ B) | 1 | 1 | 1 | 1 | A ∨ ¬A ------------------------------------------------------- Would have put the logical expressions first, but it turns out that the logical-and/logical-or symbols aren't actually fixed width like everything else.
|
# ? Dec 15, 2014 21:05 |
|
pokeyman posted:what the hell is a ViewBag? It's kind of a dynamic object container for holding whatever you want. Generally it's used for small things like ViewBag.PageTitle = "fooTitle" for a webpage title tag, but anything after the "." can be an object, so you can make ViewBag.Foo = new string[]{}, ViewBag.Bar = "", ViewBag.Baz = 1, etc. Not sure if ViewBag.Class works but that'd be coding horror territory since viewmodels work much better here. The ViewBag is automatically instantiated* with your data in the view, so you can call it by the same convention like <title>@ViewBag.PageTitle</title> * It might be static instead of instantiated, and perhaps data is flushed every time a view is called? I've never tested. Knyteguy fucked around with this message at 22:23 on Dec 15, 2014 |
# ? Dec 15, 2014 22:19 |
Knyteguy posted:It's kind of a dynamic object container for holding whatever you want. Generally it's used for small things like ViewBag.PageTitle for a webpage title tag, but anything after the "." can be an object, so you can make ViewBag.Foo = new string[]{}, ViewBag.Bar = "", etc. Not sure if ViewBag.Class works but that'd be coding horror territory since viewmodels work much better here. So it's a dictionary for passing stuff into templates? Except not really a dictionary because that would be too easy?
|
|
# ? Dec 15, 2014 22:21 |
|
nielsm posted:So it's a dictionary for passing stuff into templates? Except not really a dictionary because that would be too easy? Basically yea. I'm not sure why they didn't use a dictionary? The syntax is a little easier for new programmers I guess. It might have a couple advantages over a normal dictionary? Maybe someone else can chime in. Here's a little more info: http://www.codeproject.com/Articles/476967/WhatplusisplusViewData-cplusViewBagplusandplusTem Again though sending an instantiated ViewModel for property values is generally preferred, except for small things that every page potentially will have, but is also different from every other page, like a page title. Or at least that's how we use it unless someone gets lazy. Knyteguy fucked around with this message at 22:33 on Dec 15, 2014 |
# ? Dec 15, 2014 22:31 |
|
nuvan posted:Would have put the logical expressions first, but it turns out that the logical-and/logical-or symbols aren't actually fixed width like everything else. "&" "|" and "~" have always been good enough for me.
|
# ? Dec 15, 2014 22:35 |
|
Honest Thief posted:I've brought shame to my (un)fabled .net skills, but it still makes no sense to me since the method is only called twice, and in both cases they explicitly set the flag. If using the default argument is conceptually sensible, then refactoring it out just because it's not used Right Now is totally sane. Narrowing interfaces for the sake of narrowing them isn't often a good use of time.
|
# ? Dec 15, 2014 22:53 |
|
nielsm posted:So it's a dictionary for passing stuff into templates? Except not really a dictionary because that would be too easy? It kinda sorta is a dictionary. The ViewBag and ViewData contain the same data, they just represent 2 different ways of accessing it. ViewBag acts as a dynamic expando object (it's not only accessed dynamically, but members can also be added and removed at runtime). ViewData acts as a Dictionary<string, object>. So ultimately the difference is just in how you access it. ViewBag.Something = "whatever" is equivalent to ViewData["Something"] = "whatever" And seeing as they refer to the same data you could do something like this: code:
Knyteguy posted:* It might be static instead of instantiated, and perhaps data is flushed every time a view is called? I've never tested. It's instantiated per request[1] and carries over when rendering the view, and is automatically passed to partial views and display/editor templates when they're rendered. I'm not sure if the data is maintained when calling Html.RenderAction/Html.Action from within a view though. All that said, strongly type ViewModels are definitely the way to go for most cases. I only use it when I need to pass data between partial views (or templates) and for whatever reason I can't use a model. [1] Strictly speaking this isn't true, but it's true enough dwazegek fucked around with this message at 01:29 on Dec 16, 2014 |
# ? Dec 16, 2014 01:25 |
|
Cool thanks for the info you viewbags!
|
# ? Dec 16, 2014 05:26 |
|
Honest Thief posted:I've found classes commented whole and kept around for what I guess passes as stashing. This really grinds my gears and is something I delete with prejudice when encountered.
|
# ? Dec 16, 2014 09:33 |
|
pokeyman posted:Cool thanks for the info you viewbags! I believe the proper term is array of butthandles.
|
# ? Dec 16, 2014 13:13 |
|
Wheany posted:This really grinds my gears and is something I delete with prejudice when encountered. I've failed people in code reviews for doing this.
|
# ? Dec 16, 2014 16:27 |
|
Ithaqua posted:I've failed people in code reviews for doing this. How would that even work? Do they need to do pushups or run around like a chicken? Have to do the dishes? You might be shocked to hear I've never seen a code review.
|
# ? Dec 16, 2014 20:01 |
|
KARMA! posted:How would that even work? Do they need to do pushups or run around like a chicken? Have to do the dishes? You reject the code, which means the patch/branch won't get merged into the main repo, without further changes or fixes. I 100% apply the same policy. Having obsolete commented out code is basically saying you don't know how version control works.
|
# ? Dec 16, 2014 20:06 |
|
Was getting FileNotFoundExceptions out of nowhere that I tracked down to a method that looked something like this:code:
|
# ? Dec 17, 2014 01:47 |
|
Flobbster posted:Was getting FileNotFoundExceptions out of nowhere that I tracked down to a method that looked something like this: What is even the purpose of caching the input?
|
# ? Dec 17, 2014 02:14 |
|
Ithaqua posted:What is even the purpose of caching the input? I assumed the TTS software was generating an audio file, and this was deriving a filename for that.
|
# ? Dec 17, 2014 02:16 |
|
Skuto posted:You reject the code, which means the patch/branch won't get merged into the main repo, without further changes or fixes. Unless the commented out code represents another approach to something and still may be useful for reference/future usage, in which case a simple "// leaving this here for reference XXX" is a nice alternative to digging through revision history. Leaving whole defunct classes is a bit extreme but not totally without basis.
|
# ? Dec 17, 2014 06:16 |
|
speng31b posted:Unless the commented out code represents another approach to something and still may be useful for reference/future usage, in which case a simple "// leaving this here for reference XXX" is a nice alternative to digging through revision history. Leaving whole defunct classes is a bit extreme but not totally without basis. You're wrong, but I'm sure you're still a pretty nice person. If you want to write a doc then write a doc and link it from a comment. "still may be useful" is not nearly a high enough bar to take up precious understanding/scanning effort for code. (You usually have to read all of such a comment to understand whether it's relevant to what you're doing, in my experience, and I always wonder if I'm supposed to update it for refactorings and such.)
|
# ? Dec 17, 2014 06:47 |
|
Subjunctive posted:You're wrong, but I'm sure you're still a pretty nice person. Yeah I'm a pretty nice person. I guess I mostly just find this useful when a feature is under active development. If the code was stable and I was done with it, I wouldn't commit my changes and leave the comment there forever. Take for instance, I've half-finished a feature and my coworker has to pick it up while I'm on vacation. I might leave chunks of functionality commented out until the unit/feature was at least somewhat complete. Not as a permanent addition to the code to leave future maintainers guessing forever.
|
# ? Dec 17, 2014 07:12 |
|
speng31b posted:Yeah I'm a pretty nice person. I guess I mostly just find this useful when a feature is under active development. If the code was stable and I was done with it, I wouldn't commit my changes and leave the comment there forever. Sounds like you want a feature branch?
|
# ? Dec 17, 2014 07:15 |
|
Subjunctive posted:Sounds like you want a feature branch? Yeah, am I allowed to leave commented out code in commits to a feature branch?
|
# ? Dec 17, 2014 07:18 |
|
speng31b posted:Yeah, am I allowed to leave commented out code in commits to a feature branch? No, just leave the code in its interim state for your co-worker to pick up.
|
# ? Dec 17, 2014 07:19 |
|
Subjunctive posted:Sounds like you want a feature branch? The specific thing desired is to have two chunks of code effectively side-by-side. Comparing "current" to "old" using your source control system is pretty easy, but just commenting one out is even easier.
|
# ? Dec 17, 2014 07:23 |
|
Subjunctive posted:No, just leave the code in its interim state for your co-worker to pick up. I think that somewhere on a sliding scale between between leaving entire dead units to haunt all future maintainers and relentlessly pruning all potentially impractical comments from a feature that's a work in progress there may be a compromise that isn't a horror? Sorry I didn't mean to phrase that as a question. Please don't flunk me on my code review or make mean commit comments about me as you passive aggressively clean up my code with pure style commits to my feature branch.
|
# ? Dec 17, 2014 07:27 |
|
I'm super guilty about commenting out chunks of code and checking it in while I'm doing the most basic integration testing, but it gets cleaned up before the branch gets merged or forked.
|
# ? Dec 17, 2014 07:34 |
|
GrumpyDoctor posted:The specific thing desired is to have two chunks of code effectively side-by-side. Comparing "current" to "old" using your source control system is pretty easy, but just commenting one out is even easier. Honestly I'd prefer looking at it in source control where I can see the exact differences annotated with the commit messages that introduced those changes Staring at a completely rewritten bit of code and trying to divine which differences are relevant and which are just cosmetic isn't my idea of a good time.
|
# ? Dec 17, 2014 07:34 |
|
Skuto posted:You reject the code, which means the patch/branch won't get merged into the main repo, without further changes or fixes. My first exposure to a crucible review was not too bad, a couple of typos and a missing reference number that was it. Until i was included in another persons review as a reviewer: OMG... he was ripped a new one with over 20 defects and being ripped apart for the way he did his solution. I got off easy.
|
# ? Dec 17, 2014 08:12 |
|
speng31b posted:a feature that's a work in progress Yeah we've got a half dozen developers with nothing better to do but yank your keyboard away at an arbitrary point in the process that you had no choice in selecting, not even a warning. That's totally a situation that happens all the time and appropriate for a code review. I've failed someone for being in Insert mode and using the arrow keys to navigate.
|
# ? Dec 17, 2014 08:14 |
|
|
# ? May 24, 2024 23:18 |
|
return0 posted:I used to work at this company where another team had a product and the web API for it would return 200 with a status/error string even in the presence of client or server errors, I asked why they didn't return 4xx/5xx as appropriate and they gave some long implausible sounding reason I can't remember. oh cool you used to work with everyone else on my current project
|
# ? Dec 17, 2014 18:24 |