Learning To Program

Online Learning Resources

HEP Software Training curriculum: Introductory software training curriculum that serves HEP newcomers the software skills needed as they enter the field, and in parallel, instill best practices for writing software (Unix shell, Python, C++, …) .

Training in software and computing are essential ingredients for the success of any HEP experiment. As most experiments have similar basic prerequisites (Unix shell, Python, C++, …) we want to join our efforts and create one introductory software training curriculum that serves HEP newcomers the software skills needed as they enter the field, and in parallel, instill best practices for writing software.

The curriculum is comprised of a set of standardized modules, so that students can focus on what is most relevant to them.

Learning Basic Programming: LinkedIn Learning, short courses that cover essential topics

This is a list of several courses on LinkedIn Learning selected by Dr. Holmes as being useful to students new to particle physics, topics covered include basic use of Linux, C++, Python, Git, Vim and Sublime Text 3

edX Computer Science: A free online learning platform for self paced online courses, formatted similar to undergraduate classes

edX is an online education platform with courses covering many topics. They are all similar in format to college classes, with some exceptions, and are free. As with normal college classes, your mileage may vary. All of the classes are self paced, with very few exceptions.

If you are unsure what to pick (there are a lot), CS50x is a good place to start, as it starts from very low level concepts of computer science and programming and moves to high level languages and concepts by the end.

Disclaimer: They may ask if you want to buy a certificate for a class, but this is not necessary to access the classes, although you can put them on your LinkedIn page.

MIT Opencourseware: Archived courses from MIT

MIT Opencourseware is a selection of classes from MIT where the material for the course has been archived and made available for others to study. Some of the classes have video lectures, assignments and solutions for you to follow along with at your own pace.

The lectures are a bit dry for it, but EECS 6.00 is a good place to start.

This takes you to their listing of Electrical Engineering and Computer Science courses that MIT has archived course materials for, but classes from most of their departments are available. If you want a course with recorded lectures, assignments, solutions and exams, look for courses with SC in their course number.

Corey Shafer YouTube Channel: Excellent YouTube channel offering tutorials and walkthroughs for software developers, programmers, and engineers.

Includes topics such as Python, Git, Development Environments, Terminal Commands, SQL, Programming Terms, JavaScript, Computer Science Fundamentals,

Greg Wooledge's BashGuide & Bash-Hackers Wiki: Objectively the only two acceptable guides for bash scripting

This reddit comment sums it up adequately:

http://mywiki.wooledge.org/

this is the most complete and the most pedantically correct resource on bash programming on the internet. everytime you have a problem the answer is already in this wiki. if you are starting to learn bash scripting you will often don't even realize that you have a problem until you read about it in this wiki.

start here: http://mywiki.wooledge.org/BashGuide/Practices

then read the rest of the guide: http://mywiki.wooledge.org/BashGuide

then start playing around. write some scripts. get some experience.

then read the faq and the pitfalls:

https://mywiki.wooledge.org/BashFAQ

https://mywiki.wooledge.org/BashPitfalls

the wooledge wiki is still good even if you are aiming to learn sh instead of bash because many of the aspects covered here is also valid for sh.

here is another bash wiki

http://wiki.bash-hackers.org/start

this is like a light version of the wooledge wiki. often easier to understand but not as pedantically correct. also not as complete. still easier to read than the official manual

it also has a list of tutorials with short comments about how good they are.

http://wiki.bash-hackers.org/scripting/tutoriallist

if you feel like you start to know the terms of bash scripting and you begin to understand the intricacies then you can also consult the fine bash manual

the official manual: https://www.gnu.org/software/bash/manual/html_node/index.html

the manual is very complete. it covers practically everything around the bash shell and the scripting language. but it is often very terse.

my rule of thumb is: if i just want to look up how something works then i check the bash-hackers wiki. or i just google around and find a (closed as duplicate) answer on stack overflow. but if i really want to understand why it does something like that then i search in the wooledge wiki or in the manual.

you should also learn a bit sed and awk because you will encounter them sooner or later. here are some tutorials:

http://www.grymoire.com/Unix/sed.html

http://www.grymoire.com/Unix/Awk.html

bonus: bash scripting best practices

http://fahdshariff.blogspot.com/2013/10/shell-scripting-best-practices.html

http://www.pixelbeat.org/programming/shell_script_mistakes.html

http://redsymbol.net/articles/unofficial-bash-strict-mode/

https://www.davidpashley.com/articles/writing-robust-shell-scripts/

note that many people recommend to use set -e or errexit. i do not agree with that. read here for explanation https://mywiki.wooledge.org/BashFAQ/105

also note that bash is not a programming language. it is a "glue language". you should use it to glue other tools together. take output from one tool. filter using sed or awk. then, depending on some conditions, put it in next tool or print error message.

a common mistake is to write bash functions like python or java functions: input in arguments and result in return value. instead you should write bash functions like grep: input in stdin and result in stdout. the only thing a bash function should return is 0 for success and any other number for error.

my rule of thumb is: if you start to need arithmetic then it is time to use a real programming language.


Real Python: At Real Python you can learn all things Python from the ground up.

Real Python is one of the best resources for learning python. The Python Learning Paths is linked since it categorizes the content. Note that anything labelled a "tutorial" is free and should be accessible in its entirety. However, anything marked "course" will be paid content (typically they video courses and generally the first few videos are accessible for free).

Other Helpful Resources

Xsede Workshops: hosted monthly by NSF funded computational collaboration

Extreme Science and Engineering Discovery Environment is an NSF funded group of computing clusters that operate across the US. They hold a monthly workshop on programming for High Performance Computing, Big Data, and sometimes more field specific material. They are typically geared for people who are new to computing.

CMS Code Style Guide: A must read if you plan to submit code to a CMS repo

CMS has a style guide that should be used for all software. Projects under CMS may have additional requirements that need to be met before submitting code for pull requests.