Hacker Newsnew | past | comments | ask | show | jobs | submit | realSlavojTrump's commentslogin

Give refactoring this code a go! Its sublimely fun!!!


As mindfulgeek mentions, doing some sort of extract method refactor to slop a name onto it can be a good first step. Then do some sleuthing thru other number name pairings, inserting names in place of the numbers, until you have a solid grasp of what the names should actually be. Feathers in Working Effectively With Legacy Code brings up a concept called seams... u can insert a seam to map to objects and then do object manipulations with polymorphism.

Iirc that particular bit of code is the power logic. You can file an issue on my fork if ys like me to write more on this when im not on a broken phone.


https://github.com/polytomous/TerrariaClone/issues/6 gives an example of how i work thru this sort of question, but its also spoiler laden so view at your own risk.


I think i had a polytomous account on the orange site, but forgot the creds. This is what i settled on in the interim. I dont put on a character, if my acting theory is anything its a derivation of neofuturism.


>If I can indulge in some self-promotion, I have written mountains of code which implements many of Minecraft's behaviors down to the last detail, which may be a more interesting candidate for study

It is an interesting case study. The code has failed to run for myself and the five other people i handed the project to with different configs. There are no tests that validate the project works. Its certainly work to be proud of, insofar as maybe its worked for some subset of people in the past.

Edit: I was excited to work on this code and spent a healthy amount of time reading through all of it to find great places to contribute. After writing a small pr, mostly a throwaway to test the waters, I was greeted with unmitigated assholery by the main devoper and their irc crew. I kept the logs from an irc conversation i had about the pr as a reminder of how not to act towards developers on projects i work on.


Well, the code has been unmaintained for some time now, and only grows more stale (especially considering the .NET ecosystem has been in turmoil during that time).

There are tests, though, but they only focus on the parts which are fragile or complicated:

https://github.com/SirCmpwn/TrueCraft/tree/master/TrueCraft....

Edit: oh, I think I remember you. If I'm right, here's your pull request and the corresponding IRC logs:

https://github.com/SirCmpwn/TrueCraft/pull/283

https://sr.ht/4tKr.log


If there are tests and the project can still fail to run, is the test suite really good?

Blatant and rude sarcasm: you dont need to answer because a freshman cs student would know the answer.


This is most certainly an area that needs improvement.

You can get around some of the pain of haning error types in catch statements if you are comfortable paying the price for a locally defined function:

result = try Something() catch err h!(e)=throw(e) h!(e::MethodError) = SomethingElse() h!(err) end

This pattern works well if an error case should return a default value and all others should throw.


The easiest way to "teach" programming right now is to watch beginners programming on twitch and offer advice when you can. Trying to pair remotely through chat also imrpoves your pair programming skills.

Of course you could just write blog posts instead Kappa


There's evidence in the literature that shows that there are systemic biases against women in github pull requests, even when in the aggregate women may display greater levels of competence. https://peerj.com/articles/cs-111/

To suggest that pull requests are a good hiring signal (as the author does in explicitly endorsing the "screening" of open source maintainers) ignores this bias. That can be positive or negative, depending on your commitment to diversity in our field.


For those who haven't read the linked article before, it really is fascinating.

The relevant bits are two factors:

* Is the person sending the pull request someone already known to the project, or an outsider?

* Is the gender of the pull request's author easily determinable?

It would be unsurprising to find that "outsider" pull requests get merged at a lower rate. But "outsider" pull requests from women merge at different rates depending on the second factor: when it's easy to determine the gender of the author, a pull request from an "outsider" woman is significantly less likely to be accepted than a pull request from an "outsider" woman whose gender cannot easily be determined. Also, "insider" women and women whose gender is not easily determinable have higher rates of merged PRs than their male counterparts.

There's no reason to suspect that whether someone's gender is easily determinable by a PR reviewer (usually, via username, profile picture, other clues like linked blogs or social-media profiles) has an effect on the quality of their code. So while this of course doesn't prove gender bias (we'd need telepathy for that), it does very very very strongly suggest it.

This is also in line with a lot of prior research and reporting on blind interview and auditioning practices, so shouldn't be too surprising, but for some reason people love to insist that tech is somehow different from all those other fields where hiding someone's gender changed how they were evaluated.


> systemic biases against women in github pull requests

Did you read your link?

> The hypothesis is not only false, but it is in the opposite direction than expected; women tend to have their pull requests accepted at a higher rate than men! This difference is statistically significant


... unless they can be easily identified as women from their profile, at which point their acceptance rate drops.


The acceptance rate of both men and women dropped if they were identifiable as men or women. The study doesn't make any attempts to explain this.


Yes, and the one of women drops below the one of men, and that's clearly what the initial reference to the paper was talking about.


But only in the case of 'outsiders'. In the case of 'insiders' the acceptance rate of men drops more than that of women when their gender is known (no p-value provided so hard to tell if statistically significant).


A person trying to use github as a hiring signal is going to be an outsider at some point.


Did you read the abstract?


I enjoyed the first edition immensely. Some folks are calling out that most of the refactorings are mainstream, but IDE integration doesn’t mean that it has become common practice or second nature to most engineers.

If I was going to read a refactoring book while waiting for the second edition, I would take a look at “Refactoring to patterns.” (https://industriallogic.com/xp/refactoring/) R2P combines the best parts of Fowler’s Refactoring and the Gang of Four design pattern book.

Notably: it emphasizes the fluid nature of Refactoring and design patterns. Every Refactoring to a pattern in the book is shown in a few different ways, each explaining some of the trade offs. It has the same recipe book feel that Fowler’s book has and it lends itself to browsing and reference.

The recipe-driven approach makes it easy to carry out the refactorings and provides a fun new way to think about modifying code.

Imho, the section on the “Compose method” Refactoring in R2P makes the purchase worth it. How can such a dead simple Refactoring make code so much nicer? Read the book to find out ;)


Watching live coding can be almost as fun as live coding itself.

I view every livestream I watch as a one sided code review and refactoring session, and spend most of the time watching reasoning through how they are coding and if there are things that could be clearer. I learn lots from that... including new idioms that I like or despise.

I’ll also watch streams where the coder needs help, so I’ll pitch in over chat to help with problems. I’ve taught several people suprising amounts through twitch chat and despite twitch delay.

Just try watching a stream or two! Check the creative communities on twitch and select programming or game development!


Id read this article, it has pretty excellent coverage of what you’ll need to know.

https://medium.freecodecamp.org/lessons-from-my-first-year-o...

The things that I’ve settled into when streaming that I tack onto that wisdom: -stream for at least 2-3 hours per session

-always double check your mic, I forget to unmute.

-downmix your mic to ensure you’re heard evenly

-noise gate and noise suppression are a must

-run obs on your pc but stream all of the code itself from vms. This solves most privacy problems and spares a lot of the common obs-on-screen issues you’ll see during streams. Also makes it easier to transition

-MAKE YOUR FONT BIGGER

-pay attention to chat! I’ve got 1440p monitors, so I keep my 1080p vm on the main screen and my chat / todo list stays on that as well

-set up notifications with stream labs (they’re fun and make people follow in cascades)

-pick reasonable stream titles. I’ve lost pretty much all of my viewers one stream due to a bad title

-consistency is king

-if you’re expecting undesirables, aggressively configure nightbot. Defaults and twitches built in mods will not be sufficient and white Supremecists will get around those settings easily.

I haven’t chosen to do a webcam but I know streamers can pull high enough views without them, so it’s just up to you and how consistent you want to be. I can share more of my experience if you like.

Twitch coding is the best and it prepares you for pair programming and whiteboard interviews where you have to talk while thinking through a problem.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: