开发者

How Similar are Java, C#, and Python? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago. 开发者_高级运维

I know it is a kind of broad question but any answer are appreciated.


All:

  • Require some form of runtime on your system (JVM/.net/Python runtime)
  • All can probably be compiled to executables without the runtime (this is iffy and situational, none of them are designed to work this way)
  • Are good languages
  • All have specific areas where they are much more appropriate than the other two

Java:

  • Tries very hard to be Cross Platform--generally succeeds
  • Little access to platform features that are not in the SDK
  • Slowest of the three to change and does not contain features common to the other two such as closures
  • Very backwards compatible (partly because of the previous point)
  • FAST (about 2x slower than C, quite a few x faster than python)
  • Probably has the most library support of the three
  • Strong multi-platform server systems already deployed using J2EE
  • Scales down to embedded (I've worked on 2 different embedded java projects--coming soon to a cable box near you)
  • Static

C#

  • Quicker to add new features
  • Windows only--Mono is cross platform but does not have the library support.
  • Started very similar to Java but has many more language features now.
  • Much better access to windows APIs
  • Not sure about speed--I think it's similar to Java.
  • Very good library support
  • The only one of the three that you have to pay for (it's free for "entry level")
  • Static

Python

  • Language is cross platform. Not sure about non-language platform access (such as drag-and-drop)--anyone know?
  • Probably an easier language to learn
  • The only one of the three that does not use c-like syntax
  • Slowest of the three, but still pretty darn fast compared to other dynamic languages.
  • Dynamic

This link is also interesting


Python is a dynamic language where Java and C# are really not. It is totally different than the other two. There are ways to accomplishing things in Python that do not translate well to the others and vice versa.

Java and C# look the same, but they have differences between the two under the sheets. Being an expert in one, does not make you an expert in the other by any stretch of the imagination. The syntax is similar and libraries are too, so it would be easier to get up to speed in one or the other, but there are subtleties that can trip you up.


C# and Java have almost identical syntax and very similar libraries. There are differences that you have to be aware of (Type Erasure in Java, for example).

Python is a completely different animal. It is a dynamic language (where the other two aren't). Python winds up being closer in style to something like Ruby.


Java and C# are statically typed languages, while Python is a dynamically typed language. That's a huge difference.

The syntax of Java and C# is similar (but I would not call it "almost identical" as Justin Niessner says).


Java and c# are pretty similar in terms of syntax and are mostly strongly typed (C# is getting more dynamic with every version), Python is a dynamic language


Java and C# are very similar and are syntactically similar to C/C++. They also use braces to mark code blocks.

Python is completely different. Although imperative like Java and C#, Python uses indentation to define blocks of code.

Java and C# are also compiled languages, whereas Python is interpreted and dynamic.

Python, Ruby, and Groovy are somewhat similar languages.


C# and Java are easy to move between, although I don't know many people who are experts in both. C#'s syntax is based off of Java, so they read very, very similarly. They both run cross-platform; Java on the JVM, C# on .NET or Mono. They're both OOP, and widely used for web development. I'd use whichever the team was more familiar with.

Python's off to the side there. It's also used frequently as a scripting language. It can use classes and object orientation, but isn't forced to. It's not as well supported for web work. I'd use this for a different set of tasks than C#/Java.


C# and Java are the two languages you listed that are most similar. Python has a very different syntax, and uses a slightly different programming model. Both C# and Java are Object Oriented languages at their core, with increasing nods to Dynamic Typing. Python began as a Dynamically Typed scripting language and has been picking up more and more Object Oriented features over the years.

The C# class library (.NET Framework) is theoretically multi-platform, though it's heavily weighted towards the Windows platform, and any other OS compatibility is largely an afterthought. The .NET framework currently has two "official" frameworks for building windowed applications (Windows Forms, and WPF) and two "official" frameworks for building web applications (ASP.NET, and ASP.NET MVC). Windows Forms is similar to Java Swing, but the other four frameworks are very different from much of what is found in the Java or Python worlds. There are many language features in C# that are different or lacking in Java, such as Delegates.

The Java class library is pretty solidly multi-platform. It's officially supported desktop and web frameworks (Swing and J2EE) are generally regarded as slow, and difficult to use. However, there is a very lively open source community which has built several competing frameworks that are very powerful and versatile. Java as a language is very slow to introduce new language features, though it is runtime-compatible with several other languages that run on the Java platform (Groovy, Jython, Scala, etc..). Java is the language which has has the most run-time optimizations put into it, so an application written in Java is almost certainly going to be faster than an application written in C# or Python.

Python is an interpreted language (in general), and is pretty solidly multi-platform. Python has no "official" desktop or web frameworks, though desktop applications can be written using GTK or Qt support, both of which are multi-platform. Django has become a de-facto standard for Python web development, and is regarded as a very powerful and expressive framework. Python is at this point fully Object Oriented, and is notable for it's powerful tools for working with collections/arrays/lists. As an interpreted language, Python will be significantly slower than either C# or Java.


Python was made to be simpler, more readable, flexible and object oriented than what existed before - i.e. Java, Perl etc. It's actually closer to Java than it is to Ruby. Ruby is more like Smalltalk. Think of Python as Java without the stuff that mostly gets in your way, makes things awkward to do, slows you down or clutters the essence of your logic. So no semi-colons, curly braces for scoping. No static variable declaration or variables at all really they're identifiers that point to objects instead.

There's also a standard style guide for Python unlike other languages. Indentation is used to indicate scope and inconsistent indentation is a syntax error.

It also includes some often used things built into the language: lists, dictionaries, sets, generators etc.

Java is nice for those familiar with C / C++ syntax and are set in their ways, like that syntax and find it readable. Ruby and Python are for those that preferred Pascal or Smalltalk to C, like Lisp etc.


They are not similar at ALL. They all take widely different approaches to OOP, syntax, and static/dynamic typing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜