Read the manual...

The reference pages are great...but as far as programming strategies/tips/best practices...can someone recommend a book or other source for these insights?

I've purchased a couple of beginner titles, and am constantly examining and trying to learn from example sketches, but most do not really discuss strategies or best practices such as when or why to use flash memory versus SRAM for strings to pass to Serial.print.

Thanks.

Hi,

I have a LOT of Arduino books. These are good:

Beginning Arduino - Michael McRoberts very good book to start with Arduino.

Arduino Cookbook - Mike Margolis does a nice job of showing many real world connections and devices, explains programming along the way.

Practical Arduino Cool Projects for Open Source Hardware - Jon Oxer has done an excellent job of showing real projects in detail.

Beginning C for Arduino - Jack Purdum. Excellent C/C++ learning book, with some good hardware project examples. (Disclaimer: I am the Technical Editor of this book)

I'll be interested in other people's suggestions.

robjphillips:
but most do not really discuss strategies or best practices such as when or why to use flash memory versus SRAM for strings to pass to Serial.print.

It is easier to help if you ask a specific question.

You can use the F macro with any fixed text that you want to print. If your program does not have much text or use much SRAM you don’t have to use the F macro.

I am not aware of any book or online tutorial that is specifically aimed at “strategies” or “best practices”. And what is good on a PC with lots of SRAM, disk space and an operating system may be very inappropriate for a microprocessor (and vice versa).

What little I know was picked up from reading magazine articles, text books and programs over the past 35 to 40 years.

If you are not familiar with the internal hardware of a microprocessor and don’t know the general concept of assembler language then IMHO reading about them will give you a lot of useful background knowledge of the environment in which your code must work.

…R

WELL, there's THIS good outline of ideas:

Planning and Implementing an Arduino Program (LINK)

...by Robin2, whoever the heck THAT is...

Great responses... Thank you Terry & Robin!
These give me a bit to keep me busy learning!

Loving this power. In the 1990's when all there was were Apple & IBM (and it's work-alikes)...this is so refreshing a (new to me) world to be in. Of course it comes with a lot less structure, and I am slowly learning how to cope with that.

terryking228:
WELL, there's THIS good outline of ideas:

Thank you for the kind thought.

I guess I have not considered it as a treatise on strategy or best practice - just something practical and easy to implement :slight_smile:

...R

I am a Java/Android/SpringBoot dev as the day job which are much higher level language/frameworks but before starting a new project and writing hundreds of lines of code to make the latest spaghetti code mess, I (and many others) sit down and physically draw out/sketch an "architecture" that may be a good starting point.

Architecture is like the overall large scale how the application is built up of smaller chunks. Imagine it like having a set of code blocks (called services, controllers, DAOs, databases, etc. depending on what they are for) and drawing out the links between them.

Here is a basic "Android app architecture" :


And a Web Application (Netflix's Billing):
You can see it gives a large scale (very macro) link between some services to how the App is to be structured.

Once you have thought of a good Architecture, you then start to code your app. When writing the individual "services", you then think of the Design Pattern

A Design Pattern is more low level. It is how you are going to organise the code inside services. There are many types of Pattern in Java...like "the singleton pattern", "the observer pattern", the "factory pattern" all of which have benefits and drawbacks. You kinda select the most appropriate one for that part of your app.

There are general books on design patterns and architecture, for many languages, C/++ included. They are much more high level, the whole big picture, and look more at the design principles of Applications (whatever the app is) and focus less on things like "What is a String and what is an int?"
Some C/C++ Design Patterns

It is things like going from writing one big sketch file...to breaking it up in to more "manageable" components and how to fix them together to write clean, portable,readable and re-usable code.

As you code more and more, you become more concerned about "how to plan an app" rather than "how do I do a for loop backwards?".

Hope that helps and gives you a starting point for "more advanced ideas".

You can easily look up 1000 ways to use a nail, but if you don’t know what a nail is in the first place you might end up using chewed up bubble gum.

The syntax of coding is huge part, but truely understanding available functions, methods, variables, operators gives you the tools that make a difference.

Thanks, @johnny010 for the perspective and for pointing to that book.

Hmmm... "C++ Programming: Code patterns design" sounds like a book I SHOULD be reading. This reminds me of a time when I was writing a lot of multi-threaded code in a Real Time OS for a chip tester and I was occasionally significantly Boggled. I had a discussion with some other IBM guys and one said, "Oh, you need to figure out how to handle debugging multiple concurrent instantiations of the same code. Look at Petri Networks. " So I Got The Book.

Then, as right now, I said to myself, I said, "You REALLY oughtta read this book and understand it." BUT, BUT I have a lot of code I need to get done Real Soon Now...

That Petri Net book is still on my shelf. For the last 30 years...

I'm figuring out my next excuse...

terryking228:
Then, as right now, I said to myself, I said, "You REALLY oughtta read this book and understand it." BUT, BUT I have a lot of code I need to get done Real Soon Now...

That Petri Net book is still on my shelf. For the last 30 years...

I'm figuring out my next excuse...

I have a few books...on random stuff. One like the "bible of Android", a Clean Code book, Java Design Patterns and one on Spring Boot...It is one of those things where you seem to find the chapter you need that instant...read it, do it and then the book never gets touched again ha!

In the case of my android book, it was RecycleViews. About 20 pages of the 300 odd.
The Spring Boot...about 25% got read...mainly for JMS.
Clean code, I got about 30 pages in and realised I already did most of the things it recommended...but was nice to see it formalised.

I'd bet C/++ is much harder. How are frameworks for C/++? Are there like Frameworks for certain ICs/webapps/hardware or is the community quite "closed source" making frameworks very internal and hard to learn/implement personally on hobby projects?

I mean with say MicroPython and the ESP chips...maybe frameworks like "Django Light" could be on the horizon?

Unfortunately there no longer seem to be bookshops that stock arcane computer books so you could browse them to see if they are worth buying or see something interesting that you had never even thought of.

If you know what you want you can probably find the answer with Google inside 10 minutes, and for free.

If you don't know what you want then you are stuck.

...R

Robin2:
Unfortunately there no longer seem to be bookshops that stock arcane computer books so you could browse them to see if they are worth buying or see something interesting that you had never even thought of.

I frequently use the public library. Even if your branch, like mine, has very limited selections in the computer category they can get titles from other libraries in the local system. Around here it's by county. If the county doesn't have it a statewide search can be done and an ILL (Inter-Llibrary Loan) requested. Statewide search opens up community colleges and universities, which often have titles to support the IT/programming courses.

dougp:
Even if your branch, like mine, has very limited selections in the computer category they can get titles from other libraries in the local system.

The problem with that is that you can't browse the books before deciding if they might be worth requesting and you can't be exposed to interesting books that you are not aware of.

...R

Robin2:
The problem with that is that you can't browse the books before deciding if they might be worth requesting...

That's why you request it from the library - so you can browse it without committing cash. Your only outlay is time - and a trip to pick it up. There's not normally a fee but I throw some small bills in the 'building fund' jar. The only extra effort for an ILL is confirming the title isn't available locally and providing the book's actual title, author, ISBN or whatever the local branch needs to process the request. Many times they're not due for up to three weeks, certainly long enough to decide if it's something you want to lay down actual money for.

And, if you do decide to purchase, places like Alibris have tons of used books for way less than new.

dougp:
That's why you request it from the library - so you can browse it without committing cash. Your only outlay is time - and a trip to pick it up.

I knew that's what you had in mind when I wrote Reply #12

I can't realistically ask them to send over all their computer books just in case there is one that might be interesting :slight_smile:

...R