Comment on: Java or Python
Glad you liked it! I'm afraid I was a little late to the party, but I'm glad some people still read it.
Comment on: Java or Python
Yeah, I guess I could've phrased that better. I was trying to refer more to the way that Java loads each object's parent classes and so on into memory at runtime. Of course that isn't the same as type safety, but oh well, I'll fix that in my parent comment. Also, now that I think of it a little bit more, a good chunk of Java's overhead comes from it being a garbage collected language, though Python is garbage collected too, so that point is moot.
Incorrect use of terms aside, I still stand by my claim that Java is much faster than Python. Of course Java will always be slower than C/C++ because of the JVM overhead, but based on almost every benchmark I've seen*, Java tends to be much faster than most scripting languages.
* Here is one such example: http://benchmarksgame.alioth.debian.org/u64q/python.html. Of course, a few simple benchmarks are hardly indicative of real world performance, but you get the general idea.
Comment on: Java or Python
Sorry I'm a bit late to the party, but here's my two cents:
If I were you, I would learn both eventually. That being said, while there's a good chance you'll want to use both at some point, each language has a very different use case.
Python is an awesome scripting language. It focuses on forcing you to write concise, very easy to read code. Python programs are some of the easiest there are to understand. It is a dynamic (but fairly strongly) typed language, meaning you can assign a number to a variable, and then overwrite that variable with something else of a different type, but it will not implicitly convert one type to another. ("1" + 1 will throw a type error, for example.) Basically, it's flexible but not too flexible, easy to read and learn, and has excellent documentation. Throw in its awesome standard library that lets you use it in almost any context, and you have an excellent language for shorter side projects and one-off scripts.
Java, on the other hand, is a much more heavy duty language. Java is a very verbose, strict, statically typed language. A good example of this is that when you declare a variable, you have to explicitly declare what type that variable will hold. If you ever try to assign anything to that variable that is another type, an error will be thrown. Now, this adds a lot of extra overhead from a new programmer's perspective, because you will write a lot more code for new, smaller projects than you would for something written in Python. (or just about any scripting language.) On the other hand, when working on a larger project, this behavior is invaluable, as the compiler can catch a lot of hidden bugs or mistakes you might make when changing the code that a scripting language couldn't catch. Also, Java is very much bound to Object Oriented Programming (OOP). If you haven't learned much about it yet, Java will take more effort to learn than something like Python, but you will learn a lot more, and OOP is another nice thing that helps to keep larger codebases maintainable irrespective of the language itself.
To sum things up:
Python:
- Easier to learn/read
- Can be used for many different tasks
- Dynamically typed
- Ideal for smaller projects
Java
- More to learn (but OOP is a very valuable paradigm you should learn)
- Type-related bugs are very easy to identify
- Statically typed
- Ideal for larger projects
As I said, I think you should learn both at some point, but which one you learn first depends on what you currently know. What languages have you used so far, and for what?
Comment on: Java or Python
Java might be slow compared to C, but it's still considerably faster than Python. You might be right about resource consumption, Java will flat out eat a good chunk of your memory, but that doesn't mean it's slower by any means. Also, a lot of that memory usage comes from type safety that is very helpful for large server side applications.
EDIT: Ignore that last sentence, the type safety from java comes from it's compile-time checks, not anything it does during runtime.
Comment on: I found a magic number in Voat's source code
Because an enum defines a very specific set of options. Let's say I am writing a program involving colors. To represent colors, I could just use a String containing a word, like "red" or "blue". The problem here is, what if I make a typo and write "redasdf" or "bllue" somewhere? If I'm trying to compare colors of two different objects or anything like that, it could lead to some nasty bugs.
Alternatively, if I define an enum called Colors somewhere, I can have a finite list of colors I can use, and I could assign values like Colors.RED and Colors.BLUE as a property to objects. So long as I'm sticking to my predefined enums, any typos I make will be caught at compile-time, since I certainly didn't define Colors.REDasdf or Colors.BLLUE.
Comment on: the big list of programming and computing subverses
I'll add a plug for /v/VoatBugHunters, a sub dedicated to tracking down and fixing known issues with the voat source code. We're in the process of putting together a wiki guide for the source to help make it more digestible, once we do we hope to be far more active.
Comment on: Where should I migrate my projects to (from Github)?
Well the backlash in that thread is ridiculous, but I think it's worth pointing out that the "bug" was closed almost immediately. Everything else was pure bullshit, but that's all it was.
EDIT: After reading more into that issue... fuck that, that was awful. I see why you're preemptively leaving now.
Comment on: How to Write a Git Commit Message
Well, that's if you want a detailed account of the changes you're making, but that doesn't tell you why it was changed in the first place.
Comment on: Is it worth spending the time to learn Emacs today?
I though canonical scrapped Wubi after 12.10?
Comment on: What keeps developers happy?
yep, new users are limited to 10 upvotes per 24 hours I believe until you reach a certain number of comment contribution points. Not sure what that threshold is, but it should be pretty low.
Comment on: Does Voat not unit test or is it just not included in the GitHub repo?
Also, I find unit tests very useful for learning about the system I'm working with when I'm first coming onto a project. It's still tedious, but not as much so because I'm learning about how everything fits together as I write my test. Once I'm done I feel a lot more confident about modifying other parts of the codebase and working on bigger tasks.
Comment on: Does Voat not unit test or is it just not included in the GitHub repo?
Oh certainly, I don't think unit tests belong everywhere. I mainly see them as useful for logic-heavy business rules that you know are going to be used for years to come. I can't really comment on TDD, I haven't done much of that either.
Comment on: Does Voat not unit test or is it just not included in the GitHub repo?
"Oh, well, good unit tests don't do that", and then these good unit tests never exist
But they very much do exist. It takes a fair amount of forethought - you have to design your system ahead of time to be modular and think about these things as you go, but good, non-brittle unit tests absolutely exist. If you're having to mock everything every time you write a unit test, that's probably a sign your code could use some refactoring.
Comment on: Does Voat not unit test or is it just not included in the GitHub repo?
While in certain applications I might agree with you, for a full-featured website like voat I just have to disagree with you. Unit tests can be annoying to write, and their benefit might not be super apparent at first, but in the long run, well written tests are very very valuable IMO.
Comment on: Why this sub sucked on Reddit and how to make it not suck here
I feel like maybe we'd need to split text posts off into the equivalent of /r/programmerchat eventually, but for now I definitely agree with you, especially since we get far less traffic here.
Python supports OOP, but it's not tied into it in the same way that Java is. You can write an OOP program in Python, but you can also write off a quick script without ever writing a single class. OOP is absolutely mandatory in Java, it is literally impossible to write a java program without writing at least 1 class.
Or in other words...
“Ah you think OOP is Python's ally? Python merely adopted Object Oriented Programming. Java was born in it, molded by it.”