11
\$\begingroup\$

I'm coding the MELT monitor on github (GPLv3+ licensed free software, alpha stage). Ultimately most of the code I am coding manually now should be replaced by generated code.

It is my first "Web" application (so I do feel like a newbie regarding Web technologies, but I am learning them) and it is quite specific:

  • it is mixed C & HTML5/Javascript for Linux/Firefox (recent versions only)
  • it is not a general purpose web application: the future audience would be at most a team of a dozen of developers; hence I'll never have thousand of HTTP connections, but a few dozen of them
  • it will become a bootstrapped "domain specific" language (compiled to C on the server side, and to Javascript+HTML5=Jquery on the client side) which I have not even completely designed yet... (a bit like M.Serrano HOP v2 which was a Scheme dialect compiled to C on server side, and Javascript on browser side)
  • it is some throw away code, because the overall goal is to design some domain specific language which would be translated to both C code (server side) and Javascript code (browser); I am still in the pre-bootstrap phase, and I want as soon as possible to generate automatically some code "equivalent" to the dirty code I am hand-writing today
  • it is "quick"* and dirty code; I don't care about readability or coding style, and I don't care a lot about performance
  • it should become a bootstrapped system (but I am not there yet).
  • I need much more feedback on design issues than on the actual throw away source code
  • I need to learn what kind of (Javascript & C) code I will later generate in place of this messy code.

Perhaps my question might be generalized to:

"can generated code be reviewed here?"

of course, to improve the generating code...


Since this is bootstrapped throw away code, I guess that asking for code review might be inappropriate... (my intuition would be that taking code reviewer's time for throw-away code is not very polite). However, I would strongly appreciate feedback about design (on the browser side, since I am quite newbie on that).

BTW, even after bootstrapping, all that thing would still be GPLv3+ free software (like my GCC MELT already is)


Note *: not so quickly written code actually because I am still learning HTML5+Javascript+DOM+Jquery in the process

\$\endgroup\$
5
  • \$\begingroup\$ I don't think this is a duplicate, but this is where we stand on generated code. \$\endgroup\$
    – Peilonrayz Mod
    Commented Feb 9, 2016 at 13:56
  • \$\begingroup\$ @JoeWallis: Indeed, the metaquestion about generated code is relevant, but it looks that it has no broad consensus... \$\endgroup\$ Commented Feb 9, 2016 at 14:00
  • \$\begingroup\$ Do you generate the code? \$\endgroup\$
    – Quill
    Commented Feb 9, 2016 at 14:04
  • \$\begingroup\$ Not yet, I am not bootstrapping yet ... \$\endgroup\$ Commented Feb 9, 2016 at 14:10
  • 1
    \$\begingroup\$ We can review the generator (look here, here and here). We can even review generated code, but not everybody agrees on that. When in doubt you could always decide not to tell the code is generated. Which is usually true, since you often write the code before you generate it's duplicate. \$\endgroup\$
    – Mast Mod
    Commented Feb 9, 2016 at 15:52

2 Answers 2

6
\$\begingroup\$

I think it'd be on-topic.

To go through your points, bluntly and as a silly, silly, teenager:

  • [on-topic] It's real code.

  • [misc] It's general purpose.

  • [misc] It's not yet bootstrapped, no code generation to worry about (yet).

  • [misc] It's 'throw-away code'.

  • [off-topic] People will pester you about readability and coding style.

  • [misc] You want to bootstrap it.

  • [on-topic] You want a design review

  • [on-topic] You want to write a generator question.

I don't see a reason it'd be off-topic to the point of closing. But you'll get told stuff you may not want to be told, 'FIX YOUR VARIABLES, ugghh'.

Whilst you think it may be impolite to ask for a code review of 'throw-away code', you may pick up some solid design, and pass that onto the bootstrapped version.
I've reviewed small challenges, that people have completed, and are unlikely to ever look at again. Do I dislike that? No, infact I can tell someone some good design, and if they use it in their next question I will be happy.

GPLv3+ licence compatibility I know nothing about.

I don't fully understand your generated code bit, but writing your own language is on-topic. And so writing a bootstrapped (compiler) is on-topic.

You also say you want to change your C/JavaScript to this new language. The new code will be on-topic as you have a compiler for it.
Doing a standard code-review of the output from this new language and generator however is off-topic. But asking about the output can be on-topic:

So, realistically, what should be reviewed, is a sample of what the generator might produce.

- nhgrif
or

I could ask about the naming of the grammar rules (which is crucial here); I could ask about redundant or convoluted ways to achieve what the grammar is doing and whether/how that could be improved.

- Mat's Mug

And what seems to be your last concern, having an entire project reviewed is on-topic too, even if it's multi-language.


I'd say your main concern is the zombie rating you'll rack up on your questions. And the possibility that it may get no answers.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ "It's 'throw-away code'." seems to clash with "_Do I want the code to be good code? _" (from the Help Center) \$\endgroup\$
    – Nic
    Commented Feb 16, 2016 at 1:16
  • \$\begingroup\$ @QPaysTaxes I'm of the thought that this question is an overcomplicated and question(s) specific version of 'Reviewing “design”'. I'm also of the thought that OP calling it 'throw-away code' is to emphasis the want of a design review, and to emphasise that language specific changes would be mostly redundant to the high-level design. (I.e using a B-tree not a Binary Tree.) \$\endgroup\$
    – Peilonrayz Mod
    Commented Feb 16, 2016 at 7:49
4
\$\begingroup\$

You state the following:

I don't care about readability or coding style, and I don't care a lot about performance

And this I believe is were a lot of coders get it wrong. Not caring about readability and coding style (and somewhat performance) is dangerous as these are helpful tools to make sure that your code does what it is actually supposed to do and helps avoid bugs.

If people cared more about readability and coding style, I think there would be a lot less errors and flaws in programs all around.

So is worthwhile to get a review of generated code? Yes, and you should take care and pride in generating good code, because if you don't you'll most likely end up with code which fails every now and then, and which would be very hard to debug.

If your building blocks are good and clean code, the end result would most likely be good, clean and solid code. If you don't care about the building blocks, it's like building on sand which might seem to do the job, but when the storm comes the building will fall down!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Further reinforcing this: If it's not worth your time to make it good, it's probably not worth my time to tell you how to do so. \$\endgroup\$
    – Edward
    Commented Feb 17, 2016 at 14:29

You must log in to answer this question.

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