Teaching Java with Visual Studio Code why is this better than Eclipse


 

VisualCodeLogoVisualStudioCode_0Java

Java is one of the major practical and widely-used languages that fall within the Object Oriented family.

Many institutions use Java as a first-year teaching language and generally teach the Java course is intended to:

1. Provide all of our students with exposure to a common programming language that can be used by later courses and practical work

2. Introduce the syntax that is (almost) common to several of the most widely used practical programming languages today (the syntax of Java has a great deal in common with that of C and C++, so having learned Java you are quite a long way to understanding those languages too

3. Discuss the process of designing, writing and debugging programs and raise some awareness of issues of style

4. Present the Object Oriented aspects of a programming language as means to enforce modularity in large programs

5. Teach basic use of Java, a language that has significant relevance in the outside world today.

image

For those learning to code here is a set of the ten top things

1. Understand the task you are about to solve before starting to write a program about it. Work through methods and procedures by hand on paper etc. Plan some test cases. Identify cases that will represent boundaries or oddities. In general prepare a plan before you start going anywhere near a computer

2. Sketch the structure of the whole of your code out informally so you have full overview before fussing about exact syntax etc. Ensure you know what you expect that the computer will do. This initial sketch can be very informal, and may be in terms of diagrams rather than anything that looks much like real programming. The key word here is “structure”. This applies with way greater force when your code starts to grow: you should always design a good way to factor your code into reasonably self-contained and independent components (each will be one “class” in your code) right from the start;

3. Write out key parts of above in the form of comments before you start the real code. Concentrate in these comments on the “what” and “why” of your code rather the details of “how”. This will really help when you show your work to somebody else because you need help! I will explain this one again: The first thing you will type into a computer when you start writing any program will be a set of overview comments that explain its strategy and structure

4. At least for a first version of anything, favour clarity and obvious correctness over pretty well everything else. Clever tricks, worries about efficiency, generalisations etc can come later;

5. Neat consistent layout and thoughtfully named fields, methods, variables etc. are a good investment of your time. Cryptic is bad even if it saves keystrokes in the short term;

6. If a task is too big to solve in just one gulp look for ways of breaking it down into sub-tasks. As you do this think about ways you will be able to test code you write for each sub-task and work on the whole thing step by step;

7. When you try to compile your code and see a syntax error do not panic. Learn to interpret the compiler’s diagnostics. And only try to remove one error at a time: count it as a success if next time you try to compile the first error has give so you can then concentrate on the second;

8. When you have compiled your program and run it and it gives wrong answers or behaves badly do not panic. First work to understand what is wrong and only after you have found where the problem is think about ways to fit it. Do not just try random changes! Eg. confirm what your program actually does by adding assert and extra print statements;

9. Whenever you find you have to change your program review comments, consider if it will now do exactly what you want, and re-run all your test cases. Experience shows that changes (for whatever cause) can introduce new problems while you are in the process of fixing old ones;

10. If you find you are spending a seriously long time trying to make sense of anything then find help from friends or a supervisor or a book. Do not just keep building up your frustration not getting anywhere!

So why would you use Visual Studio Code in preference to Eclipse or NetBeans

image

1. Its Free

All students and educators get access to all version of Visual Studio, Visual Studio Online and Visual Studio Team Services via www.DreamSpark.com

2.Easier File Mapping

In Visual Studio, we can add a file from a path to a project located in a workspace, and Visual Studio records the reference to a new file and opens it like any other file. But, in Eclipse and Netbeans, the structure of a project's elements must correspond to their layout in the underlying file system.

3. File Size & Download Speed - 3X Better

Eclipse is 166 MB to download for Java. Even more for the other versions! To download the Java EE version of NetBeans, it's 186 MB. And it's 205 MB for all four languages. Now compare that to Visual Studio Code, which is only 58 MB for all 34 languages! Imagine having to wait three times longer per download/install on each computer in your school! And then downloading and installing the new versions for each of those machines!

4. No Plugins for Other Languages

Unlike Eclipse, in Visual Studio Code, you don't need a plugin to use other languages, like C#, F#, HTML5, Python, and Ruby. You can transition quickly to other languages!

5. Exposure to Other Languages - 8X More Languages

Java is important, but it should just be one language on the road to learning computer science! Eclipse only has Java (out of the box), and NetBeans only has 4 languages out of the box (Java, C++, HTML5, and PHP). But Visual Studio Code includes 34 languages out of the box! (Java, C#, C++, HTML5, PHP, VB, CSS, XML, JavaScript, Python, Ruby, Go, Perl, R, SQL, JSON, F#, PowerShell, and more!) And if it doesn't have your language, it's far easier to add it into Visual Studio Code than the other IDEs!

6. Easy to Deploy to App Stores

Visual Studio gives you a simple interface to publish your game or application in an app store! The biggest and best validation (and way to push improvement in your app) is when others like your work, people download it, and people use it. That includes deploying to Windows Store, Amazon, iOS, and Google Play!

7. VS Code Gets Git

Do you ever feel like someone doesn't get you? Well, VS Code gets you by getting how you need Git We're talking full Git Support: Commits, Diffs, Pulls, Pushes, Status Bar Actions, Branches, Tags, Handling Merge Conflicts, Remotes, Credentials, and more! Get the Git details here: Visual Studio Code  - All the Git Features

Comparison

Wikipedia

Languages Out of the Box

  • Eclipse: 1 (Java)
  • NetBeans: 4 (C++, HTML5, Java, PHP)
  • Visual Studio Code: 34 (Batch, C#, C++, Clojure, CoffeeScript, CSS, DockerFile, F#, Go, HandleBars, HTML5, Ini, Jade, Java, JavaScript, JSON, Less, Lua, Makefile, Markdown, Objective-C, Perl, PHP, PowerShell, Python, R, Razor, Ruby, Rust, Sass, SQL, TypeScript, Visual Basic, XML)

File Size

  • Eclipse: At least 166 MB
  • Netbeans: 205 MB
  • Visual Studio Code: 58 MB
Comments (24)

  1. It would be great to know how to configure Visual Studio Code for building Java files (i.e. running javac). Haven’t found that info yet.

    1. Neil Lindberg says:

      That’s exactly how I ended up here. While I am really liking VSC (and the default color scheme) I cannot seem to click-through to class definitions, even though they’re seemingly accessible on the context menu. I feel like running a [Maven] build would help. I’ve never used VS pre-Code, but in searching for an answer I found the older MVS had build abilities (Ant and Maven too). But, nothing here, on this page, is helping me progress in my goals. :/ May have to Eclipse.

    2. Dafty says:

      You can run Task execution

    3. Matt says:

      In 2017 it is rock simple to configure VS Code to run Java. If you have the Java SDK already on your system then as soon as you create a file in VS Code with the .java extension VS Code will prompt you to activate language support for Java. You just click it in extensions and you’re good to go. Make sure you have code runner (also available in extensions) installed to allow in-editor execution and you’re off to the races. I just did all this for the first time and it took maybe five minutes to get set up and running and that was without have the Java SDK on this particular computer.

  2. Lee Stott says:

    Hi there are number of extensions now available to VS Code see https://marketplace.visualstudio.com/vscode/Languages?sortBy=Downloads Some specific ones being built to support Java are available via the Visual Studio MarketPlace as extensions https://marketplace.visualstudio.com/search?term=Java&target=VSCode&sortBy=Relevance

    1. Andrew says:

      How is downloading an extension for Visual Studio Code any different to downloading a plugin for eclipse? Claiming that Visual Studio Code supports 34 languages out of the box doesn’t seem to be entirely accurate, considering you need to download an extension to run most of them.

      1. I think the answer is there is no difference.

        So then let’s compare another point…

        File Size & Download Speed – 3X Better

        Eclipse is 166 MB to download for Java. Even more for the other versions! To download the Java EE version of NetBeans, it’s 186 MB. And it’s 205 MB for all four languages. Now compare that to Visual Studio Code, which is only 58 MB for all 34 languages! Imagine having to wait three times longer per download/install on each computer in your school! And then downloading and installing the new versions for each of those machines!

        1. Sopot Cela says:

          What kind of answer is that? “Yes that one is an outright disinformation attempt (58MB for 34 languages), but look at the one below!”. This kind of articles are typical below-the-belt click-bait attempts from Microsoft. Will you never learn?

          1. Sopot, what do you mean by “look at the one below”?

            Personally, yeah, I find something one third the size (a little over that) to download and wait to install is a reason to choose it. Is it the only reason? No, but it’s something I look at when downloading and installing programs. Especially if you have to do that on 50 machines in multiple classrooms!

  3. nicviac says:

    There are some mistakes in this article, for example Netbeans also support these languages (full edition) out of the box:
    Javascript,JSON,XML,YAML,CSS,Groovy,SQL,Dockerfile. Also someone would ask what the language support means. Is it simple syntax highlighting or code completions or …? When I read this article I remembered some Microsoft rants about Linux, there also was sometimes truth, sometimes half-truth and sometimes just clear lie.

    1. Good to know. I think that’s my fault. I was pulling from Wikipedia and didn’t see what you wrote: https://en.wikipedia.org/wiki/NetBeans

      So, no lies from Microsoft. Just thought Wikipedia was accurate. Silly me.

  4. This article is full of misconceptions and mistakes about Eclipse IDE and VSCode:
    1. it’s free: Eclipse IDE is too. And it’s actually managed by a vendor neutral community involving more than a hundred serious corporate members, which makes it more sustainable
    2. Easier File Mapping: Eclipse IDE has been able to open an individual file out of an existing project forever. File > Open File… does that, as expected and well titled.
    3. Finally one true comment!
    4. That’s simply wrong, like so many other things written here: VSCode has a marketplace and doesn’t comme with all those language fully included. You have to download extensions for some of them to be more useful, just like other IDEs.
    5. Indeed, you took the *Java* Eclipse package, and you get mostly Java. Now, if you take another Eclipse package, you’ll get something else, the Java EE package proably support a dozen of languages already. And many more are available on Marketplace and inter-operable. Indeed, one has to select what they want rather than getting everything at once, it’s a different approach; but saying Eclipse IDE only has one language is wrong. The list of languages supported by Eclipse IDE and it’s various extensions is still bigger than the list of languages supported by VSCode.
    6. Wow, a second comment that’s not a plain lie! I didn’t expect so much!
    7. Git support in Eclipse IDE has been complete for years now, and several Git users clearly state that it’s even on of the best Git client on the market. On that topic, VSCode isn’t better, maybe it’s equivalent, but not much more.

    Also, you’re missing an important part: debugging. A debugger is something a good developer need to be taught. If you get taught Java without being taught how to debug, you’ll simply not be as productive as you can be with a debugger. At the moment, VSCode doesn’t have a Java debugger, whereas Eclipse IDE excels at that.
    That point is IMHO much more important that the 7 ones you mentioned.
    And really, the quality of the comparison is pretty bad: out of 7 points, only 2 are fully accurate. Please try to do better and, if you really want to be professional rather than doing unverified propagande, fix this article accordingly.

    1. Great! Thanks for the well-thought-out response, Mickael!

      Also, I have to admit that this blog post title with “Better” is a bit of a bolder statement than I’d go to. It’s harder to be better when there are so many factors at play. Also, the title calls out Eclipse. I think this is also about NetBeans. At least, my points are from the list we’re digging into.

      1. It’s Free – True. They’re all free. For the record, I didn’t add that one. As you mentioned, it doesn’t translate to the comparison. It’s more of a point Lee was making about misconception toward Visual Studio. So on your topic of misconceptions, they go both ways! But, yes, I agree it shouldn’t be on this list. But it’s also not a lie. VSC is free, and it never claims the others aren’t free! It just doesn’t belong in a comparison. It wasn’t on my version: https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/. The vendor-neutral company bit you mentioned is debatable (it’s a solid point, but one I’d argue against). Visual Studio Code is also open source, managed by people who get paid to manage it, and it is also contributed to by a community involving more than a hundred serious corporate members. And because it’s backed by a corporation who can fund it, accessibility and competitive feature improvements come into play. This makes it more sustainable and likely to grow at a more substantial rate. I think your argument made me come up with another reason to add to the list (new #9). =^)

      2. Easier File Mapping – It remembers the file without having to look up the file layout? Great. I can update my list. I’ll start with a note on #1 (on my blog), since I have some questions to clarify this (https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/). How about NetBeans? I’m assuming it doesn’t have file mapping?

      3. Yes, there’s truth in all of these. You’re finding flaws floating in the truths, and that’s greatly appreciated. We did a lot of testing these points, but obviously, we should have asked you to test them. =^)

      4. Good point. It’s worded incorrectly. The truth is that there are a lot more out of the box, and if we’re talking about marketplace extensions, then VSC still is the clear leader, with 200+ languages. It just needs to be worded more accurately. As I mentioned, we should have had you test this out! I updated the language on my list (please review): https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/

      5. I updated the language on this one too. You also made me realize how powerful the Marketplace is! I added two more items to my list (new #5 and new #6). Please review (since so far, you’re the best reviewer we’ve found): https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/. Oh, and you think Eclipse has more languages? If that’s true, we’ll adjust it. How many programming languages does it have? Oh, I found it… 181. Well, I think that’s less than 849.

      6. There are no lies here. We just didn’t have as good of a reviewer as you! But we have you now!

      7. So, there are more Git features for Visual Studio Code, but you don’t care? If not, what exactly is there for Eclipse? Do you know of a comparison or a list of features for Eclipse? I’ll go ahead and make a vague note for now.

      So there you go. You helped make the list more accurate and add three more reasons to select VSC! Thanks!

      1. Mickael, on your #2 points, it looks like Nitin’s comment below contradicts this. Can you review and respond to it? Thanks!

  5. Saying “Visual Studio Code includes 34 languages out of the box” is highly inaccurate and misleading. Take for example Go: I gave it a quick try, and the built-in support for Go in VS Code is just syntax highlighting, plus dumb textual code completion (basically scans for words in document and presents those as suggestions – there is no syntactic or semantic analysis involved or any heuristics). Same thing happens with C/C++ files. I haven’t tried with the other 34 (!) languages you mentioned, but I imagine it will be the same for many of them.

    I don’t think any serious programmer would consider that built-in functionality to be proper language support. In fact when you open a Go file, VS Code shows a pop-up recommending you to install the Go extension (which will have proper language support: https://marketplace.visualstudio.com/items?itemName=lukehoban.Go ). Same for C/C++ and others.

    BTW, this situation is similar to Eclipse, where upon opening a file from a language that is not supported in the current installation, it will open a dialog asking the user if he wants to search for and install extensions in the marketplace, for that language.

    1. I forgot to say the above also invalidates point 4 of your article. There is full support for those core set of 5 languages or so, but everything else (Go, Rust, C/C++, D, and so on), requires extensions. (extensions are not called “plugins” in VS Code, but it’s effectively the same thing, obviously!)

      1. Lee Stott says:

        Hi thanks for the comments.. In most cases students and academics wish to use a variety of tools, so yes some institutions will install 5 IDEs. However one of the key asks is around applications is. 1 size of install and 2.security requirements of the install 3. platform support of the install. A key driver for VS Code adoption is its a light weight tool in most cases is capable of being used across modules dependant upon the lesson/module being taught and in all cases its not about replacing x vs y, its about opportunities of using the best tool at the right time. Eclipse etc are all great tools so this instant saying they are bad tools! But if a student is doing 30 hours of Java in a module is worth the institution installing a vast range of tools sets, patching updating validating of those packages. We have seen the adoption of VSCode in education because of it supporting extensions for a number of popular languages in education from Haskell, Java, C# and its cross platform support. Additionally we have seen an adoption of electron also being a taught, which has resulted in a number of students building custom extensions for themselves and even their institution. Some of the key feedback at an institution level is cross, platform support the ability to build assessment tools and this requirement is increasing with a number of institution using online submission extensions for code checking and assessment submission. So yes its user decision to what they teach what tools they use to teach but ultimately someone is going to have to build a managed desktop image be in Windows, Linux or Mac and deploy this to the classroom if the apps cannot be managed and updated or labs simply don’t have sufficient disk space then there is a issue that lessons will be impacted. Additionally coding experience in the classroom is limited and students will decide which tool they prefer and simply utilise those tools to undertake assignments/assessments or homework.

        1. > A key driver for VS Code adoption is its a light weight tool

          du -sh /usr/share/code/ -> 160MB
          du -sh ~/.vscode -> 61MB (this includes the Java extension).
          So overall, Java development without a debugger in VSCode takes 220MB of disk space.

          Took Eclipse for Java development and unpacked it:
          du -sh eclipse/ -> 195MB
          And for that price, there is a debugger.

          Now, let’s talk about RAM usage:
          Scenario: open a simple Maven project in VSCode and Eclipse, open the same .java file, trigger completion on the same location
          ps aux | grep eclipse -> shows %MEM=9.8
          ps aux | grep code -> shows multiple processes (which is expected by design of VSCode) with the sum of %MEM=9
          So VSCode is a bit better their, but a 10% gain isn’t that strong.

          The arguments of disk space go in favor of Eclipse, the arguments of RAM consumption go in favor of VSCode; overall it’s not really what can be factually used to highlight one tool is better than the other for teaching.

          1. VSC doesn’t include a debugger? What is the difference from this? https://code.visualstudio.com/docs/editor/debugging. You mean supporting the specific language?

    2. This is a great point. Mickael also made this point in an excellent response. Please review my updates. Thanks for your help!

      https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/

      On the topic of whether out of the box languages matter (and file sizes), it’s different for different people. For teachers, yeah, this matters.

  6. Nitin Dahyabhai says:

    The Easier File Mapping statement is misleading. For any Java application that goes beyond a single file, the layout NetBeans and Eclipse enforce is what’s expected by the compiler in the JDK. The compiler can’t find classes declared within packages otherwise, so Eclipse and NetBeans are saving the user from maintaining that layout by hand. As for the download size, the Eclipse download cited has full XML, Git, Gradle, and Maven support in it, and isn’t being positioned as a teaching tool. Granted, while a download of just the Java tools would be larger than VSC’s download, VSC’s doesn’t exactly contain support for all of the stated 34 languages.

    1. Thanks Nitin. I updated that on my list: https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/

      So you made a point is that Eclipse, by default, isn’t intended/ideal for teaching? Thanks!

  7. Mark says:

    Highly inaccurate and opinionated. VSC is a good tool. But there is no proof it is better for teaching Java.

    1. Mark,

      Agreed. I don’t think anyone is going to be able to prove anything, with so many variances at play, in the software, languages, and teacher needs. So I prefer to describe it as reasons to teach Java in VSC: https://blogs.msdn.microsoft.com/user_ed/2016/02/05/why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans/

      These reasons might not work for you. Are you a teacher? Thanks, Mark!

Skip to main content