Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

n00b VB vs C# for dev of a basic sensor monitoring app w networking?


  • Please log in to reply
6 replies to this topic

#1 bionicmotronic

bionicmotronic

    New Member

  • Members
  • Pip
  • 7 posts

Posted 31 December 2012 - 03:03 AM

I got a Netduino Plus 2 for holidays and just fired it up and in relatively no time got it running using VB.NET with my own little 'enhanced blinky' app... counting user clicks and feeding those back as multiple LED flashes using a Timer object and watching for when we think the user is done 'entering data'.  Pretty fun stuff and amazingly quick to get started. Nice.

 

But now trying to decide which language to invest my time in as I want to dive into a first real project - adding a number of home sensors to a Netduino board and interfacing it to my existing internet thermostat.  I'll monitor some analog ports for water/flooding (sump pump) and a few other things, don't expect to be hard at all.  Idea will be that the home system already has nice ability to throw alerts and i'll use the netduino to trigger those in exception conditions, then when I see an alert I could choose to go directly to the netduino for more detailed information... So for instance i'd see a 'warning' alert from the other system then could log into the netduino to check say, actual sump well water levels.  All seems pretty easy and don't anticipate anything difficult but trying to decide which language to jump on board. 

 

As background I have years of programming experience and used to be a dev full time years ago, although not .NET and my C-type coding is way rusty, but I do still use VB periodically for work projects, and it's obviously a bit more speed-typing friendly than all the curly brackets and more painstaking declarations.  That said I know after a few days back in the C saddle the (irritatingly PITA to reach w/ the little fingers of right hand) curly bracket typing would come right back. I'm also reasonably electronics literate, and can likely build or mod whatever I need within my simple requirements.  

 

Any updated feedback on which language might be best to continue on?  Naturally I"ve searched around and a lot of the comments I found so far seem dated - ex: complaining VB didn't work on VS Express etc. which is all obviously not true at all now.  

 

I'm probably most concerned about if the VB will A. have all the networking functionality I want to easily put up a little micro HTTP server, and B. support as many 3rd party boards in case i want to leverage existing shields etc. (I can wire it at first but ultimately wifi would be best for instance...) Any feedback? 

 

TIA. 

 

 



#2 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 31 December 2012 - 10:39 AM

Any updated feedback on which language might be best to continue on?  Naturally I"ve searched around and a lot of the comments I found so far seem dated - ex: complaining VB didn't work on VS Express etc. which is all obviously not true at all now.  

 

I'm probably most concerned about if the VB will A. have all the networking functionality I want to easily put up a little micro HTTP server, and B. support as many 3rd party boards in case i want to leverage existing shields etc. (I can wire it at first but ultimately wifi would be best for instance...) Any feedback? 

 

Firstly, my personal preference is C# but I'd advise that you go with the language you feel the most comfortable with.  One thing you will note is that there are more C# examples out in the forums than VB.NET.  At some point you will probably have to get comfortable with reading C# even if you do not code in it.

 

Regarding compatibility of drivers etc.  There are two things you can do here, convert the code to VB or compile the C# to a DLL and then add a reference to the compiled library in your VB project.  If you want to convert the code then there are plenty of free online translation tools which will do the job for you.

 

Welcome to the community, hope you enjoy working with this board,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#3 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 01 January 2013 - 01:51 PM

Really for the language differences, it comes down to in C# things need to be explicit and VB things are implicit.

I strongly prefer C# because it is explicit, most decisions are ones that you instigated, whereas in VB you get a more stuff that happens when you didn't actually want stuff to happen.Therefore lots of weird errors.

Also in VB you have to write Dim too many times.

 

One advantage of VB is the For Next loop operators seem to work more easily with the iterators.

 

That's my 2c.


STEFF Shield High Powered Led Driver shield.

#4 bionicmotronic

bionicmotronic

    New Member

  • Members
  • Pip
  • 7 posts

Posted 06 January 2013 - 04:22 PM

Thanks for replies guys.  

 

Really for the language differences, it comes down to in C# things need to be explicit and VB things are implicit.

I strongly prefer C# because it is explicit, most decisions are ones that you instigated, whereas in VB you get a more stuff that happens when you didn't actually want stuff to happen.Therefore lots of weird errors.

Also in VB you have to write Dim too many times.

 

One advantage of VB is the For Next loop operators seem to work more easily with the iterators.

 

That's my 2c.

 

 

Yeah in VB I always use Option Explicit anyway, so that should be "about the same"

 

I do have these weird "overflow will not throw exception" errors that appear and disappear, but searching around that seems to be a VB anomoly... maybe I'm still not doing something right but the code seems to work fine. 

 

Firstly, my personal preference is C# but I'd advise that you go with the language you feel the most comfortable with.  One thing you will note is that there are more C# examples out in the forums than VB.NET.  At some point you will probably have to get comfortable with reading C# even if you do not code in it.

 

Regarding compatibility of drivers etc.  There are two things you can do here, convert the code to VB or compile the C# to a DLL and then add a reference to the compiled library in your VB project.  If you want to convert the code then there are plenty of free online translation tools which will do the job for you.

 

Welcome to the community, hope you enjoy working with this board,

Mark

 

I definitely have no issue reading the C#, not saying I'm great at it but I can get by.  It's just coding it fast is a different story.  It's like French - I can muddle through reading a newspaper but ask me to open my mouth and forget about it ;)

 

I did some searching and see yep I can load the drivers via references.  No problem there, probably rather do that and have known-good function calls than use a translator that might muck something up.

 

Thanks again guys...  playing around some more today.  Fun stuff.  



#5 Strut

Strut

    Member

  • Members
  • PipPip
  • 18 posts

Posted 06 January 2013 - 05:26 PM

As a professional .Net developer of 8+ years, I'd highly suggest learning C# from the start. As a budding .Net developer, you'll find many more code examples, books, and libraries written in C# than VB. This will become even more pronounced as you progress into advanced topics. As for another pro for C#, you'll find a ton of similarities to C, C++, Java, and JavaScript, all of which will have you reading and writing in those languages much more quickly. Their is something to be said about a language developed from the ground up to take the best aspects, and fix the worst shortcomings, of multiple popular languages of our time.

 

 

I'll probably ruffle some feathers with this, but in my opinion, VB really is a dying language, which is only still around because Microsoft had to continue to support the many old Office and COM developers as they made the transition to .Net and C#. Even Microsoft treats VB as a second class citizen in regards to support of it in their new technologies. With that said, VB.Net has come a long way and has some merits, but I don't think they outweigh the negatives for someone new to .Net and trying to make a choice between the two.



#6 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 07 January 2013 - 02:58 PM

Ok, I put my feathers back in place ;) ... Just kidding.  I made the jump from Pascal and Assembler to VB4 back when the dinosaurs still roamed the Earth.  I spent most of my career as a VB developer going from 4-5-6 then to VB.NET.  I was hired by IBM in 2004 because of my VB6 and VB.NET knowledge to work on some multi-million Dollar conversion projects for IBM clients such as UPS, FedEx, Maersk Sealand, Merck, etc.  These are large companies who decided to invest millions in converting programs from VB6 to VB.NET or ASP to ASP.NET but in either case they stuck with the VB language.  Having shown them all the merits of C# and C languages they chose to stick with VB.

 

I do not agree that it is a dying language.  These companies are building their infrastructure on it and investing a lot of money otherwise I would not have been so gainfully employed at IBM for 7 years.  Probably a better way of putting it is that companies are not adopting VB.NET over C# when starting with new projects or even first time in house development.  C# is definitely becoming more popular with the growing mobile development market because it does work cleanly with Javascript and is a similar language. C# developers can then easily learn things like Objective-C to do MacOS and iOS development.

 

If you are new to programming all together it will benefit you in the long run to start with C#.  If you have programmed in VB or Basic style languages, working with the Netduino is a perfect opportunity to spread your wings and learn C#.  Having programmed in VB most of my career and having only jumped on the C# wagon a few years ago, I will say at first it will seem daunting... even frustrating living in curly bracket hell... but if you stick with it, it will click and you'll find yourself wanting to use C# more often than VB.



#7 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 20 January 2013 - 09:26 PM

I started with VB programming one-off Windows applications to serve a lot of calculation, analysis, and homework problems during my undergrad Physics program. I find VB is easy to get a handle on and "beat into shape", as it were. However, I'd long been interested in C# and the Netduino (and Android programming in Java) were the perfect excuses. I have a small background in C# but mostly VB, and I find that C# is easy to pick up, and actually easier to work with.

 

Here's a quick reference page that shows you how the different languages translate, in case you want to start porting your existing VB stuff to C#:

 

http://www.harding.e...comparison.html






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.