|
yaoi prophet posted:Ahahaha. Wow I suck at reading .
|
# ? May 30, 2012 05:51 |
|
|
# ? May 14, 2024 19:06 |
|
Look Around You posted:Wow I suck at reading . My point was "Guys this totally isn't OCaml's Option or Haskell's Maybe!!!" even though it's the exact same concept (except worse because you can't just write x >>= f or whatever you'd write in OCaml, you have to do some ungodly anonymous inner class hack). Java code:
Opinion Haver fucked around with this message at 05:54 on May 30, 2012 |
# ? May 30, 2012 05:52 |
|
Internet Janitor posted:json.org lists parsers for ASP, ActionScript, Bash, BlitzMax, C, C++, C#, Clojure, Cobol, ColdFusion, D, Delphi, E, Erlang, Fantom, Go, Haskell, HaXe, Java, JavaScript, Lisp, LotusScript, Lua, Matlab, Objective-C, OCaml, OpenLaszlo, Perl, PHP, Pike, PL/SQL, PowerShell, Prolog, Puredata, Python, Qt, R, Racket, Rebol, RPG, Ruby, Scheme, Squeak, Symbian, Tcl, VisualBasic and Visual FoxPro, and most of those languages offer several implementations to pick from. It's pretty available. On top of that, there definitely has been growth in high-performance JSON serializing/deserializing in the last year. For example there's UltraJson for Python and JSONKit for Objective-C, which have order-of-magnitude differences in parse times in some cases. This is probably a good time to note that it's a lot easier to incentivize this sort of high-performance work when the spec isn't changing all the goddamn time.
|
# ? May 30, 2012 10:28 |
|
Ender.uNF posted:I have to write these APIs and just like relying on the user to make security decisions is an automatic failure, relying on the programmer to read and fully comprehend the docs is doomed from the start. I have no desire to reinvent XML (or God forbid XSD) but some basic ability to describe my API in a standardized way would be extremely helpful. Depending on my library/platform, it could even be automatic and verified by the compiler to match the code (to some degree). There is a standardised way to describe an API, it's called English. Sure there's a margin of error depending on how well your dudes write and read but this margin grows smaller the better they cooperate with each other. On the other hand making people try and comprehend specs goes a long way towards catching design errors early on. Relying too much on tools to autogenerate and verify your stuff only leads to a false sense of security of "Welp, it compiles. Time to move on" The big selling point of XML was that it's machine-readable and platform-agnostic. In my opinion this is all moot as long as we still have people writing code. And that code is bound by esoteric implementation details. So the easier it is for humans to grasp the structure and layout of data the better.
|
# ? May 30, 2012 11:32 |
|
If you want a machine-checked autogenerated-tooling interchange format, there's literally nothing wrong with using XML for that! Moving to a new technology just because it's new, even if it doesn't quite fit what you're trying to do with it, is a pretty big horror.
|
# ? May 30, 2012 12:10 |
|
Look Around You posted:I think the fact that the method is called SetNull is horrible. I would have no idea what s = SetNull(s) would mean in code. And it's not even static? Yup. I also like the redundant check if (s == "") return "";. That entire first if could be replaced by if (string.IsNullOrEmpty(s)) { } It has a lot of layers of "wtf".
|
# ? May 30, 2012 13:24 |
|
ultramiraculous posted:On top of that, there definitely has been growth in high-performance JSON serializing/deserializing in the last year. For example there's UltraJson for Python and JSONKit for Objective-C, which have order-of-magnitude differences in parse times in some cases. This is probably a good time to note that it's a lot easier to incentivize this sort of high-performance work when the spec isn't changing all the goddamn time. If there's one thing I wish I could change about JSON is ability to have trailing commas. I'm too used to Python dictionaries and it fucks me over every time.
|
# ? May 30, 2012 14:49 |
|
Ithaqua posted:Yup. I also like the redundant check if (s == "") return "";. That entire first if could be replaced by if (string.IsNullOrEmpty(s)) { }
|
# ? May 30, 2012 15:08 |
|
Found this today while trying to determine a specific sector in some other team's solution:code:
|
# ? May 30, 2012 16:36 |
|
xf86enodev posted:There is a standardised way to describe an API, it's called English. Sure there's a margin of error depending on how well your dudes write and read but this margin grows smaller the better they cooperate with each other. So how's that hint/intellisense working out for you when you are four layers deep into a complex JSON structure and can't remember the field name? Or the value is a choice between 6 possibilities? Just look it up on the web right? So why bother having intellisense at all? Most people who miss my point never have to work with data structures more complex than a twitter post, picture upload, or blog entry so they imagine the world to be just that simple. I'm not saying you are guilty of that though, it's just a general observation. JSON is worth using because browswers have parsers for it and because using REST it traverses proxies, firewalls, etc. It has other benefits but those are significant when you want to be as broad as possible in your support. The same API can service some web widget and an integration partner. You don't have a mile-long config file (ugh WCF you rear end in a top hat). I merely wished for an agreed-upon standard way to describe a REST API over HTTP and JSON data structures using JSON itself. I don't feel like that adds much complexity/overhead and you are certainly free to ignore it if you don't have a use for it. One example of what I am invisioning is a tool that can scan the JSON structure and automatically create an appropriate CoreData backing store and Objective-C classes and insert the boilerplate RESTKit code for you, including stuff like enum values. That doesn't free you from writing the docs or having to understand the API, but it does give you caching, offine editing, querying, and a bunch of other stuff without having to manually create the entities and keep them in sync with the JSON, or manually creating the RESTKit mapping.
|
# ? May 30, 2012 17:27 |
|
Ender.uNF posted:One example of what I am invisioning is a tool that can scan the JSON structure and automatically create an appropriate CoreData backing store and Objective-C classes and insert the boilerplate RESTKit code for you, including stuff like enum values. That doesn't free you from writing the docs or having to understand the API, but it does give you caching, offine editing, querying, and a bunch of other stuff without having to manually create the entities and keep them in sync with the JSON, or manually creating the RESTKit mapping. Not quite Objective-C, but I've used this before with good results.
|
# ? May 30, 2012 18:19 |
|
PHP code:
|
# ? May 30, 2012 18:20 |
|
Captain Capacitor posted:Not quite Objective-C, but I've used this before with good results. I prefer Jackson, myself, but that's probably beside the point since RestKit does more than just JSON<->Object mapping.
|
# ? May 30, 2012 18:40 |
|
I don't know if I should be more terrified at this response from mint: Or my bank issuing captchas that are all four letter dictionary words, use the same color palette, and look like this: Edit: Wagers on when this gets deleted? http://satisfaction.mint.com/mint/topics/mints_password_storage_cannot_handle_certain_characters_this_is_a_sign_of_a_security_vulnerability xarph fucked around with this message at 18:57 on May 30, 2012 |
# ? May 30, 2012 18:54 |
|
I like their issue report comment system.
|
# ? May 30, 2012 18:59 |
|
Ithaqua posted:That entire first if could be replaced by if (string.IsNullOrEmpty(s)) { } String.IsNullOrEmpty hasn't always been around, so that bit's not as much of a wtf.
|
# ? May 30, 2012 19:32 |
|
prolecat posted:String.IsNullOrEmpty hasn't always been around, so that bit's not as much of a wtf. Checking for "" isn't really necessary though, since it's already a string. All he really had to do is check for null and return "" if it was null. It really shouldn't be a function at all; s = s ?? ""; is better if you have a null coalescing operator, or s = (s != null) ? s : ""; if you don't.
|
# ? May 30, 2012 19:41 |
|
prolecat posted:String.IsNullOrEmpty hasn't always been around, so that bit's not as much of a wtf. It's been around since .NET 2.0 in 2005, and the application I found the code in was considerably newer than that. IsNullOrWhitespace is new to .NET 4, so I'll give you that.
|
# ? May 30, 2012 19:48 |
|
Look Around You posted:Checking for "" isn't really necessary though, since it's already a string. All he really had to do is check for null and return "" if it was null. It really shouldn't be a function at all; s = s ?? ""; is better if you have a null coalescing operator, or s = (s != null) ? s : ""; if you don't. Yeah, I wasn't defending that bit.
|
# ? May 30, 2012 22:00 |
|
xarph posted:Wagers on when this gets deleted? This isn't necessarily as bad as you think. They could have recently disallowed certain characters and might just be lazily forcing password changes when you login if your pass contains those characters. If they sent you this without you logging in though, that's terrible.
|
# ? May 30, 2012 22:55 |
|
the talent deficit posted:This isn't necessarily as bad as you think. They could have recently disallowed certain characters and might just be lazily forcing password changes when you login if your pass contains those characters. If they sent you this without you logging in though, that's terrible. If there is an actual reason to disallow certain characters in passwords then yes they are absolutely doing something wrong.
|
# ? May 30, 2012 23:14 |
|
Ender.uNF posted:So why bother having intellisense at all? That's a good one. I don't use intellisense et al. Sure, I use auto-completion to speed up my typing but there just isn't a tool that can take away my responsibility to "get the big picture". Sometimes I take notes on a piece of paper if things get too complicated or on days when there are too many distractions. But when data structures or pieces of business logic get to big to be handled by a human being that's a design error. xf86enodev fucked around with this message at 01:26 on May 31, 2012 |
# ? May 31, 2012 01:19 |
|
xf86enodev posted:That's a good one. I don't use intellisense et al. Sure, I use auto-completion to speed up my typing but there just isn't a tool that can take away my responsibility to "get the big picture". Sometimes I take notes on a piece of paper if things get too complicated or on days when there are too many distractions. So you are reframing your avoidance of productivity enhancements as somehow my failure to understand the big picture? What does understanding the big picture have to do with using tools (or even code) to generate code? Are you pre-supposing that if I use a tool to auto-generate classes from specs I can't possibly understand how the underlying mechansim and protocols work? You also seem to be mixing up "big picture" with "menial copy-paste from the API spec". Who said the problems you are capable of imagining fully represent the desirable design spaces? Just because you haven't worked with complicated systems doesn't mean they don't exist or even that they are inelegantly designed. I am trying to be careful of accusing you of being an rear end here but it really seems like you are being one of those web 2.0 asses that think anything more complex than a twitter post is too complicated. News flash: you try designing an interface for accurately transmitting medical records and tell me you memorized all the categories, status codes, routing codes, etc. Or a students school records. Or an 850 order for telephone service. Or a multi-hundred-GB multidimensional data set with dynamically calculated recursive properties on a distributed real-time system that versions, branches, and merges data (not code!). I've worked on all of these... Some were less elegant than others but all were extremely complex real-world systems that no one person can ever know everything about which is precisely why I loving focus on the big picture and let the compiler/tools do the menial poo poo for me (unless there is a low-level problem in which case I disassemble the libraries, grab packets with wireshark, or do whatever else is needed to solve the problem because using high-level tools doesn't mean I don't understand how the whole system works).
|
# ? May 31, 2012 02:15 |
|
Sorry dude, I said in my first post that it wasn't directed at you personally. And I certainly didn't mean to imply you don't know how to build software. Sure I used your last reply to sound all but seriously I was just trying to argue a general topic. (Well it was more ranting than anything else but eh) e: Ender.uNF posted:Just because you haven't worked with complicated systems doesn't mean they don't exist or even that they are inelegantly designed. Anyway this doesn't seem to be about XML vs JSON anymore so if you want to keep the discussion going feel free to PM me.
|
# ? May 31, 2012 03:51 |
|
xf86enodev posted:I don't use intellisense Wait, these aren't the same thing? Am I missing something big here?
|
# ? May 31, 2012 04:44 |
|
epswing posted:Wait, these aren't the same thing? Am I missing something big here? I would usually consider intellisense as something that's context sensitive, while autocomplete is just dumb word-completion that's not context aware at all.
|
# ? May 31, 2012 04:49 |
|
Look Around You posted:I would usually consider intellisense as something that's context sensitive, while autocomplete is just dumb word-completion that's not context aware at all. :| IntelliSense is Microsoft's branded autocomplete. Eclipse calls it content assist, but autocomplete is pretty much the accepted term. Now let's stop and post about horrors, instead of turning this thread into one.
|
# ? May 31, 2012 05:08 |
|
Calling IntelliSense and its ilk a high-level tool is the real horror here. For future reference, it might be interesting to use 'simple/complex' and 'easy/hard' as was defined by Rich Hickey: http://www.infoq.com/presentations/Simple-Made-Easy e.g. Forth is simple, but hard; Ruby on Rails is complex, but easy.
|
# ? May 31, 2012 09:23 |
|
Doh004 posted:Found this today while trying to determine a specific sector in some other team's solution: I scrolled along this with a rapidly-expanding grin on my face.
|
# ? May 31, 2012 10:53 |
|
xarph posted:I don't know if I should be more terrified at this response from mint: Couldn't the problem be on your bank's end? It could be that the data service they expose to Mint chokes on pipe characters, but the actual web site works fine. Am I misreading your post?
|
# ? May 31, 2012 15:28 |
|
redleader posted:I scrolled along this with a rapidly-expanding grin on my face. I'm not the greatest programmer in the world, but goddamn does this make my code look incredible...
|
# ? May 31, 2012 15:34 |
|
Munkeymon posted:Couldn't the problem be on your bank's end? It could be that the data service they expose to Mint chokes on pipe characters, but the actual web site works fine. Am I misreading your post? Why would the bank need your plaintext mint.com password, ever?
|
# ? May 31, 2012 16:03 |
|
epswing posted:Why would the bank need your plaintext mint.com password, ever? They don't; I'm reading it as the problem being that the password with the bank service has a character that mint's software can't handle. Mint's solution, as seen in that support email, is to change the user's password on the bank's end so it will work with Mint. Which is stupid too, but a different stupid.
|
# ? May 31, 2012 16:07 |
|
etcetera08 posted:Mint's solution, as seen in that support email, is to change the user's password on the bank's end so it will work with Mint. it can't be that ............
|
# ? May 31, 2012 16:16 |
|
I'm assuming the bank's data service (you didn't think Mint logged into their web site and scraped it did you?) can't handle the character and, since Mint can't force the bank to fix their poo poo, they basically say "If you want this to work today, you'll have to change your password so we can [also] log in [using the service your bank gives us to work with]"
|
# ? May 31, 2012 16:35 |
|
Doh004 posted:Found this today while trying to determine a specific sector in some other team's solution: I blame stuff like this partly on the relative difficulty of doing little ad-hoc checks for membership in some constant list in C#. In Python, even your average terrible programmer can figure out how to do this: Python code:
C# code:
|
# ? May 31, 2012 16:44 |
|
Correct me if I'm wrong but the codes should be in a hash-based container like a Set or a Dictionary, making the 'contains' lookup O(1) instead of O(n). Then again, even in the horror example there are only 25 items in the list (I counted ), so it's not much of an optimization.
|
# ? May 31, 2012 17:00 |
|
This code All the SQL statements are just plain-text strings, with the escaping just changing single quotes into double single quotes (' -> ''). On top of that, all of the SQL statements are written into one string, which is declared at the global scope so every single method shares the same string. But why change it if it works?
|
# ? May 31, 2012 17:06 |
|
epswing posted:Correct me if I'm wrong but the codes should be in a hash-based container like a Set or a Dictionary, making the 'contains' lookup O(1) instead of O(n). You're not wrong, although I'm sure you'd only feel the difference if you were executing the function many, many times per second.
|
# ? May 31, 2012 17:44 |
|
|
# ? May 14, 2024 19:06 |
|
epswing posted:Correct me if I'm wrong but the codes should be in a hash-based container like a Set or a Dictionary, making the 'contains' lookup O(1) instead of O(n). You'd have to see how efficient the hashing algorithm is compared to an average sequential scan of the array. A scan of an int array is actually pretty god drat fast.
|
# ? May 31, 2012 18:01 |