Related
I want to start developing desktop java applications and I would like to know what the java community uses.
I started with Swing but I found it very rudimentary.
I'm used to work with .net c# WPF with Visual Studio 2010 and I was looking for something with the same quality (or close) with java ( Swing + Window builder is not an option )
I would appreciate your inputs, even if you disagree with my Swing opinion
thanks all
The other option you want want to look into is SWT (The toolkit Eclipse uses). It renders using mostly native components so it feels more robust like a real desktop application.
I'm looking for a better looking and feel development..
Swing offers 4 PLAFs as standard. There are at least a dozen more 3rd party PLAFs, some with dozens of variants. Of that plethora of possibilities, end-users generally prefer the 'native' PLAF - which looks and feels mostly like 'every other native app.' on their machine.
You can see a small app. that changes PLAF. on the Nested Layout Example. Here is the Mac. native PLAF.
..why do you think it is not easy?
This was said in relation to a general comment that it is harder to build a GUI in Swing than (for example) Visual Studio.
The reason for that is that Swing is intended to work on multiple platforms, screen-resolutions/sizes, PLAFs (and other factors). As such, 'dragging and dropping' components into their final position is impractical, since that might change according to the factors listed above. Instead Java relies on the concept of layout managers, which calculate the size and position of components as they appear at run-time.
The layout managers use 'logical groupings' of components to achieve the desired general shape expected of a GUI. The image above is an example of how to combine layouts to achieve different effects in different parts of the GUI.
Although I don't use GUI builders for Java I do feel that they can increase productivity, it is just a matter of:
Already knowing what Java Layouts are available, and how to use them.
Using the standard layouts in combination in the GUI, to achieve the desired effect.
If you don't mind an external dependency, you could also take a look at SWT. It's the framework that eclipse is built with, though it's not the easiest thing in the world to use.
It does provide a GUI-builder called SWT designer (if I remember correctly). It's not as good as what you're used to in Visual Studio though. That's a pretty high bar for quality. In the brief experience I have with it, there was a fair amount of boiler plate code, and the API isn't quite as intuitive as I'd like personally.
However, it is fairly widely used. Eclipse is built on it, and by extension, so are many professional tools built from that same base (Such as IBM's Rational tools, and Adobe's ColdFusion Builder). That should give you an idea of the power of the tool, if nothing else.
How about Java under Mono,using IVKM and Gtk?
You would be able to program in java, but your application would actually be .NET code... Not sure if that works for you.
If you want to move away from .NET alltogether, then perhaps you could use the java Gtk bindings:
http://java-gnome.sourceforge.net/
Check out JFormDesigner. JFormDesigner with Eclipse is a very powerful tool set. Also look for a good LaF. See The Alloy Look and Feel and JGoodies. You may find Look and feel in java useful.
I am new to C#, C++ and .Net.
I am currently returning to programming from a stint in Networking and Cisco engineering. I used to program on IBM mainframes etc using Cobol, assembler, easytrieve, Rexx and clist etc so the command syntax is reasonably familiar to me as are programming standards and structures.
However I am having quite a bit of trouble getting to grips with the BCL and understanding the various components and what each is designed for and which is best to use in various situations, and in fact how some are actually used and coded.
I am often scratching my head wondering how the code came about from the descriptions I have found about the BCL components. Basically how to use them and code them seems to be a black art with no intuitive means at all.
So my question is, apart from the msdn library, which I am finding to be a bit over complicated for my current needs, is there any good reference book, site, pdf that can give me a reasonable description, usage notes etc of the most commonly used .NET components such as System.IO etc ?
I have read a few book on C# etc and have found a small program that does part of what I need to do in a project I have, requiring acces to devices via RS-232 ports, but when decoding the program I find myself wondering why the person used the components he did and how would I know which components I should use when I make the changes I need to and add in the extra code that I require and how do I actually use these components when I do find them ?
I do realise a lot of this will be down to plain old experience, but a helping hand in the right direction would really help a lot.
Many thanks, George.
C# 3.0 in a Nutshell is good for this, as is Accelerated C# 2008. I think I'd personally recommend Nutshell more.
Note that the next edition of Nutshell is being prepared - but I don't know what the timeframe is. (I'm sure there'll be a slew of books for .NET 4.0.)
(Note of bias: I'm a tech reviewer for C# 4.0 in a Nutshell, so I'm clearly not 100% impartial.)
I often use Google in preference to the standard Help, there are often better examples out there.
I am looking for reusable open source components. The level of depth, breadth and hopefully quality that I'm looking for is similar to this.
Although I need them in programming languages C#, Java and Flex (which I often use in my projects), other languages such as PHP, Perl, Python, Ruby etc. are welcome. I see this as a big help for other programmers who have similar needs such as mine.
I plan to eliminate code duplication when building a large scale (in terms of code size) project by using this components and focus more on the business logic of it.
Is there an open source (Java) or Codeplex (Microsoft) component implementation that does this that I'm not aware of?
EDIT:
The main point that I want to address for this question is to avoid interdeveloper duplication. Interesting case found in Pragmatic Programmer: An audit for government computer systems have been made showed 10,000 different programs having their own version for Social Security number validation.
If I understand your question, that is what Apache Commons is all about.
I would point out that although such things are good, they aren't all upside. If all of those 10,000 programmers had to coordinate getting a SSN validation going, it would have been quite a bureaucracy to get anything done.
Similarly in general, one of the issues with apache commons is you might be integrating your code into something that uses an older (or newer) version of the same component.
Also, any code changes would have to be validated over a huge code base, and some times ugly workarounds made in the name of reuse.
Reuse and DRY are wonderful things, but like everything else, as you scale larger, there are tradeoffs.
Not quite sure of the context of the question, if you want UI components for web-based Java applications, maybe the JSF framework with a component library like Apache MyFaces which has several component libraries, or ICEfaces.
Well if you're after some flex components you could try some of the following, sorry I can't post hyperlinks I'm a new user so just copy paste text (this sucks - give me some reputition so that I can at least answer a question!)
link - code.google.com/p/flexlib/
link - www.adobe.com/devnet/flex/tourdeflex/ (this has examples and source code for components other than adobe products)
link - flexbox.mrinalwadhwa.com/
link - www.adobe.com/cfusion/exchange/index.cfm?event=productHome&exc=15 (this has free and paid for components)
There are loads more open source flex components out there. Just check google.
With some changes in the staffing at the office, the levels of C# expertise has dropped off precipitously and there are now more Java developers. It has gotten to the point where the higher-ups are considering moving an existing .NET project written in C# into the Java world.
Aside from the obvious problem of starting completely from scratch what are the possible ways that this company can accomplish a successful move of development on a project from .NET C# into Java?
Here are things to consider:
Is this big project? If Yes, try to stick with C#
Is this medium sized project with components? If No, try to stick with C#
Is this small project meant to be deployed on windows only? If yes, try to stick with C#
Is this old source code? If Yes, try to stick with C#
Do you use windows OS specific APIs? If Yes, try to stick with C#
Do you use any third party APIs without Java counterpart? If Yes, try to stick with C#
Do you use .Net in "deep"(data binding, User controls etc.)? If yes, try to stick with C#
Migration time is more acceptable than getting new/converted C# guys? If no, try to stick with C#
Do you think end users will not be receptive of changes, if you are to use Java framework which will change presentation? If yes, try to stick with C#
Check commercials
If you decide to convert:
Go per component
Go per layer
Have lots of tests
Check if there are tools to help (however small help may be) with migration
Just to add to Brian and Eric's opinions, I would say that picking up C# for a Java developer should be straightforward in my opinion. They are conceptually very similar languages and I would suggest training your Java developers to gain some C# skills so you won't be forced to go to the hassle of a migration process.
I subscribe to Joel's view that a total rewrite is almost always a mistake. Other posters are right: C# and Java are similar enough that any competent Java developer should be able to become competent in C# in a matter of weeks or months. That's not to say they will be experts. That takes longer but as long as you have some C# developers who can guide the process then you should be OK.
It's hard to comment on whether or not such a transition is a good or bad idea without knowing specifics of your application: size, type of application, industry and so on.
I would be extremely reticent about such a switch because, in my humble opinion, C# is now a much more modern language than Java and I say this to you as someone who has been a Java developer ofr over a decade (since the 1.0.2/1.1 days).
That's not to say that Java is bad. It's not. Sun does have a cloud hanging over it and demonstrated an unwillingness or inability to drive the platform forward in recent years.
Regardless of the languages involved, the management of this company sounds insane. For anything other than a trivial application, how can it be economically sensible to rewrite an entire code base from scratch instead of just hiring a single person with some skills in the right language? Is this a business with that well-known problem: too much spare cash?!
How long has the existing code been in development? If it's barely started, I could understand this. If it's seen a release and has active users, it will never make sense to throw it away. If you donated the C# code to a start-up with the right skills, think how much of a head start they would have over you.
Before you finish converting the .NET project into Java, all those Java developers who were part of the conversion project will have learned C#. So then you don't anymore need to convert it to Java (and you can throw away all Java code which was produced in the conversion), because now you have a development team which can do both Java and C#. Problem solved. :D
Have a look at Net2Java, which puports to assist in converting your code from C# to Java. I doubt it'll be perfect, but its one way to remove a lot of drudgery from the task, leaving you with the kinks of incompatible framework calls and language features to iron out.
Once you've done that, your task is like any other large migration project - test, test and test again. Unit tests, System integration tests, then end-user tests. You should havew those tests already in place that you used with the original application, apart from the unit tests, they will still be relevant.
If there are any components that are already isolated or any of it uses a service-oriented architecture, you could conceivably migrate one component at a time (where each individual component is a rewrite) and still have the components talk to one another using the same interoperable network protocols. Probably depends on what type of app we're talking about.
Make sure you have tons of tests, because such a migration will bite you where you expect it least.
Do you have more .Net or more Java applications in production. If your already have a substantial investment in .Net servers and applications, why not ask for volunteers among the Java developers to move to .Net? The language and syntax is very similar, so the hard part would be learning the framework and unless they would spend all their time doing UI development even learning the framework is not that hard.
In our office we have a number of very good developers who move back and forth between Java and .Net as needed.
I am not a Java expert, but from my experience working with Java code whilst being a C# fan, the following are some of the possible headaches:
Generics are implemented differently in Java and C#.
Boxing/Unboxing behaviors are different between Java and C#
Java class naming convention + lots C# generated code
String handling (i.e. Unicode/ASCII concerns) can be problematic depending on the quality of Java/C# code being ported over.
Personally, I don't think writing from scratch is a bad idea at all. Since you already have a working architecture.
In order to prove to management, you always needs to talk in terms of ROI and numbers. Show them that if you move these applications, it will take tremendous amount of time, QA resources, and can easily take a back seat if it gets de-prioritized due to some other project or new development taking importance.
I had success when I showed them the timelines, ROI, work involved, money involved, etc.
So now coming to the actual point, I do think Java developers would be able to support C# unless they have some fundamental mental block against Microsoft technolgies.
Possibly you could use jni4net - opensource bridge ?
Or list of other options I know.
I'm somewhat surprised noone even suggested the idea of rejecting migration.
I do not believe a C# developer can be forced to switch to Java (or vice versa) because he was told to (well, if he's threatened with a gun then maybe). I takes much time, exercise and passion to master at least one technology stack. You just can't start overnight with a new technology and expect to provide the same quality.
I'd personally not bother until told to start migration. At which point I'd tell the manager that I'm .NET guy and won't switch to another technology just because they decided to.
As for the technical side, it's not the language syntax that differs but rather libraries and their features. Of course, if all the latest bells and whistles of .NET 3.5 have been extensively in use then the language difference will provide you with a real challenge.
That's certainly a funny way, just decide to migrate applications from .NET to Java. Someone has no idea of the hassle involved...
I realize that this is an old question but to anyone else going down this path, you could try this open source C# to Java Converter:
http://www.cs2j.com/
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to know why I should learn C#?
What features does C# have that Java does not?
C# is an object-oriented high-level language which can be useful to develop applications.
It supports getter/setter constructs, delegates and true generics, which Java does not.
C# usually feels more "native" on Windows, since Windows.Forms and WPF are closer to native code than Swing.
However, Java is more cross-platform than C#(even though project "Mono" is changing that)
There's a whole lot of differences: http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java
Whether you should use one over the other depends on your priorities. What do you want to write in them?
C# (and other the CLR languages) have aspects of functional programming (such as delegates and closures) that make some types of development and design patterns easier. See this post by Steve Yegge for more. Delegates can make code much more expressive and concise.
You should learn both, and use each of them as appropriate. I don't feel like it's a "which one should I learn?" kind of question. (Or a "I know Java, why should I learn C#?" question.) That comparison that Welbog posted will help you decide when to use one over the other. But, myself, I like having both in my toolkit.
Syntax:
They are both reasonable languages--they support pretty much the same high level structures and designs (OO, encapsulation, ...) and are fairly equal up until you get down to the code level (which overall isn't that big a deal. C# beats java in features, Java beats C# in simplicity I guess).
Portability:
My biggest factor has been that lately I've worked on apps for a spectrum analyzer and upcoming cable systems. Neither would have been remotely programmable in C# (you are completely reliant on microsoft to port the runtime to your platform of interest. Java is open source (there may still be one or two little pieces that aren't, but they are sincerely working on that and it's enough that you can port it and use it just about anywhere.
If you are only ever interested in Windows and if you'd like to take advantage of tight, simple integration with windows, then C# is the platform for you.
VM
Both languages include a "Runtime" that can support other languages--and those other languages generally have access to the (very rich) libraries provided in each environment.
Microsoft can run a few (a dozen) languages on it's VM, none as impressive as C# (although Ruby and Python could be good--are they fully available yet)?
The JVM has a few hundred including some cutting-edge experimental languages that often run as well as or better than their native counterparts. Some are considered the next generation in programming, as different from Java/C# as they were from C. I looked into Scala, but I must be getting old, it just hurt my head, but I admit there are some very advanced concepts available in there. Groovy rocks.
System integration/tools:
C# wins hands down since Java can't commit to any one platform. C# is also very well integrated with databases and other external dependencies, Java is getting better integrated, but the tools are a little more mismatched. C# the entire toolset tends to be very integrated since it all tends to come from a single vendor.
Number of platforms using it (number of potential customers):
Last I heard, Java wins hands down. WAY down. Every try to figure out how many phones, microwaves, TVs and toasters might be running Java? The number dwarfs every other language combined as I understand it...
the only reason you should is because you want to
C# is a
multi-paradigm programming language that encompasses functional, imperative, generic, object-oriented (class-based), and component-oriented programming disciplines
so you get to learn a lot of tricks from different paradigms, all in a single language
There are lots of questions that people have asked on this topic already. Read up, they've got good infos there. :)
The biggest reason, imho, why is because (for windows desktop apps at least) Java UI is godawful ugly. Fugly ugly. Vomitously ugly. Ugly like the kid you'd have if you impregnated your sister.
If you are required to run on any OS, Java is your best option (tho Mono is catching up!). But if you're programming for the Windows environment, C# is a dream to code and looks like any other native application.
Other than that, I'd say Linq. And the ability to fail fast on exceptions rather than having to handle exceptions everywhere (like we actually know how to handle each and every exception). Oh, and Linq again. Linq is so beautiful... to me... Can't you see?
Crap, forgot about lambdas. Damn, I love lambdas and all their closure goodness.
Simple answer -- C# is the primary language for developing Micorosft applications at this point. Learning it opens up a new world of potential opportunities to work on Microsoft-based applications.
Also, it's not really that hard to learn. Just a little harder than VB was, but with lots of OO power.
Some people would say C# is Microsoft's Java -- actually they look almost identical, just minor differences but different class libraries. If you already know Java, picking up C# shouldn't be too hard.
I can't believe nobody has posted this yet..
Because, it is a fun language. Personally I think Java is a rather nasty language (still can be fun), but not as enjoyable as C#.
Do you need to learn C#?
Is your job situation going to improve?
Do you want to learn something new?
Is the development environment better in C#, is the tooling better?
Do you think you can do something in C#, that you can't do in Java?
Maybe a generic language for desktop, web and mobile - but Java has this as well.
Just a few questions you could use to decide.
I'm C# myself, started out in Java when I was introduced to programming. I think Java did a fantastic job for me in understanding programming, mostly because there were no magic IntelliSense, or form designer for Windows apps - we had to write the whole damn thing our selves. Which was good, when you're learning. But I think C# and the whole .NET/Visual Studio eco-system enables you to be more productive.
More important than the feature of the language are the run-time environment and the libraries.
C# and Java have a different set of libraries, frameworks, operating system interactions, etc.
Based on the question seems like you are not interested in learning it for the sake of knowing more about programming and clearly looking for practical reasons.
That is why I don't think you should bother learning it, since it will be just another tool to accomplish same thing in your toolbox.
I like what Welbog wrote. I would add that it would also depend on where you're at professionally, your interests, and your job prospects /interests.
If you're you've just started to learn Java, then picking up a little C# might help in terms of broadening your programming horizons. The languages are similar (roughly speaking), but of course there are nuances to say the least in programming in one versus another. If you've been programming Java for awhile, then perhaps you'd be better off either expanding your J2EE area of expertise or maybe looking at other supporting areas and/or languages.
In terms of job prospects, you might find companies in your area hire more .NET developers than Java, or vice-versa. You might also want to look at companies you want to work for and make sure your skill set matches. For example, if you've dreamed at working at a particular firm who uses JSP, just as an example, then sticking with Java would be better.
It is not C# that you should want to learn but .NET Framework and related technologies.
Think rather J2EE vs .NET.
Why would you want to learn .NET? It's up to you to decide. Like Java it's one of the few major development platforms. It is functional, very actively developed and supported with a huge community knowledge base.
To me the choice is as simple as I need to use .NET libraries, so I'll use C# or I need to use Java libraries so I'll use Java. If I'm working on something on a Windows client I'll use C#, if I'm working on something that needs to run against the P6 Integration API I'll use Java.
You shouldn't feel like you you are missing something or should use one or the other. Look at what you have to do and pick the best tool for doing that.
It's tough to list on a post here all the features of the .NET Framework, just like it would be tough to list all the features contained in the Java SDK Libraries.
Learning C# because it may or may not have features that Java doesn't have seems like a very odd reason in opinion (it does have a number of features, that Java doesn't but so does F#, LISP, Haskel, Ruby, Lua and even COBOL).
You should learn C# because
You need to (to keep or get a job, stay in school, whatever)
You want to
It is fun to expand your horizon
Any or all of the above
There are some syntactic sugar advantages in .NET such as LINQ or Properties. (Yes, you don't have properties - not to mention auto-properties - in Java).
Strategically, it helps to know several languages as demonstrated by a little research. Currently, PHP, Java, and ASP.NET (C#) are the most widely used server-side programming technologies (see https://w3techs.com/technologies/overview/programming_language/all). Therefore, knowing all three empowers your backend engineering potential.