
Show HN: RefactorMe – Stackoverflow for Refactoring - marcamillion
https://refactormeplz.com/
======
shanwang
This is interesting, how many languages do you support?

This can be very useful for people learning new language, for example I'm
learning angularjs and javascript, I write a lot of code with them that work
but I'm pretty sure they can be improved a lot by a angular/js expert.

How about a feature to open a bounty and pay real money to people who refactor
the code, and only the refactoror and initiator can see the code?

Also may I ask which editor do you use in the new question form?

~~~
marcamillion
> This is interesting, how many languages do you support?

Well..it depends on what you mean by 'support'. There are two modes. You can
either make your code runnable or not. In terms of the code being runnable, 32
languages. In terms of pretty syntax highlighting, but just static
code....much more than that. If you try to add a question or suggestion, you
will see a dropdown list that contains all the languages. I believe it is
roughly 90+ languages for static, syntax highlighting.

> This can be very useful for people learning new language, for example I'm
> learning angularjs and javascript, I write a lot of code with them that work
> but I'm pretty sure they can be improved a lot by a angular/js expert.

Hrmm...this is a very interesting perspective. I've never quite thought about
it from that angle, but you are right.

> How about a feature to open a bounty and pay real money to people who
> refactor the code, and only the refactoror and initiator can see the code?

So I have thought about implementing the first part, and I probably am going
to facilitate this.

The latter part is interesting, I guess the obvious question would be.....why
would we want to prevent people from seeing the code? Because the code belongs
to a proprietary project or for other privacy reasons? I am not being
facetious, just genuinely trying to dig into this issue fully because I have
gotten similar feedback about making it private.

So assuming we decide to allow a private feature, I guess the obvious question
is...what's private? It would have to be only the refactors, right? Otherwise,
no one will know what to refactor and whether or not they want to bother
trying.

Taken further still, so let's assume that we can settle on a reason and
mechanism to keep it private and allow the refactoror to see it, I would think
that it would be in your best interest to have as many people viewing both
your original post and the refactored suggestions so you can be sure the
refactor that was produced is indeed the best possible refactor for your
desired solution.

I can empathize with the need for privacy and keeping some code proprietary,
but I guess the real question is, is it a safe assumption to make that the
person that does the first refactor does the best job? Or even the person
willing to jump through the hoops to see your refactor, does the best job? I
would figure the only way to know is by making everything open and open to
feedback from the community.

That way, if I submit something to you, someone else can build on my
suggestion and we both get credit. You get the best refactor possible, and we
both get credit and likely both learn.

That's my initial thinking on this stuff, but I am open to hearing other
perspectives for sure.

> Also may I ask which editor do you use in the new question form?

Summernote - [http://summernote.org/](http://summernote.org/) \- it works
beautifully with Bootstrap and Simple Form (if you are using Rails).

~~~
shanwang
I tried to post a refactor request, as a C++ developer I can't help but
noticing C++ is not in the dropdown list :)

> How about a feature to open a bounty and pay real money to people who
> refactor the code, and only the refactoror and initiator can see the code?

Privacy is the trick bit, I guess you are right there's no way to keep code
completely proprietary.

I was thinking from my own experience, I have worked for big companies that
have tons of legacy code that were written in subpar standard, sometimes
developers were asked to refactor a piece of code written in a technology they
are not familiar with. Have a refactor tool like this can serve as a mini
contract to outside developers (or QA in some perspective).

Any reasonable sized company will have some rules regarding proprietary
information, it's very unlikely they'll allow employee to publish company's
code to an open community, so some restrictions need to be applied. However,
if you want to focus on open source projects then none of this matters.

How about create a group, and only people with certain privilege can join, for
example, a "Java Consultant" group that only people with >1000 reputations can
join. On joining this group you also have to agree to extra terms and
conditions, ie. not to disclose code you've seen or use it on your own. And
when you start a refactor request, you can choose only to publish to this
group, and only people in this group can take bounties (or you can choose to
label your code with a particular license to prevent reuse).

It would also help if you can provide a feature that the initiator can force
the refactor to provide a mini document to explain why the refactored code is
better.

~~~
marcamillion
> I tried to post a refactor request, as a C++ developer I can't help but
> noticing C++ is not in the dropdown list :)

It is there...just as "cpp". The "+" would mess with the form & parser input
:|

>I was thinking from my own experience, I have worked for big companies that
have tons of legacy code that were written in subpar standard, sometimes
developers were asked to refactor a piece of code written in a technology they
are not familiar with. Have a refactor tool like this can serve as a mini
contract to outside developers (or QA in some perspective).

Hrmm...this is a very interesting use-case that I never quite thought about.

Perhaps even encouraging companies to increase their employee productivity by
using this marketplace to refactor old code and have them focus on more
valuable tasks.

Very interesting idea.

Your idea about the group is interesting. Not sure if that exact
implementation would work, but I do get where you are going.

I love these thoughts.

Thanks again!

------
marcamillion
For the longest while I have wanted a site that just focused on refactoring,
so I finally just built one and shipped it. A bit light on content right now,
but you should get the idea.

~~~
pkroll
Could be great. Couple things some obvious I'd guess:

Can run the code... but, not the tests, which would make in-place refactors
considerably easier.

Clicking Gear for settings doesn't go back to edit window when you're done and
you click the Gear again, which is how I first tried to get back to the
editor.

No place to set "license" specifically for each piece (and maybe a default in
your account settings) making it impossible to take the code and use it
without opening Pandora's box.

So little there, and all six days ago... you could grab examples from open
source projects and put them in, if you could do that while obeying the
license on the code (which comes back to at least showing the license, and
maybe also linking to the URL for that piece of code or project).

As this is ultimately "one piece of code with several examples of another
piece of code to replace it" despite it being for refactoring, you can imagine
it'll be used for "this was a bug, this is the fixed version." Might be useful
to provide specific support for that somewhere down the line.

~~~
marcamillion
> Can run the code... but, not the tests, which would make in-place refactors
> considerably easier.

That's definitely something that I would love to implement in the future - if
I can find a way to make it viable. This was just v1 to see if there is even a
path that makes sense.

>Clicking Gear for settings doesn't go back to edit window when you're done
and you click the Gear again, which is how I first tried to get back to the
editor.

Yeh, I am using the API for Glot.io -- which provides no way to customize that
iFrame. So I am stuck with that functionality for now.

>No place to set "license" specifically for each piece (and maybe a default in
your account settings) making it impossible to take the code and use it
without opening Pandora's box.

Ohh...this is interesting. Never considered the 'license' bit. Is that really
an issue though? You can't add a license on SO, and that doesn't seem to stop
people from pasting code snippets.

>So little there, and all six days ago... you could grab examples from open
source projects and put them in, if you could do that while obeying the
license on the code (which comes back to at least showing the license, and
maybe also linking to the URL for that piece of code or project).

I agree fully, and it seems like it should be pretty easy to do from OSS
projects, eh? The issue I ran into was identifying what snippets of code
really needed to be refactored and why. That's the counter-intuitive bit, in
order to be able to explain why something needs refactoring you have to fully
understand what it does.

I can most certainly do that for some Ruby code (where most of my experience
lies), but once we get into other languages I am kind of outside of my depth
(to be frank).

So another alternative is to simply search GH Issues for the term "please
refactor me". I tried that too, and most of the immediate stuff I found are
usually too old or too basic.

That being said, if you have any suggestions on specific bits of code from OSS
projects you have used that you have seen that could be a good candidate
please feel free to share them.

I am definitely going to be looking myself too. It's just not as 'slam dunk'
as it appears at first thought.

>As this is ultimately "one piece of code with several examples of another
piece of code to replace it" despite it being for refactoring, you can imagine
it'll be used for "this was a bug, this is the fixed version." Might be useful
to provide specific support for that somewhere down the line.

This is very interesting and I would love to hear more about what you are
thinking. Do you mean like someone would post a snippet of code that has a bug
and ask for the community to fix it? Then the site would track the various
iterations and show the final version? If so, that does sound intriguing and
is inline with some other ideas I have.

If not, I would love to hear what you meant or just some more thoughts on
potential future direction.

That being said, thanks for even taking the time to give me such a thoughtful
response. I really appreciate it.

~~~
pkroll
You're welcome: thanks for making the thing in the first place. :)

I don't think people have trouble posting snippets to Stack Overflow and the
like, but I do think people have trouble (now or later) USING the snippets
posted. Some discussion of the issues at [1].

Still only a few items there. Honestly, for a refactoring site? I'd suggest
the things to add would be: all the classic refactorings, for any language
you're familiar with.

The problem with searching Github for examples is they apparently took out
commit-message search a few years back, so you can't search for "refactored"
in the commits... just the Issues, which are going to be fewer and less
useful.

Tried searching Google for "github example refactor" and that shows up several
projects. They won't be as "in the wild" as a good refactoring, but they're
probably a reasonable place to start.

[1] [http://meta.stackexchange.com/questions/12527/do-i-have-
to-w...](http://meta.stackexchange.com/questions/12527/do-i-have-to-worry-
about-copyright-issues-for-code-posted-on-stack-overflow)

------
marcamillion
By the way, I would love a suggestion with finding content to beef it up a
bit.

I know GH is a huge source of OSS code, but how do I (easily & quickly) find
code I can use that could be a good candidate to be refactored?

Ideally, it would be good if the code didn't have too many dependencies or it
would be easily understandable so I can explain what the goal is for the
refactor.

I tried just searching GH for the phrase "please refactor me", but that turned
up a lot of old code and crap...basically.

I would love to be able to go through some of the large OSS projects (Rails,
jQuery, any other large ones) and quickly find code that needs to be
refactored and preferably have an explanation.

Anyone have any suggestions for how I might be able to do that without
actually fully understanding the code snippet I am referencing?

Edit: Hat Tip to pkroll for also confirming that this should be a viable
strategy to get content in his comment on this thread.

------
firebase
Looks really great.. However I'd recommend putting a "Learn more" button, that
describes the goal(s) of the platform. For example what can people post and
what they cannot. I really would like to use this service but I'd also want it
be clean and specific, so I know what to expect here.

~~~
marcamillion
Great idea. The truth of the matter though is, I don't really want to make it
too restrictive.

I would love to see what people use it for and then we can kinda pivot from
there.

The general purpose is, do you have some code that you think could do with
some loving, post it and let's see if we can get the community to refactor it.

If enough people start using it for other things, then I would definitely
shift in that direction if that's where the usage is taking me.

------
Rainymood
The name (especially the 'plz') might be off-putting for some people (i.e.
me). A future idea may be to refactor your name (heh).

Best of luck, I hope it takes off!

~~~
marcamillion
Yeh the domain name 'refactorme.com' was taken, so I had to look for an
alternative.

My wife suggested the 'plz' and while it wasn't perfect it was much better
than the others I thought about...so in the spirit of shipping something, I
ran with it :)

------
claymullis
Outstanding. Hope it takes off.

~~~
marcamillion
Thanks! :)

------
bjourne
Looks pretty good!

~~~
marcamillion
Thanks much :)

