Go Down

Topic: Good practices (Arduino Programming) (Read 5849 times) previous topic - next topic


How can you get any coding done when all you're doing is scrolling up and down because of all the whitespace?

How do you deal with newbies that do this?
Code: [Select]
void loop(){

    int useless = analogRead(0);

I'm firmly in the { and } on lines by themselves camp.


Thank you all for your great replies... I was looking for this post for a minute before I (like a putz) saw the "my replies" link. Keep them coming people!


f_functions - or would be if I actually wrote any

More and more I find myself writing functions for basically everything! Makes the loop() neat and tidy. And #defines are HUGE! Makes my code read like plain English.


...but as soon as someone else needs to read and understand your code,

You should check out the Drupal-freaks. There's a whole module that does nothing but check for conformity to module style and structure standards. It's partly for legibility but also for potential module version auto-upgraders. That's the -ultimate- intent, though still a work in progress. It makes sense. If one version is defined and cast in stone, and the next version similarly cast, then an upgrader could perform the upgrade automagically. The current version doesn't some of the work, but not very much, it's a long term goal. Drupal version upgrades are at about 1.5-year intervals, but modules can be so spectacularly difficult to upgrade that authors often don't, or they leave, and so the actual user who *NEEDS* a particular module -can't- upgrade.

Conformity is also used for tools that pull info out of module definitions for other documentation purposes, test generators, compatibility analysis (with other modules,) and version control.

One thing is for sure.  We are all going to differ in our views...


...and we are all correct in our own views on this subject.

Mmmm.... that's a little argumentative. I've never thought and of *MY* views to be incorrect. Otherwise, why would I have that view? By default, wouldn't that make -your- view incorrect? But I guess since I've agree that we can DIFFER I'll let it slide.  ;)

Go Up