discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Avoiding Union (use a module instead)

I
irevdev
Sun, Mar 28, 2021 8:24 PM

I often find myself thinking about OpenSCAD best practises and programming
best practises, and one idea I've been thinking about recently is whenever
there's a situation where I'd use union I instead use it as a reminder to
instead make it a module as an opportunity to name and describe what that
bit of code is doing.

I think OpenSCAD should be made up of lots of small modules in the same way
that small functions is a best practise for programming.

Thoughts?

--
Sent from: http://forum.openscad.org/

I often find myself thinking about OpenSCAD best practises and programming best practises, and one idea I've been thinking about recently is whenever there's a situation where I'd use union I instead use it as a reminder to instead make it a module as an opportunity to name and describe what that bit of code is doing. I think OpenSCAD should be made up of lots of small modules in the same way that small functions is a best practise for programming. Thoughts? -- Sent from: http://forum.openscad.org/
J
jon
Sun, Mar 28, 2021 8:46 PM

Many minor union()s are of obscure parts that would be incredibly
difficult to name as a module().  I use module()s when I can name them
easily and clearly.  The remaining code is commented but not named as a
module().

On 3/28/2021 4:24 PM, irevdev via Discuss wrote:

I often find myself thinking about OpenSCAD best practises and
programming best practises, and one idea I've been thinking about
recently is whenever there's a situation where I'd use union I instead
use it as a reminder to instead make it a module as an opportunity to
name and describe what that bit of code is doing.

I think OpenSCAD should be made up of lots of small modules in the
same way that small functions is a best practise for programming.

Thoughts?

Sent from the OpenSCAD mailing list archive
http://forum.openscad.org/ at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Many minor union()s are of obscure parts that would be incredibly difficult to name as a module().  I use module()s when I can name them easily and clearly.  The remaining code is commented but not named as a module(). On 3/28/2021 4:24 PM, irevdev via Discuss wrote: > I often find myself thinking about OpenSCAD best practises and > programming best practises, and one idea I've been thinking about > recently is whenever there's a situation where I'd use union I instead > use it as a reminder to instead make it a module as an opportunity to > name and describe what that bit of code is doing. > > I think OpenSCAD should be made up of lots of small modules in the > same way that small functions is a best practise for programming. > > Thoughts? > ------------------------------------------------------------------------ > Sent from the OpenSCAD mailing list archive > <http://forum.openscad.org/> at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
I
irevdev
Sun, Mar 28, 2021 8:54 PM

To push back, the fact that they are obscure is all the more reason to name
them, because they'll be difficult to figure out what they do, if you come
back to the code in a couple months.

Yes it can be difficult but it like that expression "there are only two
difficult things in programming, recursion and naming things". Difficult but
worth doing if you want to make the code more readable. There's nothing
wrong with long descriptive names.

--
Sent from: http://forum.openscad.org/

To push back, the fact that they are obscure is all the more reason to name them, because they'll be difficult to figure out what they do, if you come back to the code in a couple months. Yes it can be difficult but it like that expression "there are only two difficult things in programming, recursion and naming things". Difficult but worth doing if you want to make the code more readable. There's nothing wrong with long descriptive names. -- Sent from: http://forum.openscad.org/