学习 C# 或 Java 进行 Web 开发
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/637291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Learn C# or Java for Web Development
提问by Mackristo
I'm not sure if this is the best way to ask this question but I'm in the very early stages of learning programming/development and there are a lot of things that I would like to do including web development and at some point when I have some proficiency, mobile development.
我不确定这是否是提出这个问题的最佳方式,但我正处于学习编程/开发的早期阶段,我想做很多事情,包括 Web 开发,并且在某个时候我有一定的熟练度,移动开发。
I started out thinking I would learn Java because of its overall pervasive presence in the world of development and especially with J2ME's saturation in mobile development. It seemed however that the .NET framework, specifically C# was better suited for web development given the whole system/framework.
我开始想我会学习 Java,因为它在开发世界中普遍存在,尤其是 J2ME 在移动开发中的饱和度。然而,考虑到整个系统/框架,.NET 框架,特别是 C# 似乎更适合 Web 开发。
It seems that C# would be a good compromise to a language for both web development and application development, and hopefully not a difficult switch to Java/J2ME given the similarities between C# and Java.
似乎 C# 将是一种很好的对 Web 开发和应用程序开发语言的折衷方案,鉴于 C# 和 Java 之间的相似性,希望切换到 Java/J2ME 不会很困难。
Java, it seems is not as convenient for web development in my very limited experience. It seems that there are comparatively fewer hosting providers.
Java,在我非常有限的经验中,对于web开发来说似乎不是那么方便。似乎托管服务提供商相对较少。
My question is, is this an accurate assessment of Java? Is it just as suited for web development as .NET with hosts and frameworks? I know it's a great language but I'm just not clear on what the typical roadmap is for doing web development with it.
我的问题是,这是对 Java 的准确评估吗?它是否与带有主机和框架的 .NET 一样适合 Web 开发?我知道它是一种很棒的语言,但我只是不清楚使用它进行 Web 开发的典型路线图是什么。
Apologies for the verbose question. Any input would be much appreciated.
为冗长的问题道歉。任何输入将不胜感激。
采纳答案by hyuan
In addition to some of the remarks made already, there are other things to consider professionally:
除了已经发表的一些评论外,还有其他一些事情需要专业考虑:
Enterprise software is largely dominated by Java because many large scale clients prefer to deploy on a UNIX environment and the .NET CLRs that are out there don't really agree with most IT shops of these large clients.
Java is generally considered to be a more attractive acquisition target in the enterprise software space.
Geographical demand seems to be disparate between the two. On the west coast, Northern California area, Java dominates. What you specialize in may dictate where you will find work.
企业软件主要由 Java 主导,因为许多大型客户更喜欢在 UNIX 环境中部署,而那里的 .NET CLR 并不真正同意这些大型客户的大多数 IT 商店。
Java 通常被认为是企业软件领域更具吸引力的收购目标。
两者的地域需求似乎不同。在西海岸,北加州地区,爪哇占主导地位。您的专长可能会决定您在哪里找到工作。
If your interest is in building a consumer site, many consumer sites are built on neither Java nor .NET/C# these days. In addition to the old PHP standby - there is also Django/Python and Rails/Ruby worth considering. There are extremely mature solutions for deployment in all of these areas. I know this from experience.
如果您对构建消费者站点感兴趣,那么现在许多消费者站点既不是基于 Java 也不是基于 .NET/C# 构建的。除了旧的 PHP 备用 - 还有 Django/Python 和 Rails/Ruby 值得考虑。在所有这些领域都有非常成熟的部署解决方案。我从经验得到的这个结论。
IMO, the Rails stack is light years ahead of anything that is offered in the Java world which in most cases still requires you to stitch together a disparate platform and hope it plays nice (this is less of an issue with C#/.NET). The strongly typed languages themselves also tend to be more verbose than the Python/Ruby where you can take advantage of functional programming techniques such as clojures and lambdas.
IMO,Rails 堆栈比 Java 世界中提供的任何东西都领先数光年,在大多数情况下,Java 世界仍然需要您将不同的平台拼接在一起并希望它运行良好(这对 C#/.NET 来说不是问题)。强类型语言本身也往往比 Python/Ruby 更冗长,在 Python/Ruby 中您可以利用函数式编程技术,例如 clojures 和 lambdas。
Moving between languages is easy enough, but as is the case with programming, it's leveraging what's already been built - that's the tricky part. Learning the language is 10% of the effort towards true mastery. Knowing the vagaries of the framework you are using, the libraries, and understanding what's available is the tricky part. The Java Foundation Classes alone comprise of thousands of class files! It's important to master at least one platform before skipping about.
在语言之间移动很容易,但就像编程一样,它利用了已经构建的东西——这是棘手的部分。学习语言是真正掌握语言的 10%。了解您正在使用的框架、库的变幻莫测,并了解可用的内容是棘手的部分。仅 Java 基础类就包含数千个类文件!在跳过之前掌握至少一个平台很重要。
回答by Julson Lim
Well, from what I see is that Java and C# both have a good share in the web development area. They're almost identical actually. You could start either way and have no problems in trying to learn one or the other.
嗯,据我所知,Java 和 C# 在 Web 开发领域都有很好的份额。它们实际上几乎相同。您可以从任何一种开始,并且在尝试学习其中一种时没有问题。
I have seen a lot of development going on in Java both in web and desktop applications, so I don't really see whose got the upper hand.
我已经看到在 Web 和桌面应用程序中使用 Java 进行的大量开发,所以我真的看不出谁占了上风。
Although it's off-topic, if you've just started learning about programming, I advocate on trying to learn C first. The insight needed to master that language early on will really help out in the future.
虽然是题外话,但如果你刚开始学习编程,我还是主张先尝试学习 C。早期掌握该语言所需的洞察力将在未来真正有所帮助。
回答by ckramer
I've used both for web development. I currently use C#/.Net (and have for a while now), but that is not saying that it is the superior platform (or is it??). In the Java world I used Struts/Hibernate with great success to create web sites, and really had no complaints (performance was great, deployment was pretty straight forward). The .Net world has analogs such as Monorail/ASP.Net MVC and of course NHibernate, so you could create web apps in a very similar manner on both platforms.
我已经将两者都用于 Web 开发。我目前使用 C#/.Net(现在已经有一段时间了),但这并不是说它是优越的平台(或者是??)。在 Java 世界中,我使用 Struts/Hibernate 非常成功地创建了网站,并且真的没有任何抱怨(性能很棒,部署非常简单)。.Net 世界有类似物,例如 Monorail/ASP.Net MVC,当然还有 NHibernate,因此您可以在两个平台上以非常相似的方式创建 Web 应用程序。
I think the determining factor is going to have to come down to your own preferences. Are there things about the .Net framework that you find more appealing than Java? Do you really like developing in Eclipse, and don't want to shell out the bucks for Visual Studio? (Though, I should point out that SharpDevelop is a pretty nice IDE)
我认为决定因素必须归结为您自己的喜好。您觉得 .Net 框架中是否有比 Java 更吸引人的地方?您真的喜欢在 Eclipse 中进行开发,并且不想为 Visual Studio 掏钱吗?(不过,我应该指出 SharpDevelop 是一个非常好的 IDE)
All very non-specific answers...a whole lot of "Use the Force Luke" kind of stuff, but really when its all said and done it is a personal choice, so go with whatever makes you happy.
所有非常不具体的答案......一大堆“使用原力卢克”之类的东西,但实际上,当一切都说出来和完成时,这是个人选择,所以选择让你快乐的任何东西。
回答by Beep beep
Assuming you use Visual Studio, C# will do more (and be a little easier out of the box). You won't need to worry about installing external frameworks, or configuring anything. You can have a sample app up in seconds.
假设您使用 Visual Studio,C# 会做得更多(并且开箱即用更容易一些)。您无需担心安装外部框架或配置任何东西。您可以在几秒钟内创建一个示例应用程序。
If you do not know ANY programming languages though, maybe it makes sense to start with something like php? You'll be up and running quicker than either, although it's easier to make sloppy code choices (IMHO).
如果您不知道任何编程语言,也许从 php 之类的东西开始是有意义的?你会比任何一个都更快地启动和运行,尽管做出草率的代码选择(恕我直言)更容易。
If you want to get into large enterprise development on robust *nix servers, by all means learn Java. If you have no programming experience though, it seems unlikely that you'll be able to pick up enough Java to "trick" these enterprises into hiring you. Unfortunately the entry requirements for a php or C# developer are often lower.
如果您想在强大的 *nix 服务器上进行大型企业开发,请务必学习 Java。但是,如果您没有编程经验,那么您似乎不太可能学会足够的 Java 来“诱骗”这些企业雇用您。不幸的是,php 或 C# 开发人员的入门要求通常较低。
回答by Jonathan
C#/.NET is easier to learn and develop in, but Java has the advantage of being open-source and cross-platform.
C#/.NET 更容易学习和开发,但 Java 具有开源和跨平台的优势。
If I were in your shoes I'd start with .NET/C# (including ASP.NET MVC) and then later move into Java. Be aware that there are a lot of similarities, but also some major differences.
如果我是你的话,我会从 .NET/C#(包括 ASP.NET MVC)开始,然后再转向 Java。请注意,有很多相似之处,但也有一些主要差异。
(I'm a .NET developer, but I'm also learning Java for a mobile project.)
(我是 .NET 开发人员,但我也在为移动项目学习 Java。)
回答by Dels
if you want to develop multi-platform take Java (and it JSP/Applet/Servlet)
if you want to stay with .Net (and Mono) take C# or maybe VB.Net together with ASP.NET
如果您想开发多平台,请使用 Java(以及 JSP/Applet/Servlet)
如果您想继续使用 .Net(和 Mono),请使用 C# 或 VB.Net 和 ASP.NET
personally i will learn Ajax (as essential) if my existing knowledge was server side programming language (ASP/PHP/Python) especially PHP since it's Object Oriented and Multi-platform
如果我现有的知识是服务器端编程语言(ASP/PHP/Python),尤其是 PHP,我将学习 Ajax(作为必不可少的),因为它是面向对象和多平台的
回答by BeWarned
.Net will be easier to start off with, but if that is your goal you might as well start off with PHP (yuck). Over the long run both can get the job done equally as well. If you develop websites the Microsoft way it will be a very straight forward path, Java has so many open source frameworks libraries that just choosing one can be daunting. I going to guess that Java developers make more money primarily be cause it dominates in enterprise web development arena. PHP programmers definitely make less.
.Net 会更容易开始,但如果这是你的目标,你不妨从 PHP 开始(糟糕)。从长远来看,两者都可以同等地完成工作。如果您以 Microsoft 的方式开发网站,那将是一条非常直接的路径,Java 拥有如此多的开源框架库,仅选择其中一个库就令人生畏。我猜测 Java 开发人员赚更多的钱主要是因为它在企业 Web 开发领域占据主导地位。PHP 程序员肯定赚的少。
I primary develop websites with the Java and would recommend it over .Net because there are so many free tools, application servers and frameworks for it. You can build a java site using Tomcat, Apache, MySQL, and Linux with out paying any licensing fees.
我主要使用 Java 开发网站,并且会通过 .Net 推荐它,因为有很多免费的工具、应用程序服务器和框架。您可以使用 Tomcat、Apache、MySQL 和 Linux 构建 Java 站点,而无需支付任何许可费用。
Don't go overboard and try to do everything at once.
不要过火,并尝试一下子做所有事情。
Learn some Java and JDBC Build your site with JSP (Model 1), this will give you a feel for the platform. Then try out one of the frameworks like Struts, or JSF, you will be able to appreciate them much more by then.
学习一些 Java 和 JDBC 使用 JSP(模型 1)构建您的站点,这将使您对平台有所了解。然后尝试其中一种框架,例如 Struts 或 JSF,届时您将能够更加欣赏它们。