|
A one-way trip to Q&A?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
Johnny J. wrote: A one-way trip to Q&A? URGENT PLZ WRIT PARZER
|
|
|
|
|
That explains the quantity and frequency of some Lounge posts...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
Go to Disneyland. Like totally.
|
|
|
|
|
That is a hell of a run. Nothing makes me happier than writing a bunch of code that not only compiles without error, but works the first time out of the gate.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
Gratifying innit?
The only exception is when i write something I expect to *not* work the first go-round and then it does.
Usually that means it's broken, but i haven't figured out how to break it yet.
hack everything.
|
|
|
|
|
Yes!
For me; the surprise was not that it worked, but that is compiled with out syntax errors or warnings.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
John R. Shaw wrote: but works the first time out of the gate
That would make me suspicious.
|
|
|
|
|
Jörgen Andersson wrote: That would make me suspicious.
Are you kidding me? "Suspicious" is putting it mildly. I'd be second-guessing everything if my code worked the first time I tried it.
|
|
|
|
|
I always second guess everything before I even compile the code. The surprise is not that it worked, but that there were no syntax errors.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
Well...editors themselves are already vocal enough about syntax errors; it's kinda hard nowadays to miss them.
Or are you coding in Notepad?
|
|
|
|
|
So, Newtonsoft is the premier library for JSON in C#. If you create a stringdictionary in C# and serialise it, the resultant JSON will not deserialise using the same library and same CLASS. I had to use Dictionary<string, string="">
|
|
|
|
|
I never used theirs. I just wrote my own.
And as far as JSON being better than XML, it all depends on what you need.
For example, parse trees cannot be accurately represented in JSON because JSON doesn't preserve field order of objects, while XML does preserve order of sub elements.
hack everything.
|
|
|
|
|
Yeah, the header is meant as a joke.
I'm paid to code, I don't waste time rewriting stuff that exists, is well tested and free
|
|
|
|
|
I do if the learning curve is bigger than me simply rolling my own. JSON is trivial to parse and emit
hack everything.
|
|
|
|
|
Yeah, lots of things are trivial without being a five minute job
|
|
|
|
|
Sounds like you already spent that 5 minutes trying to get NewtonSoft's lib to serialize a dictionary, which is rather my point about the learning curve.
hack everything.
|
|
|
|
|
Well, sure, but, I still think I've spent less time dealing with this frustration than it took to write JSON.Net which, again, is widely used so I get the benefit of tons of testing.
When I was new to dev, I mocked the idea of paying for things I knew I could write. Now I know the most important thing is giving my boss a result as quickly as possible. Would you roll your own auth or use Identity, for example?
|
|
|
|
|
I agree with you in general. But in JSON's case, I've never found a good reason *not* to use what I've built, as by now it's tested, and unlike NewtonSoft it does exactly what i want how I want it.
It did take me time to get it there, so I probably wouldn't have built it professionally unless i needed like, a little REST/json-RPC layer and nothing else at which point I know from experience that deving that took less time than learning to do the same thing with NewtonSoft, whose offering is actually more complicated in that regard.
So it all depends.
hack everything.
|
|
|
|
|
honey the codewitch wrote: while XML does preserve order of sub elements. Does it? By definition?
I am aware that a schema can specify that a sequence is to be preserved. Of course, even if you are not required to preserve the order of elements, you are allowed to do so in your processing, which is often the simpler solution. But unless explicitly declared as a sequence, I would not rely on preservation of order.
|
|
|
|
|
The order of sub elements is preserved.
Schemas can only restrict the order they may appear in. (order=any or whatever means no restriction, but it still keeps the subelements in document order)
I'm pretty darned confident of this, but do correct me if I'm wrong. The *only* exception i could think of would be something that allows reordering by schema "key" field, or perhaps "id" field but i've never seen an implementation that does this, and I think it's not cool to do.
So I'd put rent money on this assertion. I don't rent, but still.
hack everything.
|
|
|
|
|
|
I like JSON but at the same time, you're not wrong.
hack everything.
|
|
|
|
|
Ouch, that article is awful!
I would try to justify my claim but I just don't have enough spare time to point out all the wrongs with it. Let's just say it's very biased and the examples are not practical and have been cherry picked to fit the agenda.
For example, at one point it uses XPath to show how easy it is to get elements with a certain attribute using XML, but then suggests you need to write a multiple line for-loop to deal with the JSON equivalent...
Personally I don't have a problem with either, pick what best suits the requirements, as is true with most things.
|
|
|
|
|
Quote: Ouch, that article is awful!
Maybe. I posted the link just because it mentioned C# troubles with JSON .
Quote: Personally I don't have a problem with either Me too. Nowdays I use more JSON , because often I need the serialization of trivial objects.
|
|
|
|