VirtualLife
Posts: 13
Joined: Mon Apr 29, 2013 11:38 pm

Debating on which language to learn

Sun Jul 14, 2013 3:07 am

I need to build a system that has a few main components
A Local webserver (not available over the web, just via local ip) At the same time, I am building a .net website that I would like to mimic pieces of locally.
Code to set it up as a wireless router
Code to talk with a rest api sending and receive data
Code to talk with a arduino board.

My background is 15 years of Microsoft tech (yea I know), so I see my options as Mono, Python and C++ (hate java).

I haven't had much luck with mono so I am leaning on a native Linux language. So I guess my main question is, can Python do everything I need or should I deal with c++? Or is it worth fighting to get Mono working considering my background?

Python (from my basic knowledge) seems like classic asp to me, simple, but limiting.
C++ is just a pain, it's been a couple decades since I've used it, but it's meant to be low level so either way, common things are more work.
Mono is a great concept, but I have spent many hours trying to get basic programs to work. Maybe there is a point where it all gets easier, but right now, I am not having much luck.

I know most of this is a matter of opinion, but would appreciate the input as this will turn out to be a fairly large project in the long run.

One last point, if I am looking for a paid developer, will I find more competent Python, C++ or mono developers for linux? ie, the .net world, if you only know vb, you are not very competent imo.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Debating on which language to learn

Sun Jul 14, 2013 3:51 am

I recommend learning the following:
shell scripts
'c' - NOT C++
python

That will cover 99%-100% of your needs.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

VirtualLife
Posts: 13
Joined: Mon Apr 29, 2013 11:38 pm

Re: Debating on which language to learn

Sun Jul 14, 2013 4:03 am

Appreciate the input. Can you give me some more detail?

What can python do that c can't? or at least why mix them?

I come from a world where 1 language does everything, so I am confused as to why I should need to learn multiple.

Again years past, but c was always an extremely simple language. While very efficient, I would figure the libraries in c++ are optimized for most anything besides high end graphics/math calcs.

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Debating on which language to learn

Sun Jul 14, 2013 8:39 am

VirtualLife wrote:if you only know vb, you are not very competent imo.
what about jscript :P
VirtualLife wrote:I come from a world where 1 language does everything, so I am confused as to why I should need to learn multiple.
as long as that language is not vb?!? ;)


any way ..
web server options include

busy-box httpd
lighthttpd
libmicrohttpd


as Richard-TX recommended shell scripts
possibly the topics below are some use

BASH - Ultimate Book for Free

Linux command line reference guide

command line knowledge
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

User avatar
jackokring
Posts: 816
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
Contact: ICQ

Re: Debating on which language to learn

Sun Jul 14, 2013 1:42 pm

Python can fail gracefully with errors, and C can't some of the time :D (you did ask).

If your new to coding and hate the Java (classpath=cak_option), then Python is as good as some and better than most to learn structured programming with the niceties of GC and ADTs. C is perhaps the language that can do *ANYTHING*, be warned, it will do what you express, not what you intended to express. C++ is just OOP sugar on C, learning C will teach you about how the machine compiles and about efficient coding. After that the C++ extensions will be easy. I often find those who learn C++ do very inefficient solutions to simple algorithms, and consume memory at an alarming rate.

Other options include Pascal/lazarus, Tcl/Tk, Ruby, Lua, BASIC. I would expect graduates to know some C, and school leavers to know some python, in modern terms. You could also use javascript or PHP, the choice is wide.
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: Debating on which language to learn

Sun Jul 14, 2013 8:27 pm

I first learnt python and while its great and still my first choice to work with. I had to write portions of my latest project in C. Mainly to do with accessing gpio. I found python to be very unpredictable at low level interfacing. When you are trying to catch pin changes (even using interupts) Python varies quite wildy on the timings of which the pi is more than capable of. C solved this for me so I have C do a lot of my GPIO then launch my python passing the result as a parameter.

BillStephenson
Posts: 256
Joined: Thu May 17, 2012 1:25 am
Location: SW Missouri Ozarks
Contact: Website

Re: Debating on which language to learn

Sun Jul 14, 2013 11:02 pm

Take a look at Perl too. It's already there and you can do a lot with a web server, web browser, and perl.

VirtualLife
Posts: 13
Joined: Mon Apr 29, 2013 11:38 pm

Re: Debating on which language to learn

Fri Jul 19, 2013 8:35 pm

I appreciate the input. Thanx.

I think I will start off with C based on what kghunt said about the gpio issues. Something I definitely don't want to have to worry about.

Been about 20 years since I have done C, time to start re-learning. :|

Thanx everyone.

pjc123
Posts: 922
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: Debating on which language to learn

Sun Jul 21, 2013 11:39 am

VirtualLife wrote:I appreciate the input. Thanx.

I think I will start off with C based on what kghunt said about the gpio issues. Something I definitely don't want to have to worry about.

Been about 20 years since I have done C, time to start re-learning. :|

Thanx everyone.
I also had to brush up on C when I started using the GPIO, as it has been 15 years since I used it full time at work. I always preferred C because of its direct tie-in and history with UNIX/Linux, especially the low level stuff.

Here are two great C libraries for the pi. I use the first one and have been very happy with it:

1) http://www.airspayce.com/mikem/bcm2835/index.html

2) https://projects.drogon.net/raspberry-pi/wiringpi/

Here are some web sites I found that show C commands with examples. Great for a quick brush up:

1) http://www.cprogrammingexpert.com/C/int ... guage.aspx

2) http://gd.tuwien.ac.at/languages/c/cref ... /EXAMPLES/

3) http://www.java2s.com/Tutorial/C/CatalogC.htm

I also found the following free C books online. I don't have the web sites, but here are the titles and authors:

1) The C Programming Language - By Brian W. Kernighan and Dennis M. Ritchie. This is the all time classic, as Dennis Ritchie invented the C language. I still have the softcover version of this book. I was actually working at the same location as him for a while (AT&T Bell Laboratories in Murray Hill, NJ.). This is also where the transistor was invented as well as UNIX, the precursor to Linux, among other things.

2) C Programming Tutorial - Simple easy learning by tutorialspoint.com

3) The GNU C Reference Manual - Trevis J. Rothewell

4) The GNU C Library Reference Manual - Sandra Loosemore + others

5) The C Book - Mike Banahan + others

6) The C Reference Card – Joseph H. Silverman

7) Using the GNU Compiler Collection – Richard M. Stallman
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Debating on which language to learn

Mon Aug 26, 2013 10:21 am

Last edited by duberry on Mon Aug 26, 2013 4:22 pm, edited 1 time in total.
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

User avatar
DougieLawson
Posts: 39169
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Debating on which language to learn

Mon Aug 26, 2013 2:41 pm

I hate to say this, but for simple web programming the truly awful language PHP is easy to learn. Combine that with MySQL (or MariaDB) and you're half way to building your LAMP stack.

LAMP is
  • Linux (Raspbian)
  • Apache
  • MySQL
  • Perl or PHP
The reason I use PHP is because it's easy (and good for quick things). The reason I hate PHP is because it's inconsistent and doesn't stick to the principle of least astonishment.

Perl can be used for web programming with Perl's CGI.pm (available from CPAN or with `apt-get install lib-cgi-pm-perl`)
http://search.cpan.org/~markstos/CGI.pm-3.63/lib/CGI.pm
but it's more work than PHP as you have to do more to generate the static HTML.

The other choice for simple web programming is Ruby and Rails (again with MySQL/MariaDB).

I run MariaDB on a Ubuntu server and use the client interface on my RPi connected to port 3306 on my server. I'm not running the MariaDB server on my RPi.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”