Author Topic: Which programming language?  (Read 21566 times)

0 Members and 1 Guest are viewing this topic.

Offline GrumpyDaveTopic starter

  • Contributor
  • Posts: 24
Which programming language?
« on: June 13, 2011, 01:08:22 pm »
Hi all

Not exactly a microcontroller question but it is sort of related..

For university I have used both Assembly and C18 to program PIC microcontrollers and also some VHDL for cpld.

Currently none of the projects I have worked on involved interfacing with a PC so this summer to better prepare myself for further projects I would like to learn a bit more regarding controlling/communicating with a PC.

My ultimate aim is to be able to cobble together some PC software with gui that can send commands to or recieve
data from the microcontroller via either rs232 or usb.

Obviously I need to learn a PC language but there are so many to choose from!
So I'm hoping some of you more experienced engineers can give me some advice on which to pick. I imediately thought C as thats what I use for the PIC but it seems its rarely mentioned as a language to learn for programming window gui type applications.
I have read that C++ can be difficult and that C# or Java may be easier.

Which languages do you use and what language would you say is good to learn to compliment microcontrollers on the PC?

 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10193
  • Country: nz
Re: Which programming language?
« Reply #1 on: June 13, 2011, 01:27:13 pm »
For PC programming the choice isnt so much what language to use, it's what development environment to pick.

I still use Delphi, and despite what some people say, it's still alive and kicking.
The same company also make "C++ builder", which is identical to Delphi but you program in C instead of pascal.

I just love the speed at which ya can get something done using delphi/c++builder.

However, ive not used the competing products, such as Microsoft visual studio for ages, so i cant really say which is best overall or for specific tasks.

With regard to building gui apps to talk to microcontollers, most of the time this is just serial port comms, be it true rs232 or a usb-rs232 bridge doesn't really matter. From the apps point of view its just a com port. Any language worth anything will allow com port access. With delphi at least, you just pick/install one of the many available com port components, slap it on your form and start coding something to interpret the stream of data for display or resending. The component takes care of all the windows API calls to open the port and presents you with a nice interface to set baud rates etc.. and receive or send data.
« Last Edit: June 13, 2011, 01:43:32 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Which programming language?
« Reply #2 on: June 13, 2011, 01:43:59 pm »
I'm a big fan of Python, as it is very fast to implement code in, and has vast libraries for doing different things.  GUI is a little harder than Delphi or MS Visual Studio or the like.  

What you get is cross platform for free, if you use a supported library.  That may or may not be useful, depending on application.

Best bet is probably free version of Visual Studio and C#.NET.  That seems to be the norm for windows any more.
« Last Edit: June 13, 2011, 02:00:31 pm by sacherjj »
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11705
  • Country: my
  • reassessing directives...
Re: Which programming language?
« Reply #3 on: June 13, 2011, 01:51:17 pm »
during my early age, i've tried all delphi/C++builder/msvstudio. in the end i stick to ms visual studio. thats personal preference, i dont say delphi & borland c++ builder are bad, indeed c++ builder combine the power of gui easiness and c language efficiency. but nothing beat visual basic in term of rapid gui environment, and i dont have to type the nonsense ; and : in every line and declaration. but with drawback that basic is among the most nonefficient languange, no worry, cpu power doubled every year. and whenever i need the speed, i'll couple it with ms visual C++, usually for dll making only. gui with ms vc++? mfc? a big SUX! i cannot get in my head. i'm a classic style programmer, so i dont like highly embedded classing/templating into the language. but if you still dont have side, maybe C# and vb.net is the way to go, thats the modern standard i think. tried it before, but it worst than MFC imo, i just cant get that!
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline GrumpyDaveTopic starter

  • Contributor
  • Posts: 24
Re: Which programming language?
« Reply #4 on: June 13, 2011, 03:22:55 pm »
Some good responses so far guys thanks, I haven't thought of visual basic but this is maybe worth considering.

@Psi, Thanks for pointing this out development enviroment is important, for now as this is learning not a buisiness venture free tools are a requirement. Also somthing self contained would be preferble as a pose to seperate text editors, command line tools etc..

@sacherjj,  I have also read that Python is the language of choice for many developers nowdays, what development tools could I use for Python? Is there an all in one IDE? or is it more text editor and command line compiling?

@Mechatrommer, thanks I hadn't considered visual basic and your thoughts seem to mirror what others have said regarding VisualC++ and a beginner on other forums.

I am aware thought that if I choose C# or VB that its a microsoft thing and I am essentially learning somthing windows only.
Java would seem to fit the bill as it seems similar to C# but is cross platform?

I will buy some books once I have decided which to go for which is why I am trying to pick one.


« Last Edit: June 13, 2011, 03:25:46 pm by GrumpyDave »
 

alm

  • Guest
Re: Which programming language?
« Reply #5 on: June 13, 2011, 03:36:35 pm »
If you choose Visual Basic, I would suggest VB.NET, since VB is a dead end. I believe the IDE is not supported anymore, and has issues on Windows Vista and later (it was never supported on versions later than XP/2003). The runtime (ie. for finished programs) is supported up to Windows 7, but as far as I know not on future versions. VB.NET is basically C# with a different syntax.

Python is also fairly popular and well suited for beginners, as opposed to C++ or C#.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11705
  • Country: my
  • reassessing directives...
Re: Which programming language?
« Reply #6 on: June 13, 2011, 03:55:03 pm »
since VB is a dead end.
a sad truth for me. they want to keep abstracting to higher and higher level. i will stay put with XP as long as i can :(
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Which programming language?
« Reply #7 on: June 13, 2011, 04:15:18 pm »
If you choose Visual Basic, I would suggest VB.NET, since VB is a dead end. I believe the IDE is not supported anymore, and has issues on Windows Vista and later (it was never supported on versions later than XP/2003). The runtime (ie. for finished programs) is supported up to Windows 7, but as far as I know not on future versions. VB.NET is basically C# with a different syntax.

Python is also fairly popular and well suited for beginners, as opposed to C++ or C#.

I would recommend C# over VB.NET.  There are just ambiguities at suck in VB.NET.  If you ever get to doing real OO design software, VB.NET has some issues that are annoying.  But VB.NET is definitely better than VB6.  (That coming from someone who's job is to maintain VB6 and update to VB.NET.  Unfortunately, our company doesn't want to go to C#.)

C# is 95% Java syntax.  So learning one helps get to into the other, with just the frameworks being different.

@sacherjj,  I have also read that Python is the language of choice for many developers nowdays, what development tools could I use for Python? Is there an all in one IDE? or is it more text editor and command line compiling?

You can use the default Text editor that comes with Python.  It works, but not great.  

I've used Pyscripter for most of my hacking.  It is more of an IDE with debugging and such.  Python is just so fast to take from idea to working prototype.  You will either love or hate the idea of whitespace being the flow control.  After having read through some atrocious code in my life, I actually like the restriction placed by it on style.
 

Offline ndictu

  • Regular Contributor
  • *
  • Posts: 211
  • Country: sk
Re: Which programming language?
« Reply #8 on: June 13, 2011, 04:29:06 pm »
I am aware thought that if I choose C# or VB that its a microsoft thing and I am essentially learning somthing windows only.
Java would seem to fit the bill as it seems similar to C# but is cross platform?

.NET actually has a great cross-platform support thanks to the Mono project. I think they currently have support for full C# syntax and .NET up to 4.0. There is also and IDE, MonoDevelop that is really good (compared to Eclipse and other linux IDEs, it's still no match for Visual Studio, unfortunately).

However, if you want Java there is nothing wrong with that. Very similar language, different philosophies and standards for libraries but overall not that much. Also, C# is in my opinion much closer to C++ than Java so if you want to do something more low-level the transition should be easier (but not by much, it's mostly a syntax thing).

Also, for quick little projects there are scripting languages like Python, Perl etc which are also a good choice.

It ultimately depends on what you want to do. For GUI there is Qt (for C++ but has libraries for pretty much every popular language) with it's own IDE (quite good, cross-platform). If you can live with windows only, you really can't beat .NET (C#, VB, ...) with WPF or the older WinForms (BUT you can run the same WinForms code on Linux using Mono!, not WPF though). Then there is some more stuff like wxWidgets (C++, bindings for Perl, Python), Gtk+ (C++, has many libraries, for example Gtk# for .NET).

For simple projects that I only run on Windows I almost always use C#, because of the great (and free) IDE and many libraries that make it fast and easy. Cross-platform with only console interface I go with C/C++/C# or Python.

For cross-platform GUI it gets hard, you have to know what you need. Most of the time I can get away with Qt. Many popular cross-platform applications actually use different code and GUI toolkit for each platform, and have a common code that just interfaces with that.
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Which programming language?
« Reply #9 on: June 13, 2011, 04:50:35 pm »
Agree with everything GrumpyDave mentioned.  With the addition of PyQT being an easy way yo get GUI for Python, but only if you are doing Open Source.  (Well, same with using QT for C++.)  The licensing for QT isn't cheap otherwise.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13946
  • Country: gb
    • Mike's Electric Stuff
Re: Which programming language?
« Reply #10 on: June 13, 2011, 05:39:55 pm »
I'm still looking for something that's as quick and easy to use as VB, but based on C, as it's a PITA to be continually switching between C on the MCU and Basic on the PC.
The things I particularly don't like about VB are :
It sucks at unsigned maths (try doing a 32 bit checksum - nightmare!)
It needs DLLs so you need to generate an install package, and the one that comes with VB is a bit crap.
It is no longer possible to legitimately buy it, which can be a problem if I want to give code to a customer.
No Undo on GUI changes.

I also dislike .NET due to the massive install needed if it's not already on the PC.
Would be interested to see any suggestions....

Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Which programming language?
« Reply #11 on: June 13, 2011, 06:10:19 pm »
I'm still looking for something that's as quick and easy to use as VB, but based on C, as it's a PITA to be continually switching between C on the MCU and Basic on the PC.
The things I particularly don't like about VB are :
It sucks at unsigned maths (try doing a 32 bit checksum - nightmare!)
It needs DLLs so you need to generate an install package, and the one that comes with VB is a bit crap.
It is no longer possible to legitimately buy it, which can be a problem if I want to give code to a customer.
No Undo on GUI changes.

I also dislike .NET due to the massive install needed if it's not already on the PC.
Would be interested to see any suggestions....

You can do C++ (or mostly just C if you prefer) with Visual Studio.  That is still an option.  .NET 4.0 is only 54 MB download for the libraries.  Not idea, but not "massive" but current software standards.  Anyone running Windows update already has it installed, most likely.

Frankly, C# is close enough to C syntax that I would go that route.  I would never wish maintaining a complex windows up in C on anyone.  :)
 

Offline ndictu

  • Regular Contributor
  • *
  • Posts: 211
  • Country: sk
Re: Which programming language?
« Reply #12 on: June 13, 2011, 06:46:17 pm »
I also dislike .NET due to the massive install needed if it's not already on the PC.
.NET 4.0 is only 54 MB download for the libraries.  Not idea, but not "massive" but current software standards.  Anyone running Windows update already has it installed, most likely.

For most stuff you don't even need 4.0, you can get away with 3.0 (included in Vista/7), maybe 3.5 (included in 7), or you can even go down to 2.0 if you really want, but that is just punishing yourself (but it is included in XP SP2).

You lose some fancy stuff like LINQ, extension methods ... but it is still a great platform.
 

Offline Trigger

  • Regular Contributor
  • *
  • Posts: 78
Re: Which programming language?
« Reply #13 on: June 13, 2011, 06:58:43 pm »
Python is good to learn with and it's generally useful.

C/C++ is still the gold standard though.

Java... eh it's only redeeming feature is Minecraft  :D
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Which programming language?
« Reply #14 on: June 13, 2011, 08:17:00 pm »
Obviously I need to learn a PC language but there are so many to choose from!
So I'm hoping some of you more experienced engineers can give me some advice on which to pick.

Don't pick. Learn all the common ones. No, this is not a joke. You want to become a professional, and valuable professionals aren't monolingual. They find their way in all the common languages. And it doesn't matter if you like them or not.

After you have done the common ones (and no, Python is not a common one, just a fanboy one), you can still look into the hype stuff and fag of the month.

And learn the platform/OS. A programming language is useless if you can't efficiently make use of the platform/operating system. And just like with programming languages, learn more than one platform if you want to become a professional.

The recommendation to not care about the language, but pick an IDE is absolutely rubbish. Unless you want to become a "programmer" who can't tell his arse from his head and starts to panic if he needs to use something else than the only IDE running on the only platform and OS he uses since the last 10 years. A disgusting lot of programmers I may add, because they typically claim they know the one true way to do things. Avoid becoming that hero code monkey type of programmer.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10193
  • Country: nz
Re: Which programming language?
« Reply #15 on: June 13, 2011, 11:47:29 pm »
The recommendation to not care about the language, but pick an IDE is absolutely rubbish. Unless you want to become a "programmer" who can't tell his arse from his head and starts to panic if he needs to use something else than the only IDE running on the only platform and OS he uses since the last 10 years. A disgusting lot of programmers I may add, because they typically claim they know the one true way to do things. Avoid becoming that hero code monkey type of programmer.

Wrong

I never said too "not care" about the language. The language is important in that you have to pick one, or two, and learn it. You want to pick a language that's powerful, easy to read and if you plan to work as a programmer you want a language that's popular enough for jobs to be available.

All i said was that the IDE is more important.
It's what you have to use day-in day-out to write code and find bugs. It must provide features that help rather than hinder you. Anything that annoys you in the IDE will keep annoying you forever and drive you crazy.

Once you know a language well enough to write good code the language will vary rarely annoy you, it's just a way of doing/saying something. It's the IDE and dev/debug tools that can cause you to pull your hair out on an ongoing basis and that's why its more important to pick a good IDE.
« Last Edit: June 14, 2011, 12:02:48 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11705
  • Country: my
  • reassessing directives...
Re: Which programming language?
« Reply #16 on: June 14, 2011, 05:22:43 am »
learn assembly! (or machine code) then you can become monkey's god :D nvm Psi, that advice was meant for professional. you can learn all the languages (and layers of onion) if you like all years long.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Which programming language?
« Reply #17 on: June 14, 2011, 05:26:05 am »
All i said was that the IDE is more important.

It is completely unimportant. The amount of code you type in in a serious software project is so negligible compared to all the other work that needs to be done that it absolutely doesn't matter. People insisting on a particular IDE remind me of car mechanics who claim they can only do their job with yellow screwdrivers, and the red ones won't do.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11705
  • Country: my
  • reassessing directives...
Re: Which programming language?
« Reply #18 on: June 14, 2011, 05:40:54 am »
its not that simple as comparing it to colors. it has to be something with the bits. maybe the red one got hex bit which unsuitable for car application, or compact replacable bit which "pro mechanic" wont care to consider but be loved by many hobbiest. similar to my case where i use vb to build app, what if i want to port it to linux? with weeks/months of coding, you want to call it "doesnt matter"? if i built it in cross platform IDE, i will have minimum effort (and time! which most pros will care about most!) to do that. but... it doesnt matter, since porting to linux is not within my scope of work. all i care is how much time left for me to do the other things (not the programming things).
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline updatelee

  • Contributor
  • Posts: 42
Re: Which programming language?
« Reply #19 on: June 14, 2011, 06:07:33 am »
I'm a big fan of Python, as it is very fast to implement code in, and has vast libraries for doing different things.  GUI is a little harder than Delphi or MS Visual Studio or the like.  

What you get is cross platform for free, if you use a supported library.  That may or may not be useful, depending on application.

Best bet is probably free version of Visual Studio and C#.NET.  That seems to be the norm for windows any more.

I still do alot in C/C++ but for small quick projects I love Python. You can create a simple GUI using QT creator, implement it in python and be up and running with your app in no time flat. Its surprisingly fast too for a scripted language.

There are still more libraries for C/C++ though, if the project is going to be more complex or I need specialized drivers its the way togo imo.

Ive wrote a few apps now that interface with the serial port, grab some data, analyze it and output it to a graph on the screen and honestly its so much easier in python. So quick. python is quickly becoming very well supported. I can run python even on my dreambox 800 satellite receiver.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4283
  • Country: us
Re: Which programming language?
« Reply #20 on: June 14, 2011, 06:12:55 am »
Quote
My ultimate aim is to be able to cobble together some PC software with gui that can send commands to or recieve
data from the microcontroller via either rs232 or usb.
The importance of the "IDE" is not so much in creating the progam, but creating the GUI features.  In a language like C you can spend hours and hours setting up data structures to define windows and buttons and such.  An OO language like C++ or Java is a bit better, because it's better at hiding such data structures inside the classes, and giving them reasonable defaults and such.  But something like Visual Basic lets you draw what you want your GUI to look like, and attach code to the picture like "when the user clicks here, run this routine."  I was a little shocked at how easy it is.  I'm not sure it's exactly correct to call that part of the IDE, but it's not really just part of the language.  Perhaps it's an example of when an IDE offers real utility beyond syntax highlighting and user-definable indent styles :-)  This is the sort of thing you want to look for, unless you're interested in getting into the nitty gritty of GUI primitives (or more likely, some GUI library...)

There are tools that do this (or at least try to do this) in a multiple-platform way.  RealBasic is one that I've come across ( http://www.realsoftware.com/realstudio/ ) (my son had a programming class that used RealBasic.)  I would assume that there are others.  (someone mentioned Delphi, and Apple's XCode has things that do this.  It depends on how cross-platform you want to get, I guess.)  There are "game programming" environments (eg http://www.yoyogames.com/gamemaker ) that I'm not sure I'd rule out entirely, either.

You might also look at "Processing", which is sort-of to Java what Arduino is to avr-gcc.  But not like what I described above...

(and now you have a hint why software is so bloated these days!)

 

Offline Lance

  • Frequent Contributor
  • **
  • Posts: 317
  • Country: 00
  • Resistance if futile if R<1Ohm
Re: Which programming language?
« Reply #21 on: June 14, 2011, 07:01:21 am »
Obviously I need to learn a PC language but there are so many to choose from!
So I'm hoping some of you more experienced engineers can give me some advice on which to pick.

Don't pick. Learn all the common ones. No, this is not a joke. You want to become a professional, and valuable professionals aren't monolingual. They find their way in all the common languages. And it doesn't matter if you like them or not.

After you have done the common ones (and no, Python is not a common one, just a fanboy one), you can still look into the hype stuff and fag of the month.

And learn the platform/OS. A programming language is useless if you can't efficiently make use of the platform/operating system. And just like with programming languages, learn more than one platform if you want to become a professional.

The recommendation to not care about the language, but pick an IDE is absolutely rubbish. Unless you want to become a "programmer" who can't tell his arse from his head and starts to panic if he needs to use something else than the only IDE running on the only platform and OS he uses since the last 10 years. A disgusting lot of programmers I may add, because they typically claim they know the one true way to do things. Avoid becoming that hero code monkey type of programmer.
Agreed. Diversity is the key to success. A good language for PCs is C++. It's very similar to C, which you already know (C18 is just a compiler). Actually it's basically C with object oriented components on top (simplification). As mentioned above you'll have an easier time when it comes to setting up GUIs.
#include "main.h"
//#include <killallhumans.h>
 

Offline ToBeFrank

  • Regular Contributor
  • *
  • Posts: 234
  • Country: us
Re: Which programming language?
« Reply #22 on: June 14, 2011, 05:37:16 pm »
Don't pick. Learn all the common ones.

This is good advice for a professional, but horrible advice for someone starting out. Pick a language. Experiment with it. Get good at it. Find out all it's advantages and disadvantages. Then you can move on to other languages. When I interview software guys, I'd much rather they be really proficient in one language (object oriented) rather than ok at a bunch of languages. The proficient guy will have no trouble picking up the concepts in whatever language we are using.

Quote
(and no, Python is not a common one, just a fanboy one)

???
 

Offline GrumpyDaveTopic starter

  • Contributor
  • Posts: 24
Re: Which programming language?
« Reply #23 on: June 14, 2011, 11:18:25 pm »
Thanks for all the relies guys.


Don't pick. Learn all the common ones. No, this is not a joke. You want to become a professional, and valuable professionals aren't monolingual. They find their way in all the common languages. And it doesn't matter if you like them or not.

After you have done the common ones (and no, Python is not a common one, just a fanboy one), you can still look into the hype stuff and fag of the month.

And learn the platform/OS. A programming language is useless if you can't efficiently make use of the platform/operating system. And just like with programming languages, learn more than one platform if you want to become a professional.

The recommendation to not care about the language, but pick an IDE is absolutely rubbish. Unless you want to become a "programmer" who can't tell his arse from his head and starts to panic if he needs to use something else than the only IDE running on the only platform and OS he uses since the last 10 years. A disgusting lot of programmers I may add, because they typically claim they know the one true way to do things. Avoid becoming that hero code monkey type of programmer.

While I agree that learning more than one language is a good idea, as I am just starting I think I should concentrate on one for now then move to others later.

Its quite close between C++ and C# at the moment.

From what I have read so far I am leaning toward c# for the first language to get stuck into, it seems to have a few advantages (from my beginners point of view) than C++ like auto memory management and ease of creating GUI.
Cross platform support was not really a requirement I was just thinking of the negatives of c# and I see mono project .NET framework solves this.

 

Offline Trigger

  • Regular Contributor
  • *
  • Posts: 78
Re: Which programming language?
« Reply #24 on: June 15, 2011, 02:42:55 am »
Obviously I need to learn a PC language but there are so many to choose from!
So I'm hoping some of you more experienced engineers can give me some advice on which to pick.

After you have done the common ones (and no, Python is not a common one, just a fanboy one), you can still look into the hype stuff and fag of the month.


That sounds just like a fanboy comment.  Major companies use it in production, and MIT teaches programming with it.  That's a pretty strong case for it being a 'common' language.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf