Live data from Hacker News

Unapologetically build your startup technology in C#

sirchristian.net

61–70 of 152 posts

Re: Unapologetically build your startup technology in C#

#61

I strongly agree with the author's conclusion, but I strongly disagree with many of his points. Notably, with his recommendation to consciously go all the way with the Microsoft vendor lock in. Our startup's backend is made in C#, and we're very happy with the choice. We use Postgres, we host it on Docker containers on Linux, and our devs are equally spread over Windows, OSX and Linux. MonoDevelop is a remarkably gre…

I agree "get all the free Microsoft goodies when you start, and once you really need the paid versions you're probably successful enough that the cost doesn't matter much" is one fair conclusion to the article. However I don't believe that's the only conclusion. Mostly I want .NET to be a consideration as an option when building out the technology in a startup. I'm concerned about vender lock-in as well, just less co…

OK, here goes. I'm not saying that we made the right choice all over, but this is what we currently have:

For the API we use ServiceStack (v3, because v4 is paid and has a ridiculously high license fee). It is the best-designed REST API library I've ever seen, in any language. Its focus on data and not on verbs makes it easy to build well-designed APIs and difficult to build crappy ones.

The API is the executable, self-hosting an HTTP server (using ServiceStack's support for the .NET HttpListener). We'll probably switch to FastCGI soon. In any case, we have an Nginx in front to serve all static assets, which proxies API calls through to our API.

The database layer is very lean: we rely heavily on Postgres stored procedures for much of our data logic. This way, we avoid a lot of roundtrips to the DB and back. We go as far as using Postgres's multiple cursor feature to return hierarchical data without repeating lots of data in a giant single JOIN. We then use C# to tie the pieces back together (e.g. imagine a blog example, if we'd have a query for certain posts AND their top 5 comments, we'd get one cursor for posts and one for all comments, in order, and then we tie each post to a set of comments in C#-o-world while mapping it to DTOs).

The queried data goes from what the stored procedures return straight into the DTOs that ServiceStack returns, so we have no "domain model" class structure or a heavy weight ORM. We use Dapper for easily mapping stuff to simple classes.

We insert/update data with ServiceStack.OrmLite - just simply adding rows. Often, an API DTO matches a DB table close enough that this just works without any extra mapping.

I general, we're convinced that heavy-weight ORMs don't make sense for backends which are little more than data-stores for single-page web apps.

We manage DB schema changes (and all stored procedures) using hand-written SQL scripts, much like how the Play framework does this (1.sql for the initial DB, 2.sql for changes since v1, etc). This works amazingly great, and gives us far greater control than any ORM ever gave me.

We host it all with Docker containers: one for the DB data (Docker's "data-only container" pattern), one for Postgres itself, one for the backend (running Mono 3.2.something on ubuntu 14.04), one for Nginx, and one for our static assets (so we can redeploy frontend code without restarting the nginx container). Currently, we're host it all at http://orchardup.com but we're not too happy with their very slow (but friendly) customer support. Docker has given us a bunch of headaches (for example, that data only container pattern is a lot less easy to set up in practice), but none .NET/Mono related.

Our frontend is a single-page web app, optimized for mobile, built with React and TypeScript.

Re: Unapologetically build your startup technology in C#

#62

I strongly agree with the author's conclusion, but I strongly disagree with many of his points. Notably, with his recommendation to consciously go all the way with the Microsoft vendor lock in. Our startup's backend is made in C#, and we're very happy with the choice. We use Postgres, we host it on Docker containers on Linux, and our devs are equally spread over Windows, OSX and Linux. MonoDevelop is a remarkably gre…

Isn't ServiceStack(.OrmLite) a commercial product nowadays? Did this affect your choice in any way?

v3 is still pretty good though. I was hoping that some eager people would fork it to keep it going, but it looks like the interest is smaller than I hoped. Maybe I'll pick it up myself one day.

The core of ServiceStack (services, messages, routes; that part) is so well designed that I simply refuse giving up on it. I think that if I were to use a different language for whatever project, I'd probably rather spend many evenings reimplementing those core concepts than going with something less good (such as the common one-method-call per URL pattern of MVC WebAPI, Rails controllers, Sinatra, Flask, etc etc etc).

I'd probably buy ServiceStack v4 if it wasn't so outrageously expensive.

Re: Unapologetically build your startup technology in C#

#64
Its weird that the HN crowd just seems to assume that the advice to use linux and mono just has to be a better idea than using windows.

If you haven't looked at windows since 2003 you really need to take a look at server 2012 R2. The default installation mode is server core. It requires dramatically fewer patches. Management with PowerShell is incredibly powerful. IIS has seen many, many improvements.

Also, "developing your app for azure" is a weird statement. If you develop for Azure Websites you are literally just writing an asp.net web app or api. it runs in IIS in a VM. It just has some management wrapped around it so that you don't have to take care of the VM(s). It has autscale, monitoring, and all the stuff you would expect from a cloud provider. Writing your app to use SQL Azure, or Azure storage, or something like that is just like using the comparable services from Amazon. It's like anything else...you should implement its usage as an interface so you can swap it out if need be.

Some people on HN have accused me of working for MS just because I use their stuff. I'm not, nor have I ever been, a MS employee. I'll admit that I started looking into windows a couple of years ago because I was bored with Linux and Unix. I've found that if you put the time in to understand how it works its incredibly productive and thorough. If you try to make it work like unix it will suck. If you learn PowerShell and stay away from the "clickety-clickety" thing it's awesome.

From a development standpoint I actually like the total stack approach...but that's me. If you need to use best of breed components you can still do that with .Net. For me though, my interests shifted to C++ a while ago, so .Net stuff for web api's get's the work done when I have to do it. I would like to see more stuff like openstack in the .net world, but system center is fine. The stuff that I do ends up being important enough for enterprises that getting funds for that kind of thing is just part of the package.

That's another thing. I'm completely uninterested in startups. I've worked at startups in various roles in the past and I'm just over it. Any startup that I built would have to be something that I could run by myself that immediately made money that I would keep. Investment funding is shit. It's a hassle that is super crazy. Dealing with "business" types that aren't technical enough to understand the challenges is also completely off the table. If you did choose to work with a VC then it's much better to be making money and talking about selling out totally instead of implanting them in your life. Shudder.

The one thing that I think Windows needs is a container style app deployment model. The coolest thing going in large scale app building is CoreOS. Its the future of how a large scale app will be built and deployed.

The new, and much loathed, metro applications are actually a good starting place for building a container system. They use feature called "app containers" that was first introduced in Vista. Add to that an app package that installs and uninstalls as a unit, called APPX. They haven't made any noise about using the new app model for servers, but it would be a great idea. It uses an API monitor that stops calls to things like LoadLibrary or GetProcAddress and all the other API's that let you bootstrap malware. Anyway, like I said, they haven't made any noise about it...it would be cool though.

Re: Unapologetically build your startup technology in C#

#65
post #47

I always wondered why computer languages and economy becomes religion and dogma. We use multiple languages and multiple OS in my company. When you have a company you have your own interest and your customers interest in mind. Some times those interest are not the same of Microsoft, Apple, Google, IBM or Oracle. Just developing on a single proprietary language from a single company on a single OS (and yes I know Mono…

I agree. My experience (and please tell me when I'm wrong) is that Windows developers for the most part stick to their choice of framework while multi-OS (Windows included) developers are more open to the wonders of the world. So statistically the .NET guys may be more narrow-minded regarding development stacks. Steviee

> So statistically the .NET guys may be more narrow-minded regarding development stacks.

While true, .net developers don't need to venture out very far, I don't believe its solely because of narrow-mindedness (sure you'll find these developers everywhere, I can argue that node developers are narrow minded with node + express + mongo for example... hell people still write PHP =) ).

With .NET the reality is that there is no reason to consider anything else within the stack. Everything is standard, and most companies have them as part of MSDN. Majority of established .net enterprise environments use SQL Server with either ASP.NET webforms or MVC.net running on IIS + Win Server. What open source considers "vendor lock-in" is considered "standardised technology" in enterprise environments. When considering client work the first question is: "right what do you need to do?" and not "right, what stack are you using".

With Java, one client I have to learn Struts, another client I have to learn Play, then another client I have to learn JEE. I know Gradle in and out, but another contract requires me to know Maven, while another contract requires me to know Ant. Standalone server? Or Tomcat / Apache / WebSphere?

With Node, everyone has their own templating language (Jade or Handlebars or other). Some use CoffeeScript over plain Javascript. Some use SASS/LESS/ or just plain CSS. Some forward proxy using Haproxy, others NginX.

The point is: while the .net stack is pretty narrow, we know it works in the majority of use cases. And that's usually enough.

Re: Unapologetically build your startup technology in C#

#66

Earlier quoted context omitted.

Better how? C#'s one of the best languages in town and the IDE's the unchallenged best in town by a long way. And the SQL product is amazing, much better than MySlowQL. So what bit is better? Deployment? Hosting? I'm genuinely asking here, you're just waving hands. I've used both, the thing that puts me off .Net is the lack of choice when new stuff comes out (like elasticsearch, or a new language, or something like D…

I've used Visual Studio, XCode, Eclipse and IntelliJ - the thought that Visual Studio is the unchallenged king of them all never crossed my mind. Honestly curious - what makes it the best in our opinion?

IntelliJ, VS, Eclipse, xCode in that order.

Re: Unapologetically build your startup technology in C#

#67
post #47

I always wondered why computer languages and economy becomes religion and dogma. We use multiple languages and multiple OS in my company. When you have a company you have your own interest and your customers interest in mind. Some times those interest are not the same of Microsoft, Apple, Google, IBM or Oracle. Just developing on a single proprietary language from a single company on a single OS (and yes I know Mono…

I agree. My experience (and please tell me when I'm wrong) is that Windows developers for the most part stick to their choice of framework while multi-OS (Windows included) developers are more open to the wonders of the world. So statistically the .NET guys may be more narrow-minded regarding development stacks. Steviee

I'm a multi-stack developer, who has to use for his job. Honestly modern windows + .net development is pretty good.

Re: Unapologetically build your startup technology in C#

#68
post #8

Is your post about C# or the .NET stack? I can (somewhat) relate to using C# over some other languages. However what I cannot relate to is being trapped with the .NET stack. And a trap it is. You need expensive Windows Servers to host your stuff and Windows just disqualifies itself as a server platform (my subjective opinion). Having to use a powerful latest-tech machine and very recent OS version (2012?) with loads…

"You need expensive Windows Servers to host your stuff..."

I guess that depends on your definition of expensive. I've hosted my .NET stuff with http://www.discountasp.net for years and yes, they're not free, they're cheap. There are cheaper alternatives than them for IIS, but I like them. They provide a good service. Free doesn't float my boat because I don't want to worry about platform installation, patching and so on. I don't want to do more than FTP to publish.

Also interesting is that I could move to Azure without making a single change to my code. So Azure doesn't lock me into anything either.

"But that's [.NET] just a dependency when you opt for the Microsoft world"

Yes. It is a dependency. If I used Node, then Node.js would be a dependency. If I used Rails, then Rails would be a dependency. I don't get that dependency problem - we're all of us always going to be dependent on something, somewhere. Unless you code up your own OS, stack and tools, and make your own hardware.

Lock-in to Micro$oft is also something I've yet to hear a commercially convincing argument against. Is it really so bad? They've been around since the 80's. They're not going to disappear soon either. They strike me as a safe bet. Why is lock-in such an issue?

If vendor dependence is really such an issue, then design (architecture, if you will) is your mitigation. Abstraction solves that problem (actually any problem, bar performance).

As ever, when I hear these arguments against Microsoft and the .NET stack I hear consistency bias. Our nearly obsessive desire to be (and appear to be) consistent with what we have already done. Once we've made a choice, we encounter personal and interpersonal pressures to behave consistently with that commitment.

Node.js is cool. So is LAMP, .NET, COBOL and GW BASIC. Your choice is the right choice. For you. For your situation. If you're going to throw stones at my choice (not saying you are), I'd like to hear how lock-in to Microsoft will burn me. And after 14 years of hosting my stuff on IIS and developing with the Express Editions of Visual Studio, I'd love to know how it is more expensive than something else that provides a comparable development experience and service.

Re: Unapologetically build your startup technology in C#

#69
post #13

There are two people talking in my head while I read this post. One says : Too many people obsess about backends. Yes, build your startup in C# and a .NET stack if that's what your familiar with. The backend ultimately doesn't matter, and the faster you can create and then iterate on your product, the better off you'll be. The primary factor that will decide whether your startup is successful or not is if people like…

Better how? C#'s one of the best languages in town and the IDE's the unchallenged best in town by a long way. And the SQL product is amazing, much better than MySlowQL. So what bit is better? Deployment? Hosting? I'm genuinely asking here, you're just waving hands. I've used both, the thing that puts me off .Net is the lack of choice when new stuff comes out (like elasticsearch, or a new language, or something like D…

but postgres compared to sqlserver, you won't go back.

Re: Unapologetically build your startup technology in C#

#70
post #48
post #11

there's nothing in that post that gives C# a measurable advantage over say, Java. Visual Studio Express? still way behind JetBrains IntelliJ (the community edition is FOSS). Visual Studio is unusable without JetBrains Resharper, which isn't cheap. Azure? AWS Bizspark? not required for Java dev as everything's free and OSS anyway. Popularity? most popular .net libraries/tools (NUnit, NAnt, NHibernate) are all clones o…

In my experience C# is just a better language than Java (which isn't suprising, as C# was made just to be a better Java clone). Things like * value types (instead of boxing) * no type erasure * runtime exceptions * dynamic/duck typing * operator overloading (try working with arbitrary length decimals in Java) just solve a lot of the small headaches of everyday programming. That said, I still prefer Java because of th…

I've worked with C# and .NET for years. I agree that C# is a great language. I prefer working with the JVM and Linux ecosystems, though. On my latest project I decided to use Scala for the backend. I have access to a wealth of great libraries and services, and I actually prefer working with Scala than with C#.
Post reply on HN