how to write foolproof Arduino open-source libraries?

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I first started releasing open-source AVR utilities and libraries, I usually released them with just a basic Makefile for building from the command line.   If you couldn't run make and avrdude, you couldn't use my code.  Some of my code ended up as Arduino libraries when someone else modified or wrapped it up to work with the Arduino API.  Over the past couple years I've started releasing more of my code in the Arduino library format, but it has caused an unexpected problem.  Instead of just using my code as intended, some Arduino users try to tweak/modify it without having first understood how to write C/C++.   I could try adding comments, like /* Don't touch the code in this file unless you really know what you are doing */, but I'm sure that won't stop the problem.

 

I could selectively turn off issue reports on my github repos, but I still want to get feedback on legitimate bugs and I don't mind polite requests for new features/improvements.

 

I'm considering releasing Arduino libraries in binary (compiled archive) form, which is supported since v1.8.6 of the IDE.  I'd still like to make the full source available, but only to other developers.  I'm looking for suggestions on an easy way to do this.

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ralphd wrote:
some Arduino users try to tweak/modify it without having first understood how to write C/C++.

"

You who are on the road
Must have a code that you can live by

And so become yourself
Because the past is just a good-bye.
Teach your children well,
Their father's hell did slowly go by,
And feed them on your dreams
The one they picks, the one you'll know by.
Don't you ever ask them why, if they told you, you will cry,
So just look at them and sigh

And know they love you."

 

All you can do is put it out there, how it will be used (abused) is not up to you, just be joyful in your sharing!

 

Jim

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ralphd wrote:
Instead of just using my code as intended, some Arduino users try to tweak/modify it

Isn't that the whole "raison d'être" for open source ?

 

I don't think /* Don't touch the code in this file unless you really know what you are doing */ would really suffice.

 

Having read some of your other freaks postings; I'll bet your Arduino code contains sneaky compiler tricks and clever hacks to eke out the best performance. These constructs definitely need commenting explaining to the nth degree.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:

ralphd wrote:
Instead of just using my code as intended, some Arduino users try to tweak/modify it

Isn't that the whole "raison d'être" for open source ?

 

 

No, the reason for other software developers to modify/improve the code.  It's not so users of the code to play cut & paste.

For example the Linux kernel is open source, but there is no intention of users modifying it.

 

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could you look at some approach where it was pre-built binary? Sure, provide the source too but only an "expert" would realise that source changes needed the binary to be separately rebuilt to take effect. Anyone else may think they were changing source with no actual effect. When they can't work out why they'll hopefully pursue some other solution!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ralphd wrote:
but only to other developers
How can you possibly police that?  It's also in contravention of most open-source licenses, if not of their letter, then certainly of their spirit.

 

EDIT:  typo

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Wed. May 20, 2020 - 08:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:

ralphd wrote:
but only to other developers
How can you possibly police that?  It's also in contravention of most open-source licenses, if not of their letter, then certainly of their spirit.

 

EDIT:  typo

 

What makes you the authority on the spirit of open-source licenses?  For the open source projects I've worked with, the most obvious reason for open-source has been for the improvement of the code.  People that can't do more than cut and paste aren't going to improve code.  The largest open source project in the world, has significant barriers to contributions, bug reports, or feature requests from non-developers.  I'm looking to do something similar where anyone can use my code, but unless you are another developer I want it to be hard to contact me.

 

Regarding license terms, when it comes to code I write, I can release as much or as little as the code as I want.  I could release the headers under a permissive license like MIT, along with a binary archive.  For other developers that could help improve the code or integrate it into a larger project, I could provide the rest of the source, even under an open-source license like MIT.  I don't see anything in the MIT license that implicitly or explicitly says I can't be selective regarding the people I provide the source to.

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why even bother sharing if you don't want people to use it? I simply don't get it. Or does someone have to be able to prove their worth somehow to use your exalted code? I put code out under a beerware licence and the user can do WTF they like with it! :-)

Last Edited: Wed. May 20, 2020 - 11:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Could you look at some approach where it was pre-built binary? Sure, provide the source too but only an "expert" would realise that source changes needed the binary to be separately rebuilt to take effect. Anyone else may think they were changing source with no actual effect. When they can't work out why they'll hopefully pursue some other solution!

 

I don't think that would work unless I also disabled issues submissions on the github repo.  I was hoping there might be a few more open-source developers in the freaks forums that might have some ideas.  Bill W and Hans(MCUDude) are the only other avrfreaks that I know of, and neither of them seem to have a solution the problem (or maybe they don't find dealing with cut/paste monkey "coders" to be a problem).

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Why even bother sharing if you don't want people to use it? I simply don't get it. Or does someone have to be able to prove their worth somehow to use your exalted code? I put code out under a beerware licence and the user can do WTF they like with it! :-)

 

I guess I shouldn't have bothered to ask in avrfreaks when some moderators like to make sarcastic remarks about things I never actually said.

 

"I'd still like to make the full source available, but only to other developers."

 

I'm sure you read it, and I'm sure you know that "other developers" are people too.  What I get from your response is that you are more interested in a straw man argument than a rational discussion.   And you are reminding me why I left avrfreaks for a few years.

 

I have no special talents.  I am only passionately curious. - Albert Einstein

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sometimes code is like a sudoku puzzle, no one cares about what you did, but it can still be fun. There are exceptions

 

https://news.ycombinator.com/item?id=23219360

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd say it's the nature of the beast. Write your code to suit your desired audience. Write code for script kiddies, then that's what you can expect.

 

It looks like the tone of this thread is going down like a lead Zeppelin. Kinda reminds me of Pulp Fiction where Jules and Vince are discussing dogs vs pigs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ralphd wrote:
What I get from your response is that you are more interested in a straw man argument than a rational discussion
That's the same straw-man distraction you used in your run up to the first time you were banned from this place. 
Kartman wrote:

It looks like the tone of this thread is going down like a lead Zeppelin. Kinda reminds me of Pulp Fiction where Jules and Vince are discussing dogs vs pigs.

I'll make the popcorn...

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The nice thing about about publishing code as Arduino libraries is that the chances of having someone actually USE your code go up tremendously.

A problem is that many of those users won't know what they are doing, and will want you to either explain or fix THEIR problems.  :-(

I recommend:

  1. Document your code extremely thoroughly.  Including what it DOESN'T do.
  2. Encourage a cadre of other knowledgeable people to use, recommend, and support your code.  This is a key difference (IMO) between successful and unsuccessful open source.  An individual, or even a small-to-midsized company, can totally burn themselves out trying to support a popular product.  Unless the community helps!  (consider avr-freaks, or the Arduino forums, or the EAGLE newsgroups.)
  3. Practice restraint.  Even silence.  Better to remain silent and be thought unresponsive than to chew out someone who deserves it and be proven an ...  (I mean, I don't mind  the "issues" of the "Optiboot" repository being conversational even if it means answering or ignoring the occasional stupid questions.  But that's not "required", and I don't even think it's common.  Many repositories treat their issues as "bug reports only.")

 

 

the reason [for open source is] for other software developers [only] to modify/improve the code. 

The line between "developers" and "users" is very thin.  I'm pretty sure that the initial Evangelists of Open Source didn't distinguish to the degree that you apparently would like to.

 

What makes you the authority on the spirit of open-source licenses?

A lot of that is written down.  There's The Gnu Manifesto and The Cathedal and the Bazaar  (which are considered seminal, if relatively extreme, defining points.)  I'm sure there are endless discussions on many forums.  (I was busy and didn't pay attention much.  But I did interact with RMS prior to GNU.  Along with a bunch of the earlier "free software" from DECUS to CPMUG and "shareware" that pre-dated a bunch of the formality...

RMS seems to have thought that you could divide the world into people who would help you write software, and people who would pay you to help them use the software.  Yeah.  (although, putting "hiring" terms on your github and blog pages about how much it would cost for "custom modifications" might scare some people away...)

 

 

I'd still like to make the full source available, but only to other developers.  I'm looking for suggestions on an easy way to do this.

You could put the source on a difficult-to-use and obscure server, accessible only with arcane source management tools (Mercurial?  That seems to have fallen out of favor...)  :-)
Could you post links to some examples of the behavior that you're objecting to?  I mean:

  1. Most of the code I've seen you post is frequently in assembly language, very specialized, very tight, and very thoroughly analyzed.  If you want to restrict access to only people who can improve it, that's going to be a very small number of people.
  2. I took a look at what I figured would be your most popular github repositories and didn't really see many (ok, maybe 1) objectionable "issues."

 

 

One of my first positive experiences with the Arduino community involved someone who had bought an LED matrix display and had no idea how to make it do anything.  I said that I thought I understood it, and "would write code for toys."  they had be shipped a copy of the display, I wrote basic IO and graphics subroutines, and quite a few people took that code and ran with it, producing all sort of neat effects and displays that I really wouldn't have been interested in...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And you are reminding me why I left avrfreaks for a few years.

If I remember well you were banned for a while?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's just math. When you are a good programmer, that necessarily means most other contributors are not as good as you are.

Therefore you will feel they are butchering your code. I have felt that too. So what? That's just the way open source works!

 

Sometimes they have different objectives and steer the code to a direction you may dislike.

You don't approve the changes? They will create a fork. And it may become more popular than the original.

Again, that's just the way it is.

 

And, no matter how good you are, there are always a lot of developers that are as good or better than you, or at least they will be better at some aspects of programming, worse in other ways, and complement your work.

I think open source is worthwhile in the end, because these people will show up eventually and give important contributions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had a brief squint at https://github.com/nerdralph

and it did not look as if you have a large number of Forks.   Nor a large number of Issues.

 

If someone points out a bug in Issues,  the readership will offer solutions.

 

If someone has Forked your project,  they would offer a Pull Request.

It is up to you whether you accept the PR or not.

 

I suspect that you will have two main types of visitors:  the learner and the "obsessive programmer"

 

You politely assist the learner.

You will probably have a personality clash with the other.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I had a brief squint at https://github.com/nerdralph

I tried a different route and looked at activity to get to here: https://github.com/MCUdude/MicroCore who has incorporated Ralph's picoUART into his own MicroCore. He seems to be struggling somewhat but certainly there's nothing there worthy of a rant. I'd say this thread is actually worse.

 

The problem users must lie elsewhere.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://github.com/MCUdude/MicroCore/issues/101

looks like normal interaction between two developers.   With a request from a "user" for parity support.

 

I suspect that Ralph and Hans have knowledge and experience to share.

DominicanMS and gamerPaddy seem to be ask sensible questions politely.

 

Nothing like the "ill tempered message threads" that sometimes appear on Forums.

Nor the "inane questions" that sometimes appear on Forums.

 

You can "Close" an Issue on GitHub.   Only moderators can do that on Forums.

 

David.