Author Topic: Feeling the need to learn a new language  (Read 3177 times)

0 Members and 1 Guest are viewing this topic.

Offline Cue Zephyr

  • All Time Legend
  • *******
  • Posts: 6977
  • Good Vibes 90
  • Who's picking the banjo here?
    • Ezyo Music
Feeling the need to learn a new language
« on: March 03, 2015, 11:47:51 pm »
Howdy folks,

As an ICT & Media Design student, the only programming languages I've learned are JavaScript and PHP (with limited MySQL). For a non-media design project (we call it Lifestyle), I had to write a simple program that didn't do much more than run some exe files, convert an image, read and parse an XML and send it over a serial connection. I thought it would be smart to run everything in C++, because the libraries we were using all were in C++. However, I didn't know at all where to start to build even the simplest bit of code in this language. So I looked into Python. I wrote a procedural script that did all the things necessary.

I plan to purchase a Raspberry Pi 2B at some point, and I gather that all the popular general-purpose languages (Python, Java, C, C++ and Ruby) are supported by it. I also gather that Python is used extensively by Google and that Java is very much in-demand right now.

I've had a brief introduction (about a semester long) to C# and understand (and much appreciate) the concept of object-oriented programming. As of two days ago, I switched from writing my PHP scripts mostly procedurally, to almost exclusively object-oriented. I exploited the dynamic nature of PHP ont he way, by storing parameter or method names in other parameters to access different data or endpoints with the same function.

I suppose it doesn't matter all that much which one I choose, since the concept of (object-oriented) programming remains the same. The only thing that remains is the syntax, which I suppose is wildly diffeent for Ruby, but less so for the others. I do think it's best to learn just one at a time, seeing how much I mixed up my syntax going from Python back to PHP.

Let me know what your experiences are and what you recommend I'd have a look at.

CZ
Guitar, banjo, mandolin and piano, bass and percussion only when needed
Production and mixing

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #1 on: March 04, 2015, 12:06:06 am »
My view is that you don't really fully appreciate Object Oriented programming until you've used a language like Java which enforces it. In my experience most of the training material on OO is flawed because it gives contrived and limited examples which don't fully explain where and how OO should be used. OO isn't a panacea, and it's very easy to design poor code which uses OO unless you have some idea of the practical benefits, pitfalls, etc.

Although you have used C# which I have been told is partly a clone of Java, so you may have already developed those skills.

If you *really* want to learn OO, I strongly suggest looking into Design Patterns, and I especially recommend the Head First Design Patterns book.

One of the problems with Java is, a bit like .NET, it's not just a language; it's an entire framework. As such there's a tonne of adjunct information that accompanies it and it can be a bit overwhelming. To use it properly you really need an IDE such as Eclipse, Netbeans, or Android Studio (all free of charge to download), and whilst they will make your life easier in the long run, there's an additional learning curve in setting up and using those tools. But if you are familiar with C# and Visual Studio, that may be fine for you.

The advantage, of course, for Java is that it is the primary language used for software development on Android.

Otherwise, Python is the go-to language to learn at the moment and is a lot lighter weight and easier to get into than Java. You pretty much just need a decent text editor.

A lot depends on what you are looking to write code for. Java (like C#) tends to be more powerful and is often used for large enterprise server/database apps and it is clearly more useful for mobile development, but it's complete overkill for smaller applications and scripting. It's also not generally a good choice for desktop apps.

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

Offline Cue Zephyr

  • All Time Legend
  • *******
  • Posts: 6977
  • Good Vibes 90
  • Who's picking the banjo here?
    • Ezyo Music
Re: Feeling the need to learn a new language
« Reply #2 on: March 05, 2015, 09:27:36 am »
PHP is a web-oriented language, and I'd like to have a general-purpose language to fall back on. I guess Python might be the most logical choice in that regard. However, I'm interested in Java or C/C++/C# because they are widely used/very popular and most languages are even based on C more or less.

I don't necessarily need OO, but I like its concept so much that I prefer it over procedural. Then again, a multi-paraidgm language would be best (as are Python, Ruby and PHP, among others).

So basically what I'm saying is, if I wanted to learn a useful and general-purpose programming language, which one(s) should I look into?

Currently, uses would be rather limited. Right now I'm interested in using a Pi to do small projects with user input (images, audio or something else).

But if I can pick up on a useful language on the way, I think I should go for it.
Guitar, banjo, mandolin and piano, bass and percussion only when needed
Production and mixing

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #3 on: March 05, 2015, 09:39:26 am »
For general Pi stuff I would go with Python. I would suggest it's your fastest route to getting projects up and running on that platform.

If you want to consolidate your OO knowledge, or think you might do Android dev in the future, Java

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

Offline pt3r

  • Concert Hall Hasbeen
  • ****
  • Posts: 426
  • Good Vibes 8
Re: Feeling the need to learn a new language
« Reply #4 on: March 05, 2015, 10:45:18 am »
Python is definitely a good idea. Portable, structured and a plethora of libraries.
You gotta put a lot o' time in that thing. (Buddy Guy)

Offline shadowscott007

  • Stadium Superstar
  • ******
  • Posts: 3482
  • Good Vibes 118
Re: Feeling the need to learn a new language
« Reply #5 on: March 05, 2015, 05:21:47 pm »
Assembly for the win!
The early bird gets the worm, but the second mouse gets the cheese.

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #6 on: March 05, 2015, 06:07:47 pm »
I did quite a bit of assembly language on the first generation of ARM processors (the Raspberry PI uses an ARM 700 or Cortex-A7 for gen 2). It's actually a very interesting and powerful instruction set based on a RISC architecture.

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

Offline Cue Zephyr

  • All Time Legend
  • *******
  • Posts: 6977
  • Good Vibes 90
  • Who's picking the banjo here?
    • Ezyo Music
Re: Feeling the need to learn a new language
« Reply #7 on: March 05, 2015, 07:01:00 pm »
It won't be for the Pi exclusively. It's more like it's the first use I'd have for it before I can think of anything else. I most likely won't do any Android development. But if it's (Java) that powerful, I might still consider it an option.

Also, Minecraft runs on Java. ;D

I did look into some Assembly, but that stuff is so far from what I'm familiar with, I doubt I'll ever get my head 'round it. :P
Guitar, banjo, mandolin and piano, bass and percussion only when needed
Production and mixing

Offline pt3r

  • Concert Hall Hasbeen
  • ****
  • Posts: 426
  • Good Vibes 8
Re: Feeling the need to learn a new language
« Reply #8 on: March 05, 2015, 09:04:55 pm »
Java is resource hungry, really raw power is only obtained through assembly or c(++) but those are not of the faint of heart  ;D
You gotta put a lot o' time in that thing. (Buddy Guy)

Offline shadowscott007

  • Stadium Superstar
  • ******
  • Posts: 3482
  • Good Vibes 118
Re: Feeling the need to learn a new language
« Reply #9 on: March 05, 2015, 09:07:55 pm »
I work designing embedded controls, so assembly is a (dying) way of life.  Which I think is sad.  I do mostly hardware design rather than coding.  I like assembly in a "fun is for babies" kinda way.

Shadow
The early bird gets the worm, but the second mouse gets the cheese.

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #10 on: March 05, 2015, 10:04:16 pm »
But if it's (Java) that powerful, I might still consider it an option.

Java is "powerful" (not sure if that's the appropriate term) largely because it's used for so many things and, therefore, is well supported in them.

Arguably, with modern languages, you can write any app in any language. Some languages suit this better than others. PERL, for instance, is quite an old language and still has it's place, but I have seen complex web-based content management systems written in it which, in my view, is the wrong thing to use it for.

Python, for instance, has grown to have a huge variety of support libraries and is a fantastic general-purpose language.

But when it comes to ubiquity, Java is hard to beat. There are libraries (and often alternative, competing frameworks) for just about every sort of project you can think of. Often the hardest thing about Java is choosing which one to use.

Java also stands out as having superb development tools including IDEs, round-trip engineering systems, structured documentation, testing, code coverage, and project management and build tools. This makes it one of the platforms of choice for large, complex projects as it makes it easier to manage distributed development.

The fact that it doesn't support procedural programming also forces you to think in OO, where other languages such as Python and C++ allow you to slip a bit of procedural stuff in there. You could consider this more flexible, but it can lead to laziness: often it's easier to tack on a bit of procedural stuff than to think about new class structures, design patterns and so on. Java doesn't let you do that. Java enforces OO. In general "proper" OO is better for software reuse and for maintenance, which is another reason it's popular for Enterprise development.

Although Java has a reputation for being slow, it's not always the case as many of the support libraries have been highly optimised. For instance: I once wrote a proof-of-concept Inventory system integration adapter in Java for a large national telco. It had to interface the main database over a message bus, pull in and parse hundreds of thousands of large and complex XML files, and write them to another system.

They had various prior implementations of this running on servers across the company, at least 2 of which were developed in C. The Java version I knocked up and ran on my crappy Dell laptop outperformed them all, not because of my skill at coding, but because the libraries I used were so highly optimised.

But Java isn't without its issues. Some of the Enterprise "EJB" stuff can be horrendously complex and over-engineered (although they have improved it a lot in the last few years) and some of the legacy libraries (like the date and time handling) are annoyingly broken. Also Java isn't suited for "lightweight" projects.

The Java landscape is vast, there are even sub-languages like Beanshell, Groovy, and JSP Expression Language.


If you do decide to go the Java route...

One of the biggest problems with any language is dependency management. OO languages tend to be better at this than procedural ones, but it is still a problem and dependencies can make it more difficult to maintain and to evolve complex applications. Most of the OO Design Patterns I mentioned before are there to minimise unnecessary dependencies. Get the Head First Design Patterns book I mentioned before. It changed the way I thought about programming and it might do the same for you.

A related (and complementary) approach is via something called "dependency injection". The leading system for this in the Java world is Spring Framework. This is a set of Java libraries which provide Inversion of Control, Aspect-Oriented Programming and other key capabilities.

The question is, how far down the rabbit hole do you want to go..?

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

Offline Scooter Trash

  • Stadium Superstar
  • ******
  • Posts: 3041
  • Good Vibes 80
Re: Feeling the need to learn a new language
« Reply #11 on: March 05, 2015, 10:06:34 pm »
I don't know much about programming, but my Brother has done it for a living for 30 years. He mostly uses C, C++ and Java but recently mentioned having an interest in using Pearl/CGI I don't know if that would be anything that would interest you?
I dream of a better tomorrow where chickens can cross roads without their motives being questioned.

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #12 on: March 05, 2015, 10:15:07 pm »
I don't know much about programming, but my Brother has done it for a living for 30 years. He mostly uses C, C++ and Java but recently mentioned having an interest in using Pearl/CGI I don't know if that would be anything that would interest you?

1998 is calling and wants their systems back.

CGI is largely considered a legacy. It's still used only because it was one of the first ways to create dynamic web content. It has pretty much been superseded by PHP and other web languages which have a much better integration into web servers.

Some people still cling to it, but I would consider it a backward step.

PERL is great as a scripting language, but not as a web language... not in the last decade.

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

Offline Scooter Trash

  • Stadium Superstar
  • ******
  • Posts: 3041
  • Good Vibes 80
Re: Feeling the need to learn a new language
« Reply #13 on: March 05, 2015, 10:19:34 pm »
OK, LOL.. He did also mention PHP. He just finished a big Java project and he's tired of Java.
I dream of a better tomorrow where chickens can cross roads without their motives being questioned.

Offline Majik

  • Stadium Superstar
  • ******
  • Posts: 1956
  • Good Vibes 110
Re: Feeling the need to learn a new language
« Reply #14 on: March 05, 2015, 10:27:44 pm »
By the way, as a bit of trivia, PERL stands for either "Practical Extraction and Report Language" or "Pathetically Eclectic Rubbish Lister". Both definitions from Larry Wall, the original creator of the language.

Cheers,

Keith
Guitars: PRS Singlecut S2, Fender Tele Lite Ash, G&L Legacy Tribute, Freshman Apollo 2 OCBX
Amps: Bugera G5 Head, Boss Katana 100
All sorts of other stuff.

 

Get The Forum As A Mobile App