4
\$\begingroup\$

Would it be OK to ask a question about code review on something that strictly-speaking is not code as such, as far as most users are concerned? But the underpinnings are such that the problem is in fact code and could be constructed as such?

To be a bit more concrete in this case, the "code" is a parametric 3D CAD model, which has all the attributes of code. Things are referenced from elsewhere and you need to think about maintenance of such things. It would be relatively easy to express the drawing as abstract code.

The thing is I'm trying to come up with a list of things that programmers know intuitively and through experience that does not filter well to most mechanical engineers. The challenges of maintaining the models are still strictly-speaking the same as writing code. So I would know what is good encapsulation when DRY is violated etc.

What I am trying to get eventually is a way evaluate the CAD drawing practices in a context of what is known by programmers about code layout. This way I can construct better guidelines for making and maintaining CAD models in the first place.

Obviously this would be a lot of work on my part but still possibly an interesting and fruitful review.

\$\endgroup\$
  • 1
    \$\begingroup\$ We review code. If there's no code, we can't review it. Perhaps Engineering wants to consider it? \$\endgroup\$ – Mast May 22 '16 at 12:36
  • \$\begingroup\$ @Mast i just said there is code, its just in no language you ever heard about. Asking engineering would be pointless since i m not interested in what engineers have to say. \$\endgroup\$ – joojaa May 22 '16 at 12:43
  • \$\begingroup\$ I'm quite familiar with CAD models. What language are you talking about? Do you consider STL a language? \$\endgroup\$ – Mast May 22 '16 at 12:49
  • \$\begingroup\$ No im not interested in formats. STL is not a CAD format as such (something like STEP AP203 is but thats way too complicated for your average programmer). @Mast The model tree is a piece of code in a otherwise graphical programming language, i can can access the underpinnings of the CAD model as code. OR i can simplify the functions of use the graphical evaluation graph for review. \$\endgroup\$ – joojaa May 22 '16 at 12:52
  • \$\begingroup\$ Graphical languages have been accepted in the past. I'm aware STL is not a language, but some mistakenly believe it is (blame backronyms). It sounds like an interesting problem, but all questions on Code Review need a language tag. Considering things that aren't widely considered a language a language anyway could work, but you'll need a good specification. And a name. cad-language is not going to cut it. \$\endgroup\$ – Mast May 22 '16 at 12:57
  • \$\begingroup\$ @Mast Well i could use STEP as a language i suppose , tough its not a programming language as such. Be aware that it is the biggest ISO standard ever written, makes SGML look like a walk in the park and im not sure how it would help. As it wouldn't further my goals. More likely i'd just use tha specific cad applications name a s a language. \$\endgroup\$ – joojaa May 22 '16 at 13:04
  • \$\begingroup\$ I have no exeperience with CAD, so I could be wrong, but I doubt this could be turned into an On-Topic CR question. Code does not have to be textual, but it must be code that accomplishes some task. My impression of CAD is that it is more of a design file (similar in concept to, say, a database schema), which would not be an On-Topic review in and of itself. \$\endgroup\$ – Kaz May 22 '16 at 13:28
  • 2
    \$\begingroup\$ @Zak yes that is what CAD applications were in 1960-1970s modern CAD files accomplish quite much more. So for example you cold describe in one cad file a family of flanges and then ask the CAD to output a flange with specified dimensions and the computer would calculate the secondary dimensions for you because the design is actually actionable code that the engineers programmed into the model. Its just taking quite long for people to realize this fact. Mechanical engineers havent actually drawn anything for years the computer outputs the model as a result of our programm \$\endgroup\$ – joojaa May 22 '16 at 13:38
  • 1
    \$\begingroup\$ Awesome. Well hey, if you can frame a CR question in that format: "Here's a CAD (insert equivalent of "code/program/system") that achieves X. How could it be Written/Designed/Organised better?" feel free to post it and we'll see what the community thinks. \$\endgroup\$ – Kaz May 22 '16 at 13:43
  • \$\begingroup\$ This is probably going to be one of those "I can't define it, but I know it when I see it" things. \$\endgroup\$ – Kaz May 22 '16 at 13:44
  • 2
    \$\begingroup\$ I'd recommend to post it, add a note or comment on your question that you are not sure whether or not it is on-topic and link to this meta post. I think it is possible that it will be accepted by the community. Go for it and we'll see what happens. \$\endgroup\$ – Simon Forsberg May 22 '16 at 18:37
  • \$\begingroup\$ You don't seem to be asking if such a review would be on topic for this site, but whether or not it would be possible to do "in the real world". Such a discussion isn't on topic on the main site or meta. \$\endgroup\$ – RubberDuck May 25 '16 at 12:48
3
\$\begingroup\$

May I save you the roundtrip to engineering?

Sure, if you have specific questions on how to do something in a certain CAD program, engineering is the place to ask your question.

However, it looks more like you want to have some algorithm or workflow evaluated. If you posted your question on engineering.se including those lines:

But the underpinnings are such that the problem is in fact code and could be constructed as such?

maintaining the models [...] the same as writing code.

This way I can construct better guidelines for making and maintaining CAD models in the first place.

My answer would be: Create the code to do exactly that.

Writing a program is a really good way to express an algorithm. Even better: a program can be executed.

A lot of CAD programs offer an API. SolidWorks for example allows you to do pretty much everything that you can do with the design tools to do programatically in various languages. Check the CAD tool you are using. I'm sure there's something available, too.

This code can then be reviewed just like any other code. And this is what would likely bring you back to this site, because as you say and I experienced myself: mechanical engineers are often not well trained programmers.

It's hard to find a place in the StackExchange network for questions that involve many fields. A CAD program often involves mechanical engineering, with additional things like fluid or thermo dynamics from physics, material science from chemistry, electrical engineering, etc.

If you exclude the "why" from your questions and expressed it in code, it becomes possible to talk about the "how" you did it and possible improvements. The positive side effect is that you have executable code.

\$\endgroup\$
  • \$\begingroup\$ I know this. Its just that I am positing that a CAD design is code its just a graphical user interface. Therefore all that applies to code is applicable for a CAD use on a higher level than just getting drawings out of stuff (which is done but largely waste of money). I know CAD programs have an API, I've programmed in most of the API's as well as low level CAD kernels for years. What I need is programmers who do not understand anything about CAD take a look at the problems. Mechanical engineer wont do because its not really the job of 99% of then to think about these things, so they wont do. \$\endgroup\$ – joojaa May 29 '16 at 18:59
  • \$\begingroup\$ I'm sure you do, but looking at the comments you received, other users around here do not, hence my longer explanation. "a CAD design is code its just a graphical user interface." not if you post the equivalent code to do it. If you want programmers to review it, you need code and the APIs give you exactly that. \$\endgroup\$ – I'll add comments tomorrow May 29 '16 at 19:33
  • \$\begingroup\$ I tried that but API's of the cad programs are either 1) too convoluted if high level 2) too low level. They do not really give the picture of how the code is organized in the CAD many times because the back end and front end have deviated too much form each other. I was thinking that something like opencascade has a api that is much closer to a front end as it has no such thing. So the code has to match usability better. \$\endgroup\$ – joojaa May 29 '16 at 19:46
  • \$\begingroup\$ Why would the code have to match usability? As I said, the advantage of having code is that you can execute it. I don't see a point in telling people to do what a program does "by hand", if that's what you mean by usability. \$\endgroup\$ – I'll add comments tomorrow May 29 '16 at 19:58
  • \$\begingroup\$ Because then you will be giving me advice on how to organize things that user can not organize. I suppose even yuo write code by hand. Point is that the CAD user interface is a different form the API that it would count as another API since thats what it is, i write loops expressions and constraints solvers in the GUI. Its a bit like asking how to write better C by showing assembly. \$\endgroup\$ – joojaa May 29 '16 at 20:02
  • \$\begingroup\$ But I do not execute it by hand. The point of having it in code is to be able to execute it in an automated fashion. The user shouldn't organize anything. Either way, the bottom line is: if you can formulate it as real executable code, it's likely to be better received on this site. Try your luck. You can always delete the question if it goes wrong. \$\endgroup\$ – I'll add comments tomorrow May 29 '16 at 20:10
  • \$\begingroup\$ Neither do i execute the CAD program by hand, the purpose of having a cad is to do it in a automated fashion. The cad software is just a weird graphical ide. Im not saying that code isnt fine but the API of most CADs by their nature is unsuirable to tackle the issue. \$\endgroup\$ – joojaa May 29 '16 at 20:28
1
\$\begingroup\$

To me, the relevant abstractions are dependency management, naming and declarative programming languages. Framed as the application of abstractions the question might work on the Programmers site. My observation is it handles conceptual discussions pretty well.

On the other hand, database management is another way of abstracting over CAD -- it deals with documents after all -- and the standards fall out as schema design and data validation techniques.

\$\endgroup\$
  • \$\begingroup\$ Yes i was thinking about programmers because of feedback here. \$\endgroup\$ – joojaa May 30 '16 at 4:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .