News for hackers. Stuff that matters.
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by skrowl on Wednesday August 21, 2013 @11:29AM (#6250997)
I think this guy has never heard of Web API (http://www.asp.net/web-api). He's saying MVC is bad, then he writes code that just returns serialized data instead of views.... which is exactly what Web API does.
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by sremani on Wednesday August 21, 2013 @11:32AM (#6251013)
"Which basically means it can be used as a viable replacement for WebAPI or MVC".

He does know about WebAPI.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by skrowl on Wednesday August 21, 2013 @11:38AM (#6251064)
Oh I agree that he mentions it in his article, but everything he says is good about his library is already done (better, I might add) by Web API.
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by untog on Wednesday August 21, 2013 @11:55AM (#6251181)
I'm pretty sure Nancy predates the Web API by a decent amount of time. So it wasn't "already done" when Nancy was written.

They both have differences, and are equally valid choices. Aside from anything else, I give Nancy time because I'd love to see more open source independent development on the .NET platform.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by red__square on Wednesday August 21, 2013 @11:49AM (#6251138)
skrowl, can you quantify your arguments as to why you think Web API is better? In what way? What do you not like about Nancy, where does it fall short?
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by philliphaydon on Wednesday August 21, 2013 @11:41AM (#6251085)
How is anything WebAPI does, better?

Its routing is rubbish - waiting for V2 for fixed routing (AttributeRouting support so its not hidden away)

Its terrible to extend.

Its slower than Nancy.

Its hard to test out of the box.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by jchannon on Wednesday August 21, 2013 @11:42AM (#6251093)
Have you used Nancy? When you have then you can say WebAPI is better. Until then, keep your MS Fanboy comments to yourself
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by philliphaydon on Wednesday August 21, 2013 @11:33AM (#6251015)
Ahh, WebAPI. The thing that MVC should have been, but still falls short. Promoted as an 'API' despite the fact it does the same thing as MVC, only slightly better.

Guess what, your website is an API, it just happens to return text/html instead of some other format you specify. If you use MVC and WebAPI, you're doing it wrong.

Also...

http://weblogs.asp.net/shijuvarghese/archive/2013/07/30/writ...

vs

http://www.marcusoft.net/2013/01/NancyTesting3.html

Sums up WebAPI for me.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by edwinnathaniel on Wednesday August 21, 2013 @11:56AM (#6251189)
Many people develop a web-app using MVC-based framework and have a separate API endpoints using lightweight library.

SpringMVC + JAX-RS1/2

RoR + Sinatra

A web-app using some framework + NodeJS for API

There's nothing wrong with that as you may want to have different models or different configurations (throttling or whatnot).

Using MVC-based framework for your API endpoint is overkill.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by corresation on Wednesday August 21, 2013 @11:34AM (#6251025)
Isn't this what WCF does as well? WCF will happily interact with JSON clients, and make spinning out services blissfully easy and efficient.
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by philliphaydon on Wednesday August 21, 2013 @11:36AM (#6251050)
Hahaha, have you actually used WCF? You may as well just use SOAP. You wont end up slitting your wrists.

WCF's only benefit is TCP bindings. If you're doing any HTTP stuff, stay clear of WCF.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by corresation on Wednesday August 21, 2013 @11:53AM (#6251170)
I'm wondering if you've ever actually used WCF, or if you're simply incredibly ignorant about how to use it (why understand existing systems when you can recreate them -- poorly -- yourself), as creating a JSON-friendly web service in WCF is absolutely trivial. Through some very large scale systems I have had absolutely no issues, whatsoever, with it.

Your issues with it might have more to do with you.

Odd that the two single replies I got are a couple of bulldogs desperately shooting any alternative to this submission down.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by radicalbyte on Wednesday August 21, 2013 @12:34PM (#6251504)
WCF is extremely powerful, but it is poorly documented for a system of that complexity.

Configuration is a black art: it involves configuring the various WCF interfaces/components in XML. Because of the poor documentation and bugs this can be quite a lot of work. It was quite obviously architected to be used with a configuration UI - it's similar to XAML and IIS in that respect - only Microsoft never bothered making the investment the way they did for IIS + XAML.

It's also buggy - XML parsing in particular is broken - and the default serializers are horribly slow.

It's extremely extensible, but extension requires considerable work. A lot of the base classes are either sealed or internal (or both), which just exasperate this. Without either the source, the tests, proper documentation or the ability to extend existing implementations it turns a job which should take an engineer an hour into a job that will take them 3 months.

So basically, Microsoft have done done everything to make using WCF in anything but the most basic scenarios hard and expensive.

As others have said, if you're doing anything over HTTP then you're better off using either Web API or better yet ServiceStack. I have good experience with the latter.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by corresation on Wednesday August 21, 2013 @12:53PM (#6251641)
"So basically, Microsoft have done done everything to make using WCF in anything but the most basic scenarios hard and expensive."

I've implemented and used WCF in very large financial systems, under enormous loads pushing absolutely massive amounts of data around. These are very complex systems I am talking about, and WCF was used in many capacities, one of which was as a HTTP Restful service layer (and given that we also used it through queueing, and over TCP, it added a consistency to the stack).

It certainly wasn't perfect (the configuration happens to be a particular point of irritation), but it wasn't a pain-point at all. It just was a non-issue and did the job, and was no engineering challenge whatsoever.

But, I suppose, it was "basic" in that we looked to WCF as a service front-door, and didn't actually see any need to alter it much, in the same way that we don't modify the kernel of the Linux instances that we work on or the source code of the nginx variants we use. We have a different domain that is where we add value, and building (or extending) a service handler like that would have been a gigantic waste of time.

Which, I suspect, it is for most people who do so. People have this intrinsic desire to seemingly make their own tasks more difficult for often ill-conceived or illusory goals.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by radicalbyte on Wednesday August 21, 2013 @01:33PM (#6251958)
That's where WCF works - in internal systems where you have control over both clients and services.

Trying to do a phased replacement of existing J2EE SOAP webservices without the ability to change the clients (meaning that you need wire-level compatible) and you'll see just how hard WCF is to extend.

The fact that it IS possible to do that kind of integration is a testament to just how powerful the framework is. It's just a shame that Microsoft didn't spend an extra 5% effort on the documentation (or just open sourced it).

I should add that we're currently using WCF as an integral part of our system as despite the drawbacks being able to support TCP (and MSMQ etc) and everything else in one framework is worth the extra complexity. Plus we have a lot of organizational knowledge of WCF now.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by philliphaydon on Wednesday August 21, 2013 @12:05PM (#6251257)
Currently in the process of ripping out WCF and replacing it with ServiceStack. Because WCF is such a pile of shit. If you seriously think WCF is good, and 'trivial' then you're clearly a MS fanboy who've never tried alternatives.

I used to be like you, think WCF was the bee's knees.

WCF promote poor service design, in an untestable manner, has no real support for DI, has terrible configuration, unhelpful exceptions, faults, message size limitations that cause headaches, horrifically slow. The only benefit to WCF is TCP endpoints. End of story.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by jf22 on Wednesday August 21, 2013 @12:24PM (#6251418)
Whats funny is in my experience even MS fanboys hate WCF.

;)

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by corresation on Wednesday August 21, 2013 @12:14PM (#6251342)
you're clearly a MS fanboy

Um...okay. That says enough. End of story.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by TheOsiris on Wednesday August 21, 2013 @03:31PM (#6252755)
I've done my fair share of WCF development, and I can tell you without reservation that it just BLOWS!

I'm glad MSFT is moving away from that.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by WayneDB on Wednesday August 21, 2013 @01:36PM (#6251976)
Thanks for your unqualified, unevidenced opinion.
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by philliphaydon on Thursday August 22, 2013 @04:32AM (#6255889)
What 'unqualified' and 'unevidenced' opinion?
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by jf22 on Wednesday August 21, 2013 @12:22PM (#6251399)
I have a dozen WCF projects under my belt.

WCF is fine until you need to extend it. Nancy, MVC, Web Api are much easier to extend.

Plus WCF needs all sorts configuration stupidity which alternatives just don't have.

Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by jchannon on Wednesday August 21, 2013 @11:35AM (#6251042)
Really? WCF? Really, you're sticking up for WCF?
Re:ASP.NET You're doing it Wrong. An Introduction to Nancy by jchannon on Wednesday August 21, 2013 @11:30AM (#6251001)
Yeah but WebAPI sucks :)