Although Java is one of my favorite languages to dump on, I have been using Java for Exercism.io problems. Not only have I been trying to get some in with Java itself, but other languages like Clojure and CFML depend on have some version of Java installed on your system, either just the runtime environment (JRE) or the whole development kit (JDK). In this post I'll talk about Jabba, my new favorite cli tool for installing and switching Java versions!
0 Comments
Let's talk about unit tests and directory structure. If you're doing it right you're going to be creating at least one test file for every JavaScript file you create so it's a given that there are going to be quite a lot of tests. Where do you put all of these tests? There are basically 2 schools of thought here. In this post I'll explain the two theories and then put forth an argument for why you should be putting unit tests in your src folder.
![]() I'm super excited right now. It's Saturday morning of memorial day weekend right, and yesterday I had an interview with a rapid growing music-related tech company. They have a really awesome office in the Chelsea market area of New York City. Everyone has a huge iMac at their desk along with a Macbook Pro (well you can choose but it seems like 99% of people prefer mac there). Oh by they way, your desk is a standing desk with power controls to adjust it up or down. As an Angular developer you get to use WebStorm (I'm assuming I would, the interviewer used IntelliJ which is basically just a more features / languages version of WebStorm). Tons of free snack, drinks, and a pretty cool espresso machine that I got a chance to use, a cool outdoor terrace, and ping pong tables all made it this seem like a surreal workplace. I even saw a little nook that had a Nintendo 64 set up with Goldeneye in it! But this post isn't about how great it would be to work at this company; it's about how the front-end teams of today and tomorrow can use principles from the Java era to craft seemingly bulletproof code.
This tip works for many languages, and it’s not explicitly stated all the time when starting out. I had already known that you could do this, but kudos to the book “Javascript & JQuery” by Jon Duckett for inspiring me to write a post about it. It’s a very colorful and friendly book that is actually read fun to read which is a huge accomplishment for a book about programming. Anyway, this is a useful little tip to remember when crafting your functions.
Let’s think about the function signature in different (statically typed) languages. Remember, the compile breaks out of the function when return method is called, and nothing after it is run. The function defines a return type, and to a naive programmer looking at the signature it seems that one can only return a single thing. And it’s true- you can only return one thing. But, that thing can be an Object or an Array. This is a really cool, simple method for sketching out what you want your code to do. I came across this flowcharting method from page 23 of the great book “Javascript and JQuery” by Jon Duckett (screenshots below). He describes the motivation for them like this:
“Often scripts will need to perform different tasks in different situation. You can use flowcharts to work out how the task fit together. The flowcharts show the paths between in step.” |
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
March 2023
|