Every now and then I have contact with a few programming languages and this is the subset that I believe it would give me a very close insight to the sum of the all languages that I’ve had contact with. Also, this subset is not only based on the choice of ideas that each language aggregate, but also on their usefulness and importance for the general programmer’s toolbox.
Just about the most awesome way to describe and manipulate words from regular languages. No matter if it’s used as communication purposes within some specification or if it’s used to crawl certain patterns within a large collection of texts. It’s useful even within the programming environment itself. And to contribute to its awesomeness, it’s one of the easiest and fastest things to learn. It’s useful even for non-programmers (think about that time when you want to rename all files from a folder to have better consistency).
You can visualize regex patterns using Regexper or any of its competitors.
Started as a simple tool to pretify common syntax used in text-based email. But now just about almost every major site visited by programmers (e.g. StackOverflow, Reddit, GitHub, Doxygen-generated ones) has some support for MarkDown. Or its recent attempt for a smart standardization to spread good common practices and inspire better interoperability among supporting tools.
You can think of MarkDown as a simple way to describe which parts of the text will be bold or will be the tittle for a subsection and so on. MarkDown is simple! MarkDown is simple enough to be accepted in non-programmer targeted products like blogging platforms (even WordPress) or discussion platforms.
A language that appeared in 1972 that is still interesting and it’s still important. Being the “portable Assembly”, operating system’s kernels are still written in C. Pieces of software dealing with low-level are still written in C. Embedded projects are still written in C.
C is not a popular language out of merits. C is just the right abstraction to forget about Assembly, but still have no overhead between your software and the machine. Compilers will do a fantastic job in no time for you.
C is an easy language to learn, adding just a few handful abstractions like subroutines and structures to learn. Of course, C is very low-level and you’re expected to face manual memory management (and memory leaks), bit by bit serialization, pointer to functions (no closures here), architecture and operating system differences and maybe things like varargs, setjmp and mmap. You should be able to understand the implications on performance some decision has. This insight is something C has been a great language at and will hardly be acquired learning another language.
Haskell is one of the languages I learnt this year. It’s a typed purely functional language. It’s a great language. It has great concepts to decrease the total number of lines of code you should write (like list comprehensions and pattern matching), a clever syntax and some great concepts you could learn (higher-order functions, currying, lazy evaluation…).
Not all about Haskell was new to me, as I had already learn functional programming through Scheme some years ago, but Haskell does a much better job. I hate Lisp naming conventions (car for the head of the list, seriously) and excessive number of parentheses. You shouldn’t have to follow my path. You should be introduced to functional programming with Haskell.
Also, look at how elegant this QuickSort is:
Ruby is another of these languages I learnt this year. It’s a purely object-oriented language. Some cleverness was invested around its syntax and I very much appreciate this. It’s a very dynamic language where every class is open and even things like attr_reader are methods.
Object-oriented programming is one of these must-have skills for a programmer and I think Ruby, being purely object-oriented, is a great language to learn this paradigm. Hide and encapsulate!
I choose to learn Ruby looking for a scripting language to empower a possible game engine that I might code. Ruby really impressed me. Ruby is so dynamic that even if I design a wrong class hierarchy or something, Ruby probably has a way to fix it. I don’t intend to design bad hierarchies, but I don’t know who will use my possible future game engine and this concern then becomes undeniably important.
Responsible for most of the web traffic, this is a pretty important and simple language to understand how web documents are structured. If you think I’m overestimating web, it’s because it’s one of the greatest things we have. But XML is not only about web, it’s about interoperable documents and protocols and it is used as such. You can find XML in use within vector formats, formats for office applications and even chat protocols. I think learning the basics of XML is a big deal.
I personally think that the LaTeX tools aren’t among the most polished tools. Just look at the Makefile generated by Doxygen to see the run-until-no-more-differences-found loop to work around inconveniences in the LaTeX tools. Or just look at the terrible error messages. Also, the syntax isn’t surprisingly pleasant.
But when you want to focus on the content, forget about the accumulated little formatting details and produce beautiful scientific papers, a book with consistently in-between linked references or even just a few math formulas, LaTeX is probably what you should, at least, consider.
Capable to automate the most surprising tasks in a computer, if you are using an Unix variant system. You could automate builds, customize software startup sequences and manage your system. But if you’re using an Unix variant system, you already may be aware of that.
No Java, C++ or Python in this list. Maybe I’ll do a part 2 of this article containing languages with a lesser chance to be used like SQL, MongoDB, OpenGL, R, GStreamer or some Assembly. Actually, I think Java, C++ and Python have a better chance to be used than Haskell, but if you learn every language in this list, C++, Java and Python will be easy to catch up and the lines of code you write will be more elegant.
Somebody on IRC convinced me to try ZSH, then maybe this is the last chance to document my bash tricks. So here it goes:
Sometimes you want to reuse the last argument of the last command and there is a shell variable that holds exactly this. Be careful to quote it to avoid issuing multiple arguments instead of one. You can argue that it’s easier to navigate through the history of commands, but if you use something like HISTCONTROL=’ignorespace’, the history is not always available. I’ll use the history of commands and some handful Emacs hotkeys most of the time too.
It’s not unusual to issue arguments that have common parts and brace expansion is here to help us.
If you’re unsure about the effects of the expression, just put “echo ” in front of everything and you’ll have a “preview” of what the command would do.
This trick saved me from sooo much typing.
It combines history navigation and data filtering. Simple and fast.
My system’s locale is not english and this wouldn’t mean too much, but when the time to communicate with other people comes, I need a fast way to reproduce the problem using the developer’s standard language. Want to report a bug? Use the original error messages. Want to know why you are getting a warning? Search engines will help less using localized messages.
$(), “$()” and ` `
Use the output of a command as argument (or arguments) for another command. I don’t use this trick on my day-to-day use of bash, but it’ll be probably used when the time to write scripts come.
pipes, pipes, pipes everywhere
It’s the Unix way. One command that only does one thing it does it well.
It is useful in so many ways:
- Process the input set (eg. how many tests does project X implement).
- Filter a large data set (eg. which mount points are read-only?).
- Interactively filter a data set (eg. which files have missing copyright notices?).
- Add a nice pager to the output of a process.
- Follow the output of a command and log it at the same time (eg. tee).
sleep 8h && ponymix set-volume 100% && while true; do mplayer Música/Disturbing_music.ogg; sleep 5; done
This is my alarm clock. The behaviour of my smartphone’s alarm clock is pure shit.
If you hit Ctrl+C, sleep will return false, breaking the control flow and aborting the alarm.
The music won’t stop until somebody unlock the screenlock, access the terminal and hit Ctrl+C. The audio hardware is loud enough and eventually I’ll wake up.
And my top 7 commands
- sudo: Run commands as root (it does more tricks than su).
- yaourt: Wrapper around pacman that can search for packages on AUR.
- git: I type git a lot.
- nano: A simple text editor. It’ll open fast and close in no time. Useful for simple editing tasks.
- cd: I type cd a lot.
- ls: I also type ls a lot.
- ssh/scp: This is the tool you’ll use when you have more than one machine/system under your command.
The above list was created from the history stored on my netbook, but I’m sure grep would be in this list if I have used the history stored on my desktop pc.