This is a story of how I learned Python and Java at the same time, and while doing that, learned a few things about myself in the process.
When I started my current job I'd primarily been a frontend developer. I'd used some PHP in college and dabbled a bit in C#--and I could write a mean SQL query--but that was it. At my current company, we have mostly Java and PHP on the backend. While I still mainly work on our React frontend, I coded in PHP right when I started and then, gradually, began coding in Java.
It started like this: an endpoint wasn't giving me what I wanted. I could wait for someone else to fix it, or I could just take a look in the code and see... yup. There was the part that needed fixing. It wasn't long before I'd created my first Java Pull Request.
In the group, we're going through Learn Python the Hard Way by Zed Shaw. I picked that book up and started going through it.
Then I needed to pick a 6-month goal. I thought about Python, but I knew Java would be more relevant. I could fix things here and there but I didn't have a solid grasp of the language basics. I asked a coworker for a book recommendation and he suggested Head First Java by Kathy Sierra and Bert Bates. I made it a 6-month goal to go through the first six chapters.
I have no idea.
Currently I've finished the first six chapters of the Java book and the Python book only has a few chapters left. (The chapters in the Java book are incredibly long, while the chapters in the Python book are just a few pages.)
I also know a lot about my learning style and what I like, and don't like, in a programming language.
I learned that I like short, bite-sized chapters better than long ones with a lot of information. I learned that I prefer writing little programs to doing elementary-school-like exercises.
Learn Python the Hard Way and Head First Java are two very different books. Head First Java has long chapters that attempt to teach concepts in different ways for different learning styles. My favorite was the bullied list summaries at the end. I found the chapter length overwhelming (I couldn't read a whole chapter and do the exercises all in one sitting) and most of the exercises seemed pointless. Instead of actually writing Java they have you pull together snippets to create programs, do crosswords, and even matching.
Learn Python the Hard Way has one bite-sized concept per chapter and the chapters are usually 2-3 pages long. I could usually get through them in less than an hour, which was perfect for doing them during my lunch break on Python Learning Group meeting days.
The best part, though, was that I was actually writing and running little Python programs, not doing crosswords. Zed has you type out a lot of code from the book, which seems silly but it helped me get used to the syntax. Then Zed has you make changes to the code, break things, make sure you understand what every line is doing, and add your own stuff. At the end, you're building your own text adventure game and learning new concepts as you add onto it.
The tone of Learn Python the Hard Way is much harsher than Head First Java and Zed Shaw can be quite opinionated about things. (I'll admit, we make fun of him in the Python Learning Group sometimes.) It's not enough, though, to turn me away from the book, even when Zed suggests you memorize a list of things and you decide, no, you're not going to do that.
I'm sold on this supposed "hard way." I think there's a second Python the Hard Way book and I'll likely pick that one up. I'm not sure if the group is going to want to do it, but we might need a break first. If I never need to learn another language, I'll probably look for a Hard Way book. There is a Learn Java the Hard Way book. It's by a different author but uses short exercise-based chapters, so I might pick it up.
I like Python more than Java.
You know what I still get errors about though? Types in Java. Less so in practice code than in the actual Java repo we have at work. I understand the reason for strongly typed languages. I've used TypeScript. I worked with a bunch of C# devs for four years. I always use PropTypes in my React components. I get it. But I don't like being forced to use types. I particularly don't like having to decide which number type I want to use. I know that in Java you're concerned about memory allocation and you want to pick the type that uses the least amount of memory possible. I don't want to worry that much about memory allocation, though.* I don't find that fun. Just like I don't enjoy dealing with inventory management in a video game.
Another thing I don't like about Java is all the recompiling. I remember once I kept making changes in our Java codebase and they weren't working. I told it to
System.out.print things and nothing printed. Then someone reminded me that I had to stop and restart the application. BLECK. I think I'll write something to automate that so when I save a change it auto-restarts for me. I'll see if I can write it in Python.
One language at a time is probably the better way to go. I wouldn't recommend it. It did provide the surprise benefit of being able to compare the languages as I learned. I want to give the Java book some credit--it did a better job of explaining some concepts such as Object Oriented design and programming. It was interesting to see how the different languages tackled things such as inheritance.
Other than finishing the Python book, I'm planning on continuing to practice the language with side projects. I'm coding in Java regularly and hopefully I'll find some resources that suit me a little better.
*I realize this is so much more complicated than I'm making it out to be here. This is not a post about how different languages handle memory allocation. This is just a gut-level dislike I have towards writing Java.
Cover image by Christopher Gower on Unsplash.
Danger Noodle mug image is a mug you can actually buy! I failed to find the python-drinking-coffee image I really wanted to use for this post.