11

I recently asked a question asking for one solution in any of several frameworks. I was clear that I didn't need all of them.

It was closed as too broad.

Before you take a look at it, please keep in mind that though it's pretty basic (yes, I'm a noob in web developing. I know.):

  1. Simple questions (and even homework questions!) are acceptable on SO.
  2. The question was not closed as too simple. It was closed as too broad.

And here's the link: Create one codebehind to show different web pages

So: In the future, if I have a question that would be fine if asked about a specific framework, should I ask about one framework only (though I'm fine with any) or can I ask for one solution in any framework the answerer wants to answer?

5
  • 5
    Well, if I had to guess, you ran afoul of asking for code. Your question's too broad because, to answer it, the answerer would have to write the whole bit of code for you. I don't know, but it may be that the chunk of code you'd need is too large to be reasonable. We typically want the OP to try on their own first, after all.
    – Kendra
    Commented Feb 15, 2018 at 22:55
  • 1
    @Kendra Did you see the answer there? Is that too much code?
    – ispiro
    Commented Feb 15, 2018 at 22:56
  • 1
    Well, not knowing the answer to your question, I certainly can't be the judge of that answer and whether it's complete, typical, or what have you.
    – Kendra
    Commented Feb 15, 2018 at 22:57
  • 1
    see also: Breaking down “too broad” and trying to understand it
    – gnat
    Commented Feb 16, 2018 at 6:14
  • 1
    If I were in your position, I'd still be doing research. That includes buying a couple up to date books on developing websites using asp.net. I don't really understand how that answer will help you at all at your demonstrated level of understanding of how website development in Microsoft.net works, especially if you're going to ignore what he told you (MVC) and use (vomits) webforms. Sorry, not trying to be snarky or rude, but this is honestly the advice you need right now.
    – user1228
    Commented Feb 16, 2018 at 15:08

4 Answers 4

28

I'm glad you asked; this seems to come up a lot. Folks want to accomplish something, don't particularly care how they do it, and so they specify multiple languages / libraries / platforms.

This is very similar to crossposting on Usenet: it gets your question in front of a lot more people, but doesn't make it any more relevant to them. It's usually considered rude. Now, being rude doesn't make it "too broad"... But if you're trying to convince someone to treat your question well then being rude is a bad way to start off.

What makes it too broad is that you do actually care which platform you end up using - you just don't know it yet.

Let's say for example that you got two answers, one for Webforms and one for ASP.NET-MVC - and let's say they both were correct and useful and as well-written as possible for the relevant platform. But the Webforms one requires you to write twice as much boilerplate code, remember a 12-item checklist when adding a new route, and have privileged access to the webserver... While the MVC one is about 10 lines long and requires adding one line for each new route. You probably wouldn't be as agnostic about platforms anymore, eh?

The truth is, you have several questions that you need to find the answer to before you can proceed here:

  1. Am I hosting this or am I buying hosting?

    ...and which frameworks does my host support?

  2. How do I return different content based on the path for [each platform I'm considering?]

  3. How much server-side rendering am I doing, and which style of templating / generation do I prefer (from those offered by the frameworks that I'm considering)?

  4. etc. for each thing you want to do with your app

Now, many of these questions are probably already answered on Stack Overflow if you poke around a bit, so answering them should go pretty quickly. And chances are, you're not going to get very many questions in before you realize that you do care which platform you're targeting, and have formed some fairly strong opinions about the whole decision.

But even if it takes you 20 questions to make that call, you'll be able to structure a question that focuses on what you're trying to do and what, specifically, you're considering using for that task. Which eliminates the need for rude crossposting and makes your question a heck of a lot more fun to answer effectively for those who do find it.

3
  • 3
    Thank you for your very clear answer! Since my intention is to know what's the opinion of the moderators et al. your answer is the answer, my opinion notwithstanding.
    – ispiro
    Commented Feb 16, 2018 at 11:06
  • Just my 2 cents: This answer is based on assumptions. That the question is not relevant to them and therefore is rude. Why would it not be relevant to them? And that [I] do actually care which platform [I] end up using. Not necessarily. And as long as I don't know the answer - I don't know if the answer itself might dictate a specific framework. (And for the record: 1) I already have a web host for my main site. It supports all 3 frameworks. 2) From a database. I already have it. 3) Just simple CSS, supported practically everywhere.)
    – ispiro
    Commented Feb 16, 2018 at 11:06
  • 1
    Sinatr kinda answered that question already, @ispiro - but FWIW if your goal is to pull already-rendered HTML directly from a database and serve it out unchanged then your question becomes a lot simpler since none of the frameworks listed will be doing much of anything; you're really just looking for the idiomatic way of routing for each of them. Which is still, strictly-speaking, three questions...
    – Shog9
    Commented Feb 16, 2018 at 15:58
12

SO is Q&A and point of view from the guy who found your question is also important.

He knows one of listed technologies and only that one (let's call it X) and he found exactly his question (tagged with X) asked by another person. Yahoo! Wait.. there is an accepted answer, but it's for some other technology Y. He don't know Y. No yahoo.

Should the single answer contain solutions for all technologies you named?

Should multiple smaller ones be posted? 100 small ones (for 10 technologies you know) is ok?

That's definition of broad:

There are either too many possible answers, or good answers would be too long for this format.

1
  • I +1'd this but OP may have misunderstood your advice as he is has since edited the question and pushed it into the reopen queue by prepending "As I wrote in the end: An answer for one of those frameworks is enough." to it. You might want to clarify your stance :) Commented Feb 18, 2018 at 16:11
7

You may not realize it, but the question you asked basically amounts to "how do I create a website?" And the only constraint you've specified is that you want to (somehow) use C# to do it.

Now, you might be thinking that you also have another major constraint:

[...] instead of creating it page by page, I want to have one "code" that will show all of the pages, depending on the exact url requested.

But if you think about it a little bit, that's actually how all web sites work. At some level, there's always a single server program that accepts HTTP(S) requests for different URLs and responds to them with some content. Now, in many cases that server might actually be configured to pass different URLs off to different subprograms, or to just read the content for each URL from a specific file. But it can also be (and often is) configured to pass all the URLs matching some pattern to the same subprogram. Or the server might simply be something like a node.js process that handles all the URLs directly, without delegating them to any other code.

So basically, you're asking how to make a website in C#. With the only restriction being that you don't want to have a separate C# program for each page, which really doesn't limit the solutions much, if at all. (Honestly, having a separate C# program for each page would be kind of a silly way to make a website, anyway.) I think you might now see why some would consider your question too broad to be usefully answered on SO.


Now, in your comments here, you've narrowed down your problem a bit more. Specifically, you've told us that:

  • you already have an existing website (presumably consisting of static HTML pages served by something like Apache or IIS) hosted somewhere, and you want the new site to be on the same host;
  • your webhost supports ASP.NET MVC, ASP.NET Core and WebForms; and
  • the content you want to serve comes from a (SQL?) database, and you already have some reasonable way of populating and updating the database as needed.

That already narrows your question down quite a bit, although I'm still not quite sure that it's quite specific enough for SO. Remember that people here can't see your database or read your mind, so you do need to spell out everything that might be relevant in your question. In particular, I'd like to see at least the following information in any followup question you may ask:

  • What kind of content does your database contain? Is it pre-made HTML that you just need to return to the browser (maybe with some simple fixed wrapper around it), or do you need to process the data in some way to actually turn it into an HTML page?
  • What kind of a database is your content stored in?
  • Which web server software is your webhost running?
  • How is your existing site structured, and how do you plan the new pages to fit in? Will all the URLs for the new pages e.g. begin the same way?

Also, for the reasons already describe in the other meta answers here, you probably should narrow your question down to one specific technology.

If necessary, you can ask multiple versions of the same question for different platforms. If you do that, don't ask them all at the same time, and preferably link back from the later ones to the earlier ones. Also, make the difference between the questions, and your reasons for asking them all (i.e. that you want to compare the solutions in the different frameworks before choosing one), really clear.

That said, it might be better to first decide which platform you want to go with, then look around to see if you can figure how to solve your task yourself using the framework you've chosen, and only resort to asking on SO if you're still stuck. Unfortunately, SO itself is not well suited for questions like "which platform should I choose for this project?", although you might be able to get some helpful suggestions e.g. on SO chat.

2

Stack Overflow isn't really designed for general "how do I do this" type questions. Questions like these are very hard to answer, because there isn't just one answer. One of the most amazing, and most frustrating, things about programming is that for any given goal, there are a thousand ways to do it.

If you find yourself asking this kind of question, the best answer is that you need to break your problem down into smaller steps and try something out. Try lots of things out. In your case, try to create a single endpoint that serves multiple pages in a bunch of different languages and frameworks. From there you can ask more specific questions about specific frameworks.

A bunch of strangers on the internet can't tell you what will work best for your context. "How do I do this" type questions are a little bit like asking "what should I eat for dinner" or "what's the best movie of all time". We can tell you what we think, but that doesn't really help you. You have to figure out what works best for you.

Stack Overflow is designed for more specific "I tried X, expected Y, but got Z instead" type questions. This doesn't mean your question is bad, just that it's too broad for what Stack Overflow was designed for. I personally enjoy answering these too broad questions, but my answer is usually a variation of the one you're reading right now: break things down into smaller steps, try things out, post a more specific question (and don't forget the MCVE!).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .