Skip to main content

Between Java and Python, which one is better to learn first and why?

Image result for java vs python



Python.
Don’t even think about it to select another language as your first. Why? Well,
  • Python is easy. Trust me on this one. My first major language was C++ and it lead me to contemplating suicide. Here’s a short snipped of C++ code for displaying “Hello world” on the screen -
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "Hello world!" << endl;
  6. return 0;
  7. }
Here’s the same thing in Python
  1. print("Hello world!")
  • Python is dynamically typed. What in the world is that? Okay, so computers are dumb. They aren’t smart enough to know that [math]1[/math] is a number, or specifically, an integer and that “hello” is a word or “string” in computer talk. So because of that some programming languages needed to specify the kind of stuff they were working with. For example if you needed to add two numbers in Java, here’s what you’ll have to do -
  1. class AddNums(){
  2. public static void main(String args[]){
  3. int first = 1;
  4. int second = 2;
  5. int sum = first + second;
  6. System.out.println(sum);
  7. }
  8. }
You see that “int” keyword? That stands for “integer” and that basically just tells the computer, “Hey, I need something to store this number but since you’re too stupid to know that it’s a number I’ve specified it and so you should remember that the variable called “first” can only store integer values and I’ve given it the value of [math]1[/math]. And so on with “second” and “sum””. That’s what’s up with Java. In Python?
  1. first = 1
  2. second = 2
  3. sum = first + second
  4. print(sum)
Do you see how clean that is? Notice the serene absence of semi colons.
  • Python supports all styles of programming. Okay, this might be a little controversial but it still worth mentioning. Broadly, there are two methods (no pun intended) of programming - object oriented and procedural. I’m not going to get into details but, long story short, they’re both great ways of approaching problems but Object Oriented is better suited for large scale projects and will, if done right (a huge deal in itself), be cleaner. Procedural is better for small projects to get things, just, done. For example -
  1. class Hello{
  2. public static void main(String args[]){
  3. System.out.println("Hello world!");
  4. }
  5. }
vs
  1. def main():
  2. print("Hello world!")
  3. main()
  • Now both Python and Java support OOP (object oriented programming) but Java forces it upon you by giving you no other way out. That, for big companies and large scale projects, might be a good thing but for someone who doesn’t even know what a class is can be a big hassle. Python, on the other hand, lets you do your own thing. Again, this might be a bad thing but it’ll all depend on the kind of practices you pick up and follow. Ruby is another language and it is very similar to Python but I don’t like it as much because it’s way more lenient on coders. Python kind of maintains that fine line. But yes, for a beginner, Object Oriented might feel forced if all you need to do is write something to take in two numbers and print their sum but in the long, really long run, it could be a good thing.
  • Python is used almost everywhere. Web development? Check. Penetration testing? Check. Making awesome games? Check. Glue code for projects not native-ly written in Python? Check. Maching Learning? Double check that boy! Scientific research? Check. Academics? Check. Android apps and other scale-able projects…? Java is your thing. Native programming is one place where Python fails.

Comments

Popular posts from this blog

How long would humans survive if the sun disappeared?

Well, we wouldn't die instantly. We already survive every day for 8-16 hours without the sun (depending on the season and location). I'm assuming the intent here is to ask what would happen if the sun were to just suddenly cease to exist entirely. In that case, it would take about 8 minutes for anything to happen to us, since the sun's light and gravity both propagate at that speed. At that point the Earth and moon would just continue on in a straight line, no longer in orbit around the sun. Losing the sun's pull might have some nasty effects on plate tectonics, but I'm not sure about that. The earth would slowly begin to cool. It wouldn't be instantaneous; the atmosphere does a decent job of retaining heat for a time. How long you have here depends on the climate and season where you are. If it's the dead of a snowy winter, temperatures would become nearly unbearable in 24-48 hours. If it's summer, you might have several days. This alone ...

Can a Facebook account be hacked?

Top 15 Ways How Hackers Hack Facebook Accounts #1 Hack Facebook Account Password By Phishing : Phishing is still the most popular attack vector used for hacking Facebook accounts. There are variety methods to carry out phishing attack. In simple phishing attacks, a hacker creates a fake login page which exactly looks like the real Facebook page and then asks the victim to log in. Once the victim logs in through the fake page the, the victims “Email Address” and “Password” is stored into a text file, and the hacker then downloads the text file and gets his hands on the victim’s credentials. How To Avoid Phishing Attacks Never Login your Facebook account on other devices Use Chrome, it identifies the phishing page. Avoid emails that ask you to log in your facebook account #2 Hack Facebook Account Password By Keylogging : Keylogging is the easiest way to hack a Facebook password. Keylogging sometimes can be so dangerous that even a person with good knowledge of computers...

Difference between hacker and cracker?

Hacker: In computing, a hacker is any  skilled  computer expert that uses their technical knowledge to overcome a problem. While " hacker " can refer to any skilled computer programmer, the term has become associated in popular culture with a " security hacker ", someone who, with their technical knowledge, uses  bugs  or  exploits  to break into computer systems. Cracker: A cracker is someone who breaks into someone else's computer system, often on a network;  bypasses  passwords or licenses in computer programs; or in other ways intentionally  breaches  computer security. A cracker can be doing this for profit, maliciously, for some altruistic purpose or cause, or because the challenge is there. Some breaking-and-entering has been done ostensibly to point out weaknesses in a site's security system.