I am just beginning to learn web development, but I am rather confused about what to invest in. I heard that server-side code translates into client-side cod开发者_运维技巧e. So, if you have an .aspx file, it will be converted to HTML/CSS/JavaScript. I have experience with the latter three technologies put into a rather dull text file and rendered by a web browser. My question is how much HTML/CSS/Javascript coding would I have to do when server-side programming? In other words, can someone using ASP.NET program purely on the server side and not bother to write for the client side? Of course, I don't care about server-side being translated into client-side, but I am wondering if client-side programming needs to be done explicitly and to what degree.
You'll want to learn to do your own client-side programming, it's well worth the investment. Frameworks that do your client side programming "for you" may or may not do a good job, but at some point, you're going to have to debug it, figure out why it's doing what it's doing and whether that's a bug or a misunderstanding, etc. Rather than stumble along in the dark, invest some time in learning the client-side technologies and techniques, so you understand what the frameworks are generating for you and so you can produce better results by doing exactly what you intend on the client, on the server, and in the interface between them.
For example: I answered a question earlier about how a button on the client-side can make the browser open the "Save File As" dialog box when the user clicks it, with the file in question being custom-generated, without tearing down the page the button is in. This isn't necessarily a massively edge case, having a means of allowing the user to download a custom-generated PDF (say) isn't unusual at all, and enhancing the user experience for that can be useful. Without requiring Flash or similar, you'd be hard-pressed to do that elegantly, with a high-quality user experience, without knowing what's happening on the client, what's happening on the server, and how to get the two parts to exchange the relevant information to create the experience you want to create.
You will have to do some client side programming. There's only so much that the various frameworks can generate for you and in some cases you will want to override what they produce anyway.
Without knowing exactly what you want to do I can't say how much and what type of coding you'll need to do.
You said that you heard that server-side code translates into client-side code. That's a bit misleading; the server-side code can generate things interpreted by the client, but it isn't translated per se. In order to write server-side code, you still need to know HTML and CSS. JavaScript usually isn't required.
For example, if you were doing a to-do list application, all server-side, you might have code similar to this: (note, this is PHP; I don't know how to use ASP.NET)
<h1>To-do list</h1>
<ul>
<?php foreach($items as $item) { ?>
<li><?php echo htmlentities($item); ?></li>
<?php } ?>
</ul>
If $items
was an array of "milk" and "bread", then it might get processed into this:
<h1>To-do list</h1>
<ul>
<li>milk</li>
<li>bread</li>
</ul>
...but that usually wouldn't be considered translating it. So to answer your question, yes, you'll need to know some client-side things in order to do server-side code.
The amount of client-side programming will vary based on your particular project. In my personal experience, though, you can get away without a lot of JavaScript. There's a good chance you'll still want to do your own CSS, and knowing HTML will be very helpful (.aspx pages contain a combination of HTML and special ASP tags).
As an example, I've maintained a (moderately simple, a few thousand LOC) ASP site at work where the only custom JavaScript is a confirmation dialog (and even that may not be necessary). We use our own stylesheet, but it's not especially complex.
精彩评论