What is the difference between Java and JavaScript?

Java is related to JavaScript in the same way that a grape is related to a grapefruit.

Similarly to the previous question, Java and JavaScript are not related in any technical sense. They share a bit of syntax as they are both influenced by C, but that’s about it. Wikipedia has a good explanation of why the name similarity exists: Wikipedia: JavaScript and Java

Classes versus Interfaces

This is a question that appears frequently and often confuses beginners since on the outside both seem to do similar things.

/u/donsagiv wrote a great and simple ELI5 (link to original comment):

A boy scout has badges that merits them to do certain things, such as cooking, swimming, starting a campfire, canoeing, etc. The boy scout troop doesn’t care how they were able to do these things (i.e. swimming with the breast-stroke, back-stroke, etc.) as long that they meet the specification for it (being able to move in the water by a certain, controlled movement of the body while staying afloat). Each boy scout can have zero or many badges, meaning they are certified to do each of the things merited by the badge.

Despite that, they are still boy scouts. Every boy scout is allowed to attend their periodic meetings, wear their uniform, etc… A boy scout doesn’t need a badge to swim. However, they can’t go river-rafting unless they have a swim badge. Edit: a swim badge can’t swim by itself. It is merely an indicator that the boy scout it’s attached to can swim.

The boy scout is the class, and the swim badge is an interface it implements.

Every object that of the class that is instantiated have the same functions (i.e. attending periodic meetings, uniforms, etc). If the class implements an interface, the class MUST have be able to perform the functions specified in the interface (i.e swimming, canoeing). Some classes can’t be used in certain parts of your code unless they implement that interface (i.e. going river rafting requires swim badges). Edit: An interface is an abstraction, so it can’t be instantiated. (A badge by itself can’t swim.) To sum up, an interface is a contract a class must follow in order for a class to implement it.

Interfaces and classes behave differently in different languages (My example is from what I know in C# with generics). I suggest you read the documentation to your language carefully.

Interfaces can also be used to collect objects from different classes (they act like a data type).

You could collect all boy scouts who can swim, regardless of their nationality, gender, age, etc. and go river rafting. You don’t need to know anything about the individual boy scouts, but you know that each of them is able to swim.


Tools and version control

Start here: The Missing Semester of Your CS Education

What is Source/Version/Revision Control? Should I be using it?

A Version Control System (VCS) is a tool which keeps track of the changes to your code, and allows you do handy things like undo coding errors and see what has changed in the code over time. Modern Distributed Version Control Systems (DVCS) also allow you to work easily with other programmers on the same code. And yes, you should definitely be using a version control system!

The two most popular DVCSs are git and Mercurial; which you use mostly comes down to personal preference, but we strongly advise you to use one of them.

So how do I get started with revision control?

You can start with git by reading a git primer, written by a redditor, and also the free git book.

A good, brief tutorial on Mercurial is here.

We have links to download sites for both pieces of software on our tools page.

What is an IDE? Should I be using one?

An IDE is an Integrated Development Environment, which is a GUI application that generally includes a text editor with code completion and syntax highlighting, some project management features, a compiler or interpreter (either configurable or included), and many other fancy features to make writing, running, and testing code easier. The alternative to using an IDE is to do what the IDE is doing for you automatically on your own. This method requires the programmer to use separate tools and to have a more in-depth knowledge of the development process.

For beginners, there are arguments for both of these development methods:

  • Using an IDE means that you don’t have to know as much about the development process, don’t have to use a command-line interface, and don’t have to configure those tools to work together correctly; an IDE offers a quick way to get your code building, and may even write some of the code for you!
  • On the other hand, working from the command-line means that you don’t have to fit in with the mindset of the IDE’s designer, and since less of the development process is hidden from you, you get a better understanding of the software build process.

Use of an IDE versus separate tools generally comes down to a matter of personal preference (unless of course your employer/school requires the use of a specific development environment). If you’ve never used an IDE before, download one of the popular ones and tinker around with it. And if you’ve never used vim or compiled code from the command-line, try it out and see if you like it. A list of common IDEs and lightweight text editors can be found in Programming Tools.


Computers and Operating Systems

What kind of operating system should I use?

A common question many beginners have is what sort of operating system they should use — Windows, Mac, or Linux.

It honestly doesn’t matter — in this day and age, the quality and maturity of the tools available to you are going to be about the same on all platforms, and any decent programming language will be usable on all operating systems.

That being said, you should eventually gain some level of familiarity with all three operating systems so that you’re not completely lost when you encounter a new kind of OS (for example, when remoting in to another machine or when you arrive at a new job).

There are two main exceptions to this rule:

  • If you want to do Windows-specific development, get a Windows computer.
  • If you want to do Mac or iOS-specific development, get a Mac.

There are a number of good options for running C# code on other platforms, but some Microsoft and .NET tools are still primarily targeted towards Windows.

While you can develop Mac and iOS apps on any computer, you must use Xcode on a Mac machine to compile and submit your app to the app store.

Finally, it’s also worth noting that you’re not “locked in” once you’ve picked an operating system — it’s always possible to run a virtual machine (VM) with another operating system installed. For example, if I own a Windows computer, it would be very easy to set up a Linux virtual machine that I can use without fear of it interfering with my existing Windows OS.

What kind of computer/laptop should I get?

Again, it doesn’t really matter — any mid-range laptop or computer should do. If you already own a computer or laptop, you should just use that instead of purchasing a new computer. Basically, you can learn to program and can write complex and interesting programs on pretty much any computer in existence.

If you’re basically destitute and without any usable computer, you can always check places like Craigslist for a used computer, or ask around. You can get very far with an old computer if it’s just for learning.

However, if you happen to need to buy a new computer and want to use it for programming, you should prioritize CPU, RAM, and hard drive space. If possible, try and obtain a computer with the following specs or better:

  • Intel i5 CPU (3.0+ GHz)
  • 8 GB RAM
  • 200 GB hard drive
  • (Optional) A solid-state drive

If you can upgrade, it’s probably safe to prioritize getting a better CPU and more RAM over getting a larger hard drive — a beefier CPU will always help; some programming tasks do require a fair amount of RAM. In contrast, most kinds of programming don’t require you to have a lot of disk space: the only exceptions would be if you’re trying to do something with images or videos, or if you want to download and analyze large data sets while learning about machine learning and similar things (and you can typically store those things in the cloud, if it comes down to it).

If you want to purchase a desktop, these specs are really the only relevant ones. If you want portability, you should purchase a laptop and make sure that it comes with a big enough screen and keyboard to be comfortable programming with. However, there’s a fine balance between usability and portability in a laptop:

  • The larger the screen, the shorter the battery life (but the dimmer you’re willing to set the screen’s brightness, the longer the batter life)
  • The smaller the screen, the less you can fit on it and the more flipping between windows/desktops you’ll have to do.
    • Ideally, you should be able to comfortably fit 2 windows side by side
  • The larger the laptop, the heavier it is, and the heavier it is to carry around

It’s also worth asking yourself how you plan on using your laptop. Do you plan on just having it sit on your desk all day, or on carrying it all around campus, or on going hiking in the Yukon with it?

If possible, try testing the laptops you’re considering in person. If you find typing on particular laptop’s keyboard to be unpleasant and not something you can get used to, for example, you may want to give that laptop a pass no matter how good it looks on paper.

If you are also trying to buy a laptop to prepare for classes in university or college, you may want to try checking their website/the website of their computer science or software engineering departments to see if they have any more specific suggestions and recommendations.

For more information, and for more detailed help, visit the following subreddits to get more personalized recommendations:

You may also want to be cautious about buying Chromebooks — they’ll require either some degree of customization or will require you to work using online editors and IDEs and require constant internet access. For more information, see the following links:

You should be even more cautious about trying to use tablets or phones as your primary programming device. While it’s possible to program using a tablet or phone with some effort, nearly all software development is done using desktops or laptops using a keyboard.

If you need advice on picking a specific brand, just keep in mind that programming doesn’t require anything special from your computer. This means that a good general-purpose computer will, in all likelihood, be a good programming computer. (This makes searching for a good laptop easier, since you don’t need to try and search for one specifically marketed towards programmers.)

One final optional constraint: If you’re specifically interested in doing machine learning, natural language processing, or graphics (including game development), you may want to consider purchasing a machine with a GPU. While you don’t need a GPU to do any of these things, you can often speed up your code by carefully writing it so that it takes advantage of GPUs (when possible).

If you’re interested more in machine learning or NLP, do note that you can rent machines with GPUs in the cloud via services like Amazon Web Services (AWS) or Google Compute Engine (GCE) for relatively cheap prices.

Can I learn Programming without a laptop/phone?

The general answer is yes provided that you have some device that can run a web browser.

There are plenty online IDEs and courses.

A few examples

Courses:

IDEs


Careers and jobs

Can I earn lots of money programming?

Maybe, but only if you are good at it. But you can also earn lots of money as a plumber, or in any other number of businesses. You can also fail horribly. Programming is not a guaranteed, safe job.

Can I get a programming job without a Computer Science degree? Or without any degree at all?

This question is mostly out-of-scope for this subreddit: try subreddits like /r/cscareerquestions instead.

But briefly, yes and yes. It’s possible to get a job without a CS degree and without a degree in general, though with decreased probability.

If you:

  1. Are in the middle of completing a non-tech related degree and cannot switch majors, it would likely be best to complete your current degree over quitting to self-study programming. For better or for worse, some employers will automatically discard job applicants who have not completed any degree — google “credentialism” for more.
  2. Do not have a degree or have already graduated with a non-tech related degree, try asking in subreddits like /r/cscareerquestions or /r/cscareerquestionsEU if you need help evaluating your options. Also see /r/cscareerquestions’s FAQ.

Is doing X enough to let me get an entry-level job?

This question is mostly out-of-scope for this subreddit: try subreddits like /r/cscareerquestions instead.

To answer simply, there is no 100% guaranteed way of landing a job and no 100% reliable way to check if you are ready to start applying for one. The best you can do is work on improving your odds of being invited to an interview, submit your resume, and see what happens.

If you are not getting any responses, try posting your resume for feedback in /r/cscareerquestions’ weekly resume review thread.

See the How do I break into the industry and get an entry-level job section below for more details.

How do I break into the industry and get an entry-level job?

This question is again mostly out-of-scope for this subreddit — career-related questions are better asked on /r/cscareerquestions and by consulting their comprehensive wiki. Also see /r/cscareerquestionsEU if you are living in the EU.

But in general, there are two main phases to getting an entry level job, assuming you already know how to code:

  1. Build a resume that stands out enough that people start inviting you to interview
  2. Pass the interview

The two stages require somewhat different strategies.

Phase 1: Build a resume that stands out

In phase 1, your goal is to steadily start adding items to your resume that help you stand out (or at least help make you comparable to) any other applicants that are applying.

One particularly helpful strategy for doing this is to start building a portfolio of non-trivial projects you can show off to prospective employers. Your portfolio could contain anything ranging from:

  • Independent side projects
  • Volunteer work — e.g. maybe making a website for some non-profit
  • Class projects
  • Work you did at your job where you found a way to incorporate programming
  • Technical work you do for a club at school — maybe some club wants a new website, or maybe you can find a club with a technological focus
  • A research project — either an independent one, or research you did as a part of a lab at your school
  • Projects from past jobs or internships

Having a strong portfolio shows employers that can successfully apply programming languages, libraries, and technologies to solve problems and gives them a way to more accurately gauge your skill level. (And, as it turns out, working on non-trivial projects is also one of the better ways to improve your skill level in general!)

To put it another way, you want to establish that you have a track record of successfully building relatively complex things. If you don’t have any prior job history in this field, working on projects is one of the better ways of doing that.

Some additional notes:

  • Your projects don’t necessarily need to be visually flashy. Most recruiters will focus on your resume (and often will read only your resume!), and recruiters with a technical background will understand that not all interesting projects have or need a slick interface. What’s probably more important that you can honestly describe your project on your resume in a way that showcases the complexity of the work you did.

    Perhaps the main exception is if you’re applying to a role that requires some visual flair. For example, if you’re applying to a frontend web designer role, it would help to have projects that show you can make a polished and usable website.

  • Of course, working on projects aren’t the only things you can do. Doing things like getting a degree (preferably in a subject related to computer science) will also definitely help. Just keep in mind that many job applicants will also have a tech-related degree, so just having one might not be sufficient to help you stand out — you’ll also want to take full advantage of any extracurricular opportunities your school has to offer. Good schools will have many potential side projects you can get involved in if you dig a little. Having access to those potential side projects is one of the biggest benefits to paying tuition.
  • Some people also attend bootcamps in part to expedite the process of building a relevant resume/portfolio. Just be sure to do your research before committing to a bootcamp: some are great, and some are outright scams. Before committing to any one bootcamp, try reaching out to alumni of that bootcamp on sites like Linkedin to see how they feel, try checking to see if the bootcamp reports stats on CIRR, try asking people in a variety of different communities (not just reddit)… Also see /r/cscareerquestion’s FAQ section on bootcamps.
  • If your resume is not getting a lot of attention, try posting it for review on /r/cscareerquestions‘ or /r/cscareerquestionsEU‘s weekly resume review thread.
  • If you are not sure if you have a strong resume, try comparing it against ones posted in /r/cscareerquestions’ resume advice threads

Phase 2: Pass the interview

What exactly happens in phase 2 (pass the interview) can vary from region to region. For example, many silicon-valley-esque companies prefer asking data structures and algorithms questions, so if you plan on applying to those types of companies having a strong foundation in that topic is a must. This may not necessarily be the case in other parts of the world or for other kinds of companies.

Some common interview archetypes you may run into include:

  • Giving you a coding challenge of some kind, usually about data structures and algorithms — especially at the entry level. To learn more about what these types of interviews look like and how to prepare for them, consider purchasing or borrowing a copy of “Cracking the Coding Interview”.
  • Asking you questions related to the specific role you’re interviewing for — e.g. frontend web design, security, data science…
  • Asking you to pair program together with your interviewer where you collaboratively build or debug a small program
  • Asking you to complete a take-home challenge of some kind
  • Asking you to try designing the high-level architecture of some larger program
  • Asking you about items you have listed on your resume (sometimes in general, sometimes focusing on a single project in-depth)
  • Just having a discussion about technology in general

Note: this is not an exhaustive list. You should also keep in mind that different employers will look for different things and interviewing practices that are common in one area may be almost completely unheard of in another. So, we strongly recommend you network with developers in your local area and ask them for advice.

Also see /r/cscareerquestions’ wiki — and perhaps /r/cscareerquestionsEU if you’re living in the EU.


Now what do I do?

No longer a beginner:

There comes a time when every programmer grows up, and they face a problem, they are plunged into the real world. In the real world, there is no hand holding or major guidance. Instead, you need to learn how to make your way. If you’ve come this far, you should have a field of interest, may it just be general programming, web development, algorithms, or anything of that sort. Maybe, you want to learn of other, different fields involving programming, or maybe, you just want to know what to do next.

Programming is just a tool

When you started programming, you might have wondered on when you would learn to create the next Reddit, or when you would learn about being able to make those fancy graphics, or how to perform different algorithms. Well, if you consider yourself to no longer be a beginner, then you have programming under your tool-belt. Now you need to learn how to apply it, and how to strengthen in it. Very soon you will be able to do these things, and be learning all about them.

Enhancing your programming skills

Many people face the fear that they are not competent enough while programming. And thus, many want to improve their programming skills. But, at this stage, there is only one way to do that, and this is with practice. There are many sites and locations dedicated to practicing, things like /r/dailyprogrammer, CodeWars, HackerRank, Project Euler, and many others.


Misc

Where can I get real-time help? (e.g. via discord, IRC)

For a list of affiliated communities, see Posting guidelines > Related communities — and in particular, the “Real-time help” section.

Please note that /r/learnprogramming is not officially affiliated with any of the communities listed on that page. The moderation teams of all of the listed communities are distinct and independent from this one.

How do I teach a child to program?

Try checking out /r/ProgrammingForKids and /r/CSEducation. Both subreddits will contain useful resources and suggestions on how to teach others.

You can also try running this query to find past discussions about this question.

Some commonly-recommended resources include:

  • Scratch from MIT, a programming language designed for children between the ages of 8 and 16. This language browser-based and requires no software to be installed.
  • Code.org, a website which collects resources on teaching children to code.
  • teachtogether.tech, a free book targeted for people who have minimal experience teaching CS and want to learn pedagogical best practices.
  • pixelpad.io – PixelPAD was created to bring learners beyond Scratch. Made for learners, PixelPAD’s API’s are purposely designed to only include features that would be conducive to learning the underlying mechanics and code.
  • Reeborg’s World – A browser based learning tool to “bridge the gap” between Scratch and textual programming languages – currently JavaScript and Python are supported. The program can be “clicked together” in a Scratch-like block system and then can be switched to textual languages and vice versa.

How can I contribute to open source projects?

Participate in one of the projects in the /r/learnprogramming github group! This group was created by jfredett with the express purpose of providing projects for new programmers to learn how to contribute to open source by interacting with more experienced programmers as mentors.

The group is still in its infancy but several people are working to get it up and running.

Here are some websites that contain links to projects thare are actively looking for contributors of all levels of experience, and will often link to open bugs or issues that are very approachable for beginners.