hacker news with inline top comments    .. more ..    22 Jan 2016 Ask
home   ask   best   3 years ago   
What is your hourly rate (Ror, Europe)?
9 points by rubyeuams   ago   2 comments top
danielfoster437 12 hours ago 1 reply      
I am not a developer, but have worked with many freelancers. I would abandon the 50/hour projects and use that time to find more 110/hour projects.

There is no set rule for pricing your services as a freelancer, only what you can convince the client to pay. Don't be afraid to over-reach and miss out on a few deals.

Ask HN: How do I become a better web designer?
3 points by heyimwill   ago   6 comments top 2
JeffreyKaine 7 hours ago 1 reply      
This is going to seem overly simplistic, but... Practice!

1) Find designs that you love, copy them pixel for pixel

2) Start mixing and matching elements from different interfaces that you find.

3) You'll start to see repeated patterns, get good at connecting these patterns together into new interfaces.

4) After a while of this, you'll see that you don't need to do as much research and direct copying anymore.

5) Congrats! You are a junior designer, keep practicing :)

Someone1234 7 hours ago 1 reply      
Good artists steal. I know most things I have worked on we've taken different visual concepts from various sites and then incorporate them. The key is to steal IDEAS not actual content, and ideally merging different good ideas to create an original feel. After that you just utilise the feedback loop to polish what you have into something that the majority of your users like.

After you've done the above a handful of times you start to get a gut feeling for things which you should listen to as it will often be more right than more wrong.

TL;DR: Light theft and practice.

Ask HN: How do you talk to customers?
13 points by magic_man   ago   7 comments top 5
danielfoster437 12 hours ago 0 replies      
My company has been able to reach our target customers just by asking-- in a human way. Be nice, listen to your customers' needs, go out of their way to help them and if your solution solves a major problem, they will connect you to other customers. And it's ok to say you're a young company that needs help-- people like helping.

All you have to do is ask.

The same goes for cold calls-- be genuine.

JSeymourATL 11 hours ago 0 replies      
> How do you go about getting to those customers...

There are 100s of ways of getting customers. It starts by understanding WHO exactly your target customers are-- and knowing what their world looks like.

Here's the best book on targeting, planning & executing a solid sales strategy-- Mike Weinberg's New Sales, Simplified > http://www.goodreads.com/book/show/15863998-new-sales-simpli...

kom107 13 hours ago 1 reply      
As someone with 10+ years of mad success in sales/marketing/hacking growth, from my own startup to Fortune 500 level in several verticals, here's what you have to do:

1. Yeah, sometimes you just gotta cold call. Even better, show up. Ever watch the original Wall Street? Bud Fox calls Gekko every damn day. To get in front of your very first customers, you need to be doing this too. Go to where your ideal customers are and start talking with them (tangentially) about your product.

2. MAJOR CAVEAT: This first conversation should NOT be about you, product features, design, how much VC you've landed (or want to land). No 'push notifications' here guys. You should be listening to your customer, asking them about what problems you THINK they have that you THINK your product will solve. If it's not the type of product to obviously solve a problem (maybe you've not figured out what problem it solves or it's something that's more for fun), let the customer play with it and ask the customer high-value questions while they use it.

3. Here's the secret to successful sales in one sentence: it's not at ALL about you or the product. Remember that, listen, and your customers will start giving clues away about how to sell to them. If you get good at asking the right questions, it's like calling the Nintendo cheat hotline back in the day: the wins come really easily once someone tells you how to do it (I'd like to publicly apologize to my parents for the 1998 phone bill right now).

4. Always, always, always track the conversations. Every one. Even that 2 second one getting coffee this morning. Look for patterns (what worked, what didn't, similarities between cohorts at different stages in the buying cycle, what questions you asked that elicited the most helpful responses, etc). As Paul Graham says, to get your first users, you have to do things that don't scale. However, assuming you do this successfully, you'll need to rapidly build systems that do scale, so doing this extra work now will pay off like mad. Moreover, these conversations should help you find opportunities for the next iterations of your product. In the book Traction, the authors talk about doing sales and product iteration concurrently, and they're 100% right. If you do one without the other, you're going to struggle.

5. BE where your customers are. Remember when you had the hots for someone in high school? What would you do? Everyone, and I mean everyone, tries to put themselves near where this person is--maybe you sit nearby in class, or try to pass them in the hall, whatever. Same stuff with landing customers. Pretend like they're your crush, find out everything you can about their industry, their job (what they REALLY do and worry about, not just their title and organization), maybe some things they enjoy. It's okay to be a little creepy when prepping and strategizing sales--more info is better, because it helps you develop a more holistic picture of your ideal customer, and that narrows down the channels you should try to succeed. Just don't be obvious about your prep. Remember: the will to win is important, but the will to prepare is vital.

6. Sales come from emotion. One of the biggest problems I see when engineers sell is that they use language that makes sense to them and is technically correct, but makes the customers feel stupid. Metadata to you is a 'wikipedia for your most important software' to the lay person. Make sure you emphasize the BENEFITS to the potential customer--they don't actually care about the feature. If you have a sciences background, you will probably screw this up. That's okay, just keep working at it--if you are cognizant of this and work to correct it, you'll be doing sales like the sales pros in short order.

This is definitely not inclusive, and each bullet point deserves its own book, but in my experience, they'll deliver the most value for where you are at now. Write letters, send emails, show up early and late, go to where they are, and keep the conversations about THEM. Sales are based on trust and likability (and it helps, but isn't necessary, to have a best-in-class product). You can do it.

It's funny you ask this, because I'm trying to find a job leading sales/marketing/growth at a startup company (Series A or after) right now (started applying hard yesterday). Email me and I'll do a no-fee consult (email's in my profile); if anyone else in the community has questions, feel free to reach out as well. Even if you're not in my target company demographic, I believe in good karma. Good luck guys.

tmaly 12 hours ago 0 replies      
I used the write up on customer development interviews in the Running Lean book as a starting point. As another person stated below, its all about listening.
jasdeepsingh 14 hours ago 0 replies      
Would love to see some responses here from the HN community.
Ask HN: I've got one user. What's the best way to get more?
62 points by griffinmb   ago   58 comments top 20
nchudleigh 2 days ago 2 replies      
Product Hunt is a great (and free) place to start

Personal Networks, writing blog posts about what you've learned, interact with people (genuinely) on twitter (and obviously link your project in your account), Reddit is also good. With any of these respect the community and don't spam them (you don't seem the type given your post here, thought I would mention anyways)

If its technical and you know where the people are who benefit go and interact with them. Help them with something they need help with. Then get them to try it, find issues, fix 'em, rinse repeat.

It takes a lot of footwork!

threesixandnine 1 day ago 1 reply      
Is the app you are talking about the one in your profile? If so I personally think it's great. I am sure you will find few more users now that you posted here.

If I were you I would personally go to small-mid-big biz in your area and pitch them this tool. I know that Internet is the thing but real money and connections are offline....just a hint....

lazyant 1 day ago 1 reply      
I also wrote a few years ago an "nmap as a service" tool, had some challenges like false positives, how to authorize automatically, slowness, UDP ports, using different origin IPs in case I was blocked etc. OP email me if you want to exchange notes.
siquick 2 days ago 2 replies      
Read this book ASAP


and read https://growthhackers.com/ to get ideas

Another trick - post your URL in Ask HN posts ;)

jay_kyburz 2 days ago 3 replies      
We are in a similar place right now. I'm looking forward to seeing what people have to say.

Blight of the Immortals only has about 50 daily active users. We would like to grow a little to get a better idea about what people like and don't like about the game.


We've run some Facebook and Google ads and it looks like it costs around 35 - 40c a click. We only get about 10% sign-up so we are paying about $4 a user. (From what I have read that's about what to expect)

We still have a lot of cool stuff to add, but we make about $2 per new account, so I guess that means we are about halfway there :)

bakztfuture 2 days ago 1 reply      
"Do things that don't scale"


pbreit 2 days ago 1 reply      
I'm not sure what exactly you mean by "hobby" project but if prospective got a whiff of such a thing, I suspect they'd pass. I would at least try to exude more seriousness about the product, unless it's a game or something frivolous.
AdamWoods 2 days ago 1 reply      
Nobody is going to simply stumble across your application, so it's your job to start promoting it! That doesn't mean paying for advertising, but marketing doesn't always cost money.

If you're keen to have more people use it, you need to be able to clearly answer:

What is the benefit of using your application?What does your tool do to make people's lives easier/better?How can people access your application?

Then you start with your own social networks. Explicitly ask people to use your tool as testers, find people who you think would benefit and approach them directly. Tell people why it's cool and ask them to share it - then go from there.

hayksaakian 2 days ago 2 replies      
I read a little bit about what your app does -- scan for open ports.

I think "native" promotion is the best. Figure out who your best customers could be and start watching ports on all their websites. Whenever one changes, send an automated email saying something like:

"We noticed a potential vulnrubility in your site, if you'd like to know if this happens again, reach out to me"

tyingq 1 day ago 0 replies      
One strategy that sometimes works is to help people see the tie between your app/product and something else that's already popular.

One of the other comments here notes that your application does some kind of scanning for open ports. Assuming the application has some kind of integration...

That might be easy to link to, for example, Docker. A blog post showing how to "automate security validation for newly created containers" might have a broader audience that just "port scanning". Especially if you provide working code, and some path to integrate more than just your app.

Grue3 1 day ago 0 replies      
I have the same problem, my project is extremely niche and I hoped it would spread by word of mouth. I don't really use social media, so I don't self-promote it. The big boost came when I posted my project on a specific subreddit and it got a large number of upvotes. However the wave of users died off quickly and a year later I get like 10 users per day and maybe once per month it gets mentioned somewhere on the Internet.
xupybd 2 days ago 1 reply      
What is the application? Sharing it here could be a start?
IshmaelF 2 days ago 0 replies      
Firstly, since it is a hobby, tell a few friends about it -- see if they would get on your application, get some feedback from them and move on accordingly.
mid0 2 days ago 0 replies      
. u already started by asking for help

- invite folks you know on an "sure to open your email/answer ur slack/im/sms" message and

-- invite folks you know little bit outside of that circle

--- invite folks in forums your' involved with (give/take)

--- invite folks on ur mostly active social media account

---- you can submit to betalist.com if it's beta private only

---- you can submit to producthunt.com if it's live and ready to be used

taprun 2 days ago 2 replies      
Why don't you ask your one user to help you?
scriptstar 1 day ago 0 replies      
Please watch this first and I am sure you come back here with more enlightenment.


prawn 1 day ago 0 replies      
You could post it here for feedback: https://www.reddit.com/r/sideproject
i_feel_great 2 days ago 0 replies      
Facebook, LinkedIn, etc. Depending on your network, a casual post here and there can be noticed by a few dozen people or more.
andrewchambers 2 days ago 0 replies      
one help would be to post a link so we can check it out.
onnnon 1 day ago 0 replies      
You need SSL for starters...
Startup or Shutup A talk I gave for people thinking of beginning a startup
4 points by tdondich   ago   3 comments top
gferrand 9 hours ago 1 reply      
"Quitting is lying to yourself." That resonated. No matter how hard it is to build a startup and face the roller coaster of entrepreneurship...I guess in the end I'm a masochist :D

Thanks for sharing, Taylor.

Ask HN: How to quit the job you hate?
10 points by pzzld   ago   15 comments top 9
montbonnot 8 hours ago 1 reply      
You're burnt out. I'm in a similar situation so I decided to leave my job without any backup plan but my savings. I do have personal projects, things that I've always wanted to work on (lack of time and energy). I also plan to visit the people I appreciate in life for the next month or so.

I was working in the hottest company in the game. Landed an onsite to the 2nd hottest company in the game :-) when I was quitting. They contacted me in the first place and decided to bring me onsite without doing any phone screen. I cancelled everything last minute and didn't even show up. I was simply burnt out.

I'd say, the rule is much simpler than you think: life is short and you're unhappy. Your job is not to work for anyone. You're job in life is to make yourself happy no matter what it takes. Quitting could be the best think you could do right now. Don't be afraid. We're coders and everyone is looking for coders... do what you like!

ranko 10 hours ago 0 replies      
In general, it's easier to get a new job while you still have the old one (because potential employers usually prefer candidates who have jobs). It sounds like almost anything would be preferable to staying where you are, so why not put together your CV/resume and apply for a couple of things that look not-terrible locally. If nothing else, you'll get some interview practice and learn a bit more about what's available and what you're interested in.

I see from a comment that you're about to become a father. I moved jobs two weeks before that happened to me; as long as you're up front about needing the time off, a new employer should be fine about it. If they're not, that's a sign that you probably don't want to work for them anyway.

arien 10 hours ago 1 reply      
Whilst I don't know how's the job market where you are from, 1+ year savings should be more than enough to quit without fear (if it's not then you might want to consider why). You can take a break to regain your love for coding and to think what you want to do next. If you feel restless while on the break you can take courses or do some personal projects. Once you feel more refreshed you can start looking for a job with the right mindset. Don't leave it for the last minute, though.

You can obviously look for another job right now and just swap, that would be fine, too. But consider your current state of mind, which is due to your current job being so horrible. If you interview right now you might be nervous, more focused on getting out of there than finding a job you will really enjoy and thrive in. And that might not end well.

As a disclaimer, I will say that I've been in both situations and the first went better than the second (not that the second was terrible; simply not as good as the first). What I just wrote in the paragraphs above is me looking back and rationalising both outcomes.

Whatever path you choose, good luck!

JSeymourATL 10 hours ago 1 reply      
>The whole idea of finding new job makes me sick.

Don't look for a job, look for people you can help.

Get out of your bubble. Start attending meet-ups, workshops, conferences. The more, the better. Find out who is doing interesting work, what problems are they trying to solve. Who might need someone with your experience and skill-set. The job opportunity will find you.

edimaudo 10 hours ago 0 replies      
First, before you leave your current job write down your plan.I see you still love coding so it should not be too difficult to find a new job

Go to meetups in your area to get a clear view of the current tech landscape, look at firms you are interested in on linkedin/github. Also, get your resume/github/portfolio updatedYou could also take the consultancy route and start building applications for people. These involves doing a lot of handshaking, talking and marketing. If this is your thing by all means go for it.

ericbrow 9 hours ago 0 replies      
An old co-worker of mine jumped ship in the way I wished I had. He had something like 16 or 17 days vacation, and he took every Friday off from September till the end of the year. He used those Fridays to look for new jobs and interviews.
drKarl 10 hours ago 1 reply      
If you have savings for 1+ year and have been more than 10 years on the same company, you'll probably be allowed to get a leave. You could get a 3 months, 6 months leave or whatever you feel like, to think your next movement, explore options of what you would like to do, maybe experiment with new technologies and start some side projects to see if you still like coding but you don't like your work, or if you don't like coding at all, maybe experiment with other areas of work, even do some courses. Then go back from the leave refreshed, probably with new skills and a new view of things.

By then you might have a better idea of what kind of job you would like to do, so you can start looking for another job while you still have a job (which is always good in terms of negotiating power).

odonnellryan 10 hours ago 0 replies      
It depends on your circumstances, but as someone who just jumped ship with some savings... it is much less stressful to get a new job first. I'd strongly suggest getting a new job before leaving! Even if it is one where you are underpaid: a consistent paycheck is very valuable.
pzzld 6 hours ago 0 replies      
Thank you all for sharing your experience and thoughts. That gave me some insight.
Ask HN: What to do if you hate your coding job? (UK, 24yr old)
5 points by dthrw   ago   5 comments top 5
meric 2 hours ago 0 replies      
it just seems time is too valuable (after working 9 hours a day and feeling pretty tired) to work on some stupid idea just for fun when you know it will lead to nothing

I've had that before, with an idea that's fun, but not fun enough. I thought maybe I was getting sick of programming.

Now I work 9 hours a day, feeling pretty tired, and still go on to work on my idea until 1am or 2am. 3am if I can make it.

If you aren't energetic enough to work on an idea for fun after 9 hours of tiring work, the idea isn't fun enough, and not worth quitting full time employment.

But on the other hand if despite 9 hour of tiring work, you find yourself working till the wee hours every night working on your idea, perhaps consider maybe there's something interesting in your mind?

That's the situation I'm in. I'm planning a year or two without working in a year's time to work on this idea. Not because I have no energy to work on it after 9 hours of work everyday, but because the idea is so interesting to me even after 9 hours of work, I find myself working an additional 6 hours on it. It's on my mind in the shower, on the way to work, at lunch, in afternoon tea break, on the way home, eating dinner, when I am working on it, when I'm in bed, as soon as I wake up. (And I try to resist thinking about it when the director of the company is sitting next to me. I hope he didn't catch me writing this comment. ;)) My ideas were the same ones I've had for the past decade, except I've refined them as time gone by. An idea that was once stupid and won't lead to anywhere, is now an idea I can't take my mind off, an idea, for me, that will lead to everything.

Keep living. Look for a new job if you're sick of it. But I don't think you're tired because you don't have time to work on your ideas. I think you're tired because you haven't found or refined your existing ideas to a state where it will be so interesting to you you're working on it even as your eyelids struggle to keep opened. You don't have the time for ideas that aren't that interesting, but when you have an idea that's interesting enough to you, you will find you always manage to find some time for it.

Jack000 2 hours ago 0 replies      
I was in a similar spot almost two years ago. I actually didn't mind the work that I did, but it just became rather dull.

So I quit and traveled. It does seem like traveling is the "default" thing to do to cure one's ennui. What I can say is that being in a new locale doesn't magically give you newfound motivation/inspiration etc, and depending on your personality it can be quite isolating.

Over the years I've kept a list of things I'd like to build if I ever found the time. Now I'm just going down the list and seeing what sticks.

The way I see it, if you really do hate your job then quitting is simply a matter of time - better sooner rather than later, for both you and your employer.

yrezgui 11 hours ago 0 replies      
Hi dthrw, I'm from UK too. In my previous job, I was working on something very cool with the best colleagues that I got so far in my professional life but I wasn't feeling great by the new vision of the company. They weren't going in the wrong direction, just not the one that I was expecting. So I left. I didn't travel around the world like some people do but I searched for a remote job because I wanted to take a break from offices and work in my cozy room. UK and specifically London are looking for many developers so it should not be a problem to find a new job. Take your time to choose the right one. You may find it hard first (for me, it was remote or nothing) but you need to stand on your choice of life. You may have chosen the wrong job, don't do the mistake one more time. It's not selfish to privilege yourself. You worked and studied hard for your future so you should have the life that you want. Cheers and good luck bro ;)
J_Darnley 9 hours ago 0 replies      
Quit and let someone else have it.
gargravarr 10 hours ago 0 replies      
Hi OP, I'm in much the same position. Perhaps with a few differences - I was more interested in computer hardware and setup, but got into coding because I was told that is where I would make money. These people were not wrong; hardware monkey jobs pay considerably less than developers, but I hate my job. I've stuck with it for 2.5 years now (age 25) for the money and convenient location (not in London) but I've been desperate to move on for over 12 months.

The problem with working in IT, I find, is that it saps the fun out of your hobby. The best place to work if you actually want to code and enjoy it would be a start-up, but those are uncommon in the UK and come with their own drawbacks - unusual/long working hours, impossible deadlines, holding the future of the company quite literally in your hands. Big corporations give you more stability there and reduce the pressure, but at the cost of your input having little to no direct impact on the company. You also have to fight corporate bureaucracy which seems to be inevitable once a company reaches a certain size. The company I work at has recently crossed that tipping point, so I'm watching everyone's work ethic come crashing down.

The other option is to go freelance. If you can do web development, there will always be people wanting websites built, maintained or enhanced. Obviously you would become self-employed but you would have ultimate freedom over your work life. You could also start a local computer maintenance business for companies to outsource their IT work to; not all companies will hire someone in-house for small projects. It's difficult but not impossible to do at our age.

I've considered a lot of options in the time since I've graduated university. Computing was always my hobby: working in the same field seemed natural, but I'm finding the drawbacks are numerous. I'm moving teams within my company into more of a DevOps role - it means I will be doing less hands-on coding, and no client interaction, so my immediate contribution to the company's product will be essentially zero. However, I'll be working on systems that support other developers which sounds like a better option for me. It will also give me a break from coding professionally, which might leave me some energy to code in my spare time. Ultimately though, I've decided to get out of IT completely and do something else, because it just doesn't fit in my long-term plans.

The problem with IT in the UK is that everything is based in London, and we do not foster as much of a startup culture here as other countries, so most work is with big, historic companies where it's easy to become a small cog in a very big machine. You'll need to do some soul searching to decide if you can keep going with that.

I have also thought long and hard about complaining about my situation; correct, all our basic needs are addressed by having a job - food, shelter, even transport - but being in a bad job is equally bad for your mental health. I know it takes less effort to complain about it than do something about it - believe me, I've done enough of that! - but that's what you'll need to do. See if you can move sideways in your company into another job, or look into other options.

Hope this helps.

Ask HN: Best (Tech) talks from 2015
17 points by monkeyshelli   ago   8 comments top 6
eicnix 19 hours ago 1 reply      
As somebody who hasn't worked with react before I find this talk very interesting: https://www.youtube.com/watch?v=xsSnOQynTHs

He talks about improving the development workflow by hot reloading parts of the application during runtime. Slow workflows affect every developer and the idea from this talk can be used to build tools for other stacks or languages.

musha68k 5 hours ago 0 replies      
I hadn't been particularly enthusiastic about Go but in the end Rob Pike won me over - "Simplicity is Complicated":


A powerful talk on Silicon Valley history by Kelsey Gilmore-Innis - "What Tech Workers Can Learn From Harry Bridges":


japhyr 20 hours ago 1 reply      
If you're a Python programmer, Raymond Hettinger's "Beyond PEP 8" was pretty interesting:


cdubose 10 hours ago 0 replies      
I'm not sure if I would define it as a "talk" (and the details are more meaningful if you know how to use Emacs), but Jay Dixit explains how he uses Emacs for writing instead of programming: https://www.youtube.com/watch?v=FtieBc3KptU
JohnKacz 13 hours ago 0 replies      
As a rails dev this one is probably pretty standard but I appreciated DHH's ideas about being small and still able to take on the giants.https://www.youtube.com/watch?v=KJVTM7mE1Cc
My GF and I finally completed our first ever game
7 points by suavisapps   ago   5 comments top 3
kleer001 11 hours ago 1 reply      
First congratulations on not only making a game, but making it with your mate. I trust it was a fun learning experience? Are you two planning on making another?

As for thoughts I would only recommend you make your ship 1/2 it's size. That will fix the difficulty problem. In my years of making games (vidya, board, and card) and puzzles Over and over again I stumbled into the fact that it is easy to make games/puzzles difficult. However it is difficult to make games/puzzles entertaining, that requires much testing and feedback with naive users. So, yes, I recommend listening to your users and making it a bit more fun and less frustrating.

meric 4 hours ago 0 replies      
Looks cute! Congrats on the 500-1000 downloads!
threesixandnine 11 hours ago 1 reply      
Man, too hard to play. How do I "drive" the rocket?
Ask HN: Leaving cushy job for startup (hire #1). Feed me your wisdom elder ones!
8 points by thrwway   ago   8 comments top 5
seattlesbest 1 day ago 1 reply      
9-5 is shorter than 9-9, remember that.

Startups have a reputation of running developers into the ground. Corporate work, while boring at times, can be great if you want a work-life balance.

If you're going to be one of the first few hires, expect things to change as the startup fails to gain traction and the money runs out. Even if it successful, you'll probably find yourself in a management role as more people are brought in and you're the expert on the business domain (as well as the landing pages, marketing emails, CRUD apps, account details, etc.).

In some ways, a solid corporate gig can be more honest. IME you get hired for a role and you do that type of work. Maybe you haven't found the right cushy corporate gig?

JSeymourATL 10 hours ago 0 replies      
> I have asked for a reasonable salary (same as current) + equity.

Consider that the equity represents an ownership stake in the company, you are now a junior partner responsible for its success. No longer a flunky employee. This should impact your thinking and outlook on everything.

You will find Jay Abraham's 'Getting Everything You Can Out of All You've Got' excellent food-for-thought > http://www.goodreads.com/book/show/89969.Getting_Everything_...

DrNuke 17 hours ago 0 replies      
Honest wisdom: odds say it will end in tears, so have fun and... good luck!
lovelearning 15 hours ago 0 replies      
"I also get bored of programming unless I feel I'm building something that matters or is challenging"

Keep an interesting idea of your own as a side project to do at home at nights and weekends. The startup is somebody else's idea. It may or may not be challenging to you, and it may or may not interest you after a while.

floppydisk 10 hours ago 0 replies      
We're in the same boat, I always got envious of the people doing the mad cool stuff and playing mad scientist -- that's what makes the tech blogs, but missed the fact that $MAD_COOL_THING was only a fraction of what they did and that all jobs come with a lot of cruft. Big corps come with more overhead and bureaucracy, and small corps/startups require you wear a lot of hats, some of which you will abhor but need to -- like setting up email marketing/configuring web servers / debugging that support app someone wrote as a one off a year ago that's feeding the CEOs spreadsheets mysteriously and no one knows how. etc. You will dislike some of what you do and it won't be playing mad scientist all the time.

That said, here's a couple things I've learned the hard way to pay attention to when joining a small corp / startup:

1) Ask bout funding. Seriously. How much do they have, what's the burn rate, when do they expect to be self-sustaining (running on sales/revenue rather than seed/VC $$), how profitable are they now, is their capital tied to any contingencies (i.e. they may have "access" to $X dollars to fund the startup but only if they achieve sales figures $Y-Z w/i a certain time frame, I got burned bad by not knowing this). Know the funding situation and be cognizant of what you're getting into.

2) Keep your work/life balance. It's very easy for small companies and startups to eat your life and you're spending all your good hours in the office putting out someone else's fire without any additional compensation / comp time / what have you. It's just expected of you and it's easy to slide into that role. Be vigilant about protecting your free time outside of work and setting boundaries to recharge and refresh yourself. Go to meet ups, go for a run, meet new people, whatever you do. Explicitly carve out time for that and defend it zealously against creep. There will always be more work, another fire, and another do or die moment, without fail. There won't be a redo on life. Live yours.

3) They (leadership) may not be loyal to you. Companies, especially startups, expect fanatical devotion to the product, company, and their vision but they won't be loyal or necessarily upfront with you about how the company is doing. You can get a sense of some of these things based on what crosses your desk, but don't expect die hard loyalty or a commitment to treat staff right. Understand petty politics / business concerns will impact you, especially if there are personality conflicts. Get a sense of who you'll be working with and your rapport and decide if you're comfortable with them. Yes, this is cynical to a certain degree, but I've seen it play out repeatedly to the point of carefully screening coworkers and direct managers to the best of my ability before deciding to join. Life is too short to work with/for people you can't stand (and vice versa).

Edited to fix wording.

Social Credit Obedience to the state gamified
18 points by Kenp77   ago   3 comments top 3
jneumann004 1 day ago 0 replies      
This sounds a lot like Whuffie from Down and Out in the Magic Kingdom by Corey Doctorow. If you haven't read the book yet, you can download it for free from his site, http://craphound.com/down/download/
kleer001 1 day ago 0 replies      
Human behaviour, eminently hackable. Just like any complex system.

Also I totally see someone hacking this system to their own benefit, if they're not doing it already. I also see markets arising in hiring people to help you hack your score. And that's with officials looking actively for rule breakers. That said I bet most people will fall in line.

Dowwie 1 day ago 0 replies      
This takes nudging to a whole new level (pun intended)
Ask HN: Is GoDaddy violating ACPA with new .family TLD?
11 points by legohead   ago   6 comments top 4
cmontella 1 day ago 1 reply      
I wouldn't be surprised. I used Godaddy once to search for possible domain names. I found maybe 10 or so good ones, and then took some time to think about which one to choose. A couple days later I went to register the one I wanted, only to find that Godaddy had "helpfully pre-registered" it for me (their words on the landing page they parked on the domain) and they would now sell it to me for 3x the price (you know, for the convenience). I looked up the other domains I had searched, and wouldn't you know they were also "pre-registered".
duskwuff 4 hours ago 0 replies      
No. The term "mark" in that legislation specifically means a registered trademark. Unless you are one of the few strange people who has trademarked their own name, you have no grounds for action here.
y-satellite 1 day ago 0 replies      
It's not GoDaddy. My SO tried to register our family name earlier (after pre-registering for it, even!) and got a similar price.

Querying the WHOIS server for the domain says the following:

"This premium domain is available for purchase. If you would like to make an offer, please contact platinums@rightside.co."

Rightside.co is the owner of the TLD. It looks like they've set aside a bunch of common family names so they can charge "premium" prices for them. So helpful of them!

nikthenuk 1 day ago 0 replies      
Some domains for .family TLD may be Premium because the registry operator (not GoDaddy) set them as premium. Like cars.family. Some registrars do not offer premium domains at all (only regular domains). Have you search for the domain in https://www.hexonet.net/ ?

As somebody mentioned, "domain tasting" is not possible anymore.

There is always the chance that some person (not GoDaddy) registered the domain as an investment and try to resell it at a later time: as long as this domain does not infringe on a Trademark, this activity is completely legal (a person that does that is called a domainer).

Ask HN: Is there a good tour of the modern JavaScript landscape
7 points by oolongCat   ago   6 comments top 4
gordonzhu 8 hours ago 0 replies      
I created a video course that addresses the exact problem you're describing and shows you how to build a full multi-page app backed by a database (but it's for Angular rather than React).


When I was learning I saw the same thing you're still seeing most tutorials only explain high-level concepts and when they do show code examples, they are tiny, arbitrary, and unrealistic. So when I quit my job to teach web development, I wanted to make sure I didn't do the same thing as everyone else.

baldfat 1 day ago 0 replies      
Having taught myself javascript in the mid-late 1990s and brought down a few servers by simple mistakes (Not always my own) I swore myself off the language and haven't looked back. Now I am looking to jump back in to do some app development and js seems the easiest way currently.

I have looked at https://www.youtube.com/watch?v=hQVTIJBZook JavaScript the good parts 2009.

There seems to be much better handle on JS so I also would be interested in "Best Practice" for modern JavaScript development.

codeaddslife 1 day ago 1 reply      
mc_hammer 1 day ago 1 reply      
most of those are either made in the spirit of unix where one tool does one thing

 - gulp and grunt are for handling multiple js scripts and all your folders of js scripts, makefile stuff - ill assume webpack is for minimizing js - bower and npm are package managers, while npm is just node modules, bower can do some cool stuff like install jquery or bootstrap into your local public_html folder - es6/ecmascript is a standardized featureset of javascript that people are working on. you can use it now, but you have to install babeljs, and use expirimental option in chrome
youtube has great tutorials.

there is yeoman.io and yo that sets up skeletons for the dev environment

there are 'base fiddles' ex 'react base fiddle' that can get you going. there is also bower and docker vm images with skeleton projects. also there is a lot of skeleton projects on github.

(its ez to breakdown a base fiddle and see whats needed to get the dev going)

Ask HN: You built and they just came?
3 points by zerr   ago   4 comments top 3
Jack000 1 hour ago 0 replies      
depends on how minimal I guess.

I once ran a p2p site called flashseed. The basic premise was that it was a torrent tracker that solved the two major failings of bittorrent - initial seeding and incomplete swarms, by hosting a static copy of the file.

I posted it on a forum, but due to the ill-conceived name people thought it was a free seedbox rather than a tracker. It blew up overnight and crashed the server. 99% of the files uploaded turned out to be pirated movies and TV shows. At the time isohunt was being sued and the legality of the site was unclear, even if I did comply with DMCA. After some thought I decided it wasn't worth the effort, and let it die a natural death...

If I were to do it again I'd probably make it invite-only

pzzld 10 hours ago 0 replies      
I think these stories would be accidental more often than you think. In our world of internet you have to be promoting yourself for any kind of attention.

Your product has to be outstandingly super good to gather users without any marketing.

erickbarto1 10 hours ago 1 reply      
I built Badabing! An app to see your friends bikini pics. And they just came, in droves. This was 2012
Ask HN: What do you think about the messaging hype?
2 points by tomashertus   ago   2 comments top 2
floppydisk 4 hours ago 0 replies      
It's like the blogging site boom from back in the day. Lots of platforms emerged and eventually the market coalesced into a couple major players that drive a lot of the traffic now. I think the same thing will happen to this market. We're getting a lot of different ideas and approaches being thrown at the market and the winning feature set(s) will become the dominant ones either incorporated into most apps or, like the blogs of yesteryear, we'll get a couple major messaging players like we have a couple major email/blog players that dominate most of the landscape.
seiji 11 hours ago 0 replies      
There has always been a boom market in messaging going back to ICQ (and maybe earlier). The big problem is: companies want money, so they don't want to make the mistake of IRC as being 100% free and open and decentralized.

The cycle will continue for the foreseeable future: people want to communicate, someone creates a new communication app for modern platforms (or a cheaper way of communicating than had come before), old communication apps fall out of fashion, new communication app stagnates, someone creates new communication app for more modern times, rinse, repeat.

One day we'll have a majority marketshare 3d telepresence app, a majority marketshare direct mindsharing app, a majority marketshare sensorium sharing app, etc. It's just things people want that we don't have the technical capability (or wider vision) to instantiate into reality yet.

As far as "value add" or "marketplaces" built around chat apps, just ask yourself how many AOL Channels are still profitable today. We're stuck living in the times we inhabit, so sometimes there's short term value to capture, but in the longer term, everything fades.

Ask HN: Are you interested in becoming a technical cofounder?
18 points by robbystout   ago   25 comments top 6
subrat_rout 1 day ago 2 replies      
If I were you I would do following:1. If you have worked in a big Co for 7 years then I assume you have some money saved up.(Or some discretionary savings for entrepreneurial activities?)

2. I would allocate around 20k from my saving and hire somebody(a developer or two) from toptal or codementor and then build the MVP. I am sure you will find some great developers on those sites who won't mind building the MPV if you pay them per hour. You can even negotiate a lump sum for the entire MVP project.

3. Then start aggressively acquiring users.

4. Next convince the working developers to come onboard as a full time and become technical-cofounder.

I am sure there are few caveats to this approach

This is my personal suggestions though. Take it with a grain of salt.

alexskype583 1 day ago 0 replies      
I am interested. We can have the application built. I have sent you an email. If you have not received it, you can reach me through Skype as well.
CryoLogic 2 days ago 2 replies      
What's your plan for acquiring users? I've built several small social networks, and the biggest issue is always getting new users - and keeping them active.

The technical part is more or less a front-end, a back-end and some databases.

NinjaSudo 2 days ago 1 reply      
Best of luck to ya Robby, where do you suspecy users most likely engage on this network? That might help find a co-founder.
AznHisoka 2 days ago 1 reply      
I don't exactly understand what you are building. Are you suggesting something like RetailMeNot?
panjaro 2 days ago 1 reply      
Does location matter?
Ask HN: Any startup working on a os for consumer routers?
3 points by soulbadguy   ago   9 comments top 3
archimedespi 1 day ago 1 reply      
You wouldn't need to do much more than put a pretty front-end on (free|open)BSD to have a decent consumer router.You can even do this with commodity hardware: http://rtfm.net/FreeBSD/ERL/
kafkaesq 1 day ago 1 reply      
Good question, but I'd suggest a title correction:

"a os -> "an OS"

Ask HN: What will be the strategy of CAs after Let's Encrypt
5 points by thomasdd   ago   6 comments top 3
Someone1234 1 day ago 2 replies      
Aside from EV, they might also continue to sell DV certs if the price is low enough (sub-$10). Let's Encrypt is cheap, but it is massively inconvenient, and a lot of people would prefer to "waste" a few dollars on a streamlined process than spend hours trying to get Let's Encrypt working with their platform/infrastructure/etc.

I just spend $9 renewing with Comodo's "PositiveSSL" because Let's Encrypt was too much hassle.

detaro 1 day ago 0 replies      
Pushing EV certs, offering services around it (monitoring, issuance controls, deployment, APIs).
sjs382 1 day ago 0 replies      
Extended validation, and the other products they already offer.
Ask HN: Understanding a large python codebase
10 points by bonobo3000   ago   6 comments top 5
codeonfire 2 days ago 1 reply      
Well, I would get PyCharm for this particular issue. In these cases you are usually going to have to search all files for variable names or classes. Learn all the keystrokes for finding references and viewing class and call trees. If you are going to be owning the code add some type hinting comments for the classes and functions that you deal with frequently.
enkiv2 1 day ago 0 replies      
Personally, I'd suggest finding a starting point and tracing through a couple common operations. That will give you a better idea of why the code that's there exists and why it works the way it does.

Usually, this habit works better on languages like Python than languages like Java that encourage repetition and the proliferation of abstraction layers. You'll do less code-reading in a large Python codebase, because you won't be dealing with large sets of wrapper classes that exist basically to circumvent inheritance restrictions. But, I typically do this for any large codebase I'm expected to understand, even if it's in Java.

Within a particular use case, the lack of explicit types shouldn't matter too much, if you are reading in execution order. Types are useful if you're starting from some random function and trying to work backwards, but that's hard in large projects regardless of the language. While python code may well take heavy advantage of duck typing, reading code in execution order should make the set of possible types to be passed in from a particular point clear.

Large projects, no matter the language, take a while to fully internalize. Your difficulty probably has nothing to do with Java vs Python and everything to do with small codebases versus large codebases. (I say this as someone who works with a very large java codebase and a very large mixed shell/perl codebase at work and works with several large python codebases on the side.)

twunde 1 day ago 0 replies      
1) What you really want is a mental model of what the application is doing as a whole and what the subsection you're working on now is doing. Look for existing diagrams if possible. If there aren't any start making them as you go along and then have other devs verify. Then try to own a subsection of the code and really understand what it's doing. Once you feel comfortable with that move on to another, preferably related piece.

2)While you normally don't need or want an IDE for dynamic languages, it sounds like this codebase has reached the point where you should be using one and in particular be using the jump to definition shortcut. If you make a type error, this should help you catch it quickly. PyCharm is a good one but there are alternatives.

3) Operational complexity should be owned by someone already. If not, this may be the place where you can make the biggest impact. See if there is centralized logging set up. Make sure the setup/installation and deployment procedures are up to date. These can typically be automated pretty easily

4) An alternative approach is to look at the data first. Once you understand the core data models, you typically understand the application

quintes 1 day ago 0 replies      
Having worked on a large python code base as well I can tell you that sometimes it's hard. Look at the types, determine if they're instance of and try build small test runs around existing code before you modify it. python tools for visual studio is sweet and may give some help with getting around, as will pycharm. If figuring out where logs are or other configuration details are hard to find get them into configuration files. I guess you can draw the high level of how it fits together but start small, pick a class or method and follow it through. Oh, enjoy it. python was lots of fun for me
mrfusion 1 day ago 0 replies      
The debugger is your friend. But a breakpoint and step brought the code and inspect variables in places you're really confused.
Ask HN: Deep web size?
5 points by c-47   ago   1 comment top
chatmasta 2 days ago 0 replies      
Think about it. How many sites do you log into each day? As a percentage of text on your screen, how much is only visible while you are logged into a given site?

The "deep web" is very interesting, but a more precise definition would clarify any measurements of it. For example, does content that is visible to all authenticated users comprise the same "deep web" as content that is visible to individual authenticated users? If I can see a wiki only when logged into a service, but so can every other user of the service, is that the same "deep web" as my personal dashboard that only I can see when authenticated?

Also consider the many mobile apps that do not have their content indexed by search engines, like whisper, yikyak, tinder, etc.

Perhaps the next great search engine will be the one that nails the problem of gaining insights from the "deep web".

Ask HN: Does Facebook Use WhatsApp Data for Trends/Analytics/Ads?
4 points by amazedsaint   ago   1 comment top
livus 1 day ago 0 replies      
I feel that article is no longer valid given that it's written in June 2012 while WhatsApp got acquired in 2014. Things have drastically changed since the Facebook acquisition and I've particularly seen my facebook profile being "enriched" by data from WhatsApp (specially when it comes to adding friends). WhatsApp might not be using it for ads within the app but it is surely contributing to building a user/marketing profile on facebook.
Openhunt forgotten already?
5 points by kulesh   ago   4 comments top 3
anthony_franco 1 day ago 1 reply      
OpenHunt tried solving a problem for the content makers without providing any additional benefit to the content consumers.

It's a nice, heart-warming mission. But in the end of the day, content is king, that's what consumers want.

There have been many examples of people rallying around a "free and open" version of a service. They fail to realize that the end consumer barely cares. Look at voat (Reddit), app.net (Twitter), Diaspora (Facebook), even ycreject.com (Y Combinator) tried to be a thing for a while.

If someone is able to make it "free and open" while also making it a better experience than the alternative, then it'll be a big success. But so far everyone gets that wrong.

NetStrikeForce 1 day ago 0 replies      
If OpenHunt wants to take off, it has to be more visual like ProductHunt. Every time I go to OpenHunt I spend no more than a few seconds, because it just looks like a list of non-curated links - so why bother?

If I could have small intros or images for each link, anything that could compel me to click, that'll be much better. Just check how Facebook and Twitter ads work, they always include images, even to send you to a SaaS site.

smt88 2 days ago 0 replies      
My guess is that heavy ProductHunt users were unwilling to move. The OpenHunt users were probably people like me: ProductHunt is interesting, but it's not quite interesting or useful enough for me to actually use it.

For me, it was almost like a New Years resolution: start using OpenHunt! But I didn't, because I mostly don't really care. I logged in once and then never came back.

(Also, the name was a bad idea. OpenReddit would never beat Reddit, you know? It might as well be called "the same, but newer and worse".)

Ask HN: You're building an app in 2016 How would you let users login?
8 points by somesaba   ago   19 comments top 10
jjoe 1 day ago 0 replies      
I think we're back to email/pass as a preference. Because folks are so wary of apps requesting permission to their social accounts or people no longer using said social network. There's definitely social fatigue in the air.
codeonfire 2 days ago 0 replies      
In 2016 there are different levels of logged in:L1 - I think I know who you are because you have a cookie or I remember your IP or browser fingerprintL2 - I definitely know who you are because you logged in during this session and have a cookieL3 - I trust you enough to show you your user info over https since I just asked you to log in and you gave a password or verified you with facebook.

Obviously some bigger names are experimenting and trust their tracking enough to do away with authentication for some things. Personally, I have an anonymous mode on one site. It is "I don't know who you are but I remember you." They can use the site and then convert to a real user with facebook, google, or email/password.

chris_va 2 days ago 1 reply      
I chose to do Facebook and email/password.

SMS costs a very tiny amount of money, and didn't offer any advantages (you can't get at the user's phone # on ios, so you cannot prefill, thus email had a similar level of friction from the user's perspective).

brudgers 2 days ago 0 replies      
What will users get out of logging in?

Which is to say that the first options would be simply for the app to work without anyone having to log in. That's practical for some apps, and of course not for others. The larger point is that just as a login mechanism might not be necessary, if it is necessary the choice of mechanism should make sense given the nature of the app...don't use Twitter for a self-help app for narcissism or Instagram for a seniors lifestyle app.

As for the alternatives, what good could possibly come out of storing name/email and password pairs?

danielhellier 2 days ago 3 replies      
5. Email a login link to the users verified email address. No need for a password.
miguelrochefort 1 day ago 2 replies      
I already have 1000 different accounts on 1000 different websites. I don't want yet another one. Can someone fix that?

Fuck emails. Fuck passwords. I don't want to deal with any of these things. What's the purposed of being logged-in anyways?

tmaly 2 days ago 1 reply      
I built a mobile web app, and I started out with just Facebook and Twitter login. However, I have some friends who are privacy conscious and they do not have social media. They would prefer to have a email/pass login option.

So that that is next on my list to add to this current project.

jordansmith 2 days ago 0 replies      
Really it depends on the app, but for the most part I like to give options for 1, 3, and 4. Social login is linked to an actual account that can be used for 3/4 if they want.
IshmaelF 1 day ago 0 replies      
People really like email/pass, the more lazy ones use facebook and other social. SMS costs money and I don't see the advantage of it.
such_a_casual 1 day ago 0 replies      
I would try to get away with the most minimal thing possible. Ideally I would do the same thing flash games have always done and create a cookie for the user.

If they need to login from a different place, I would put a simple 1 line form and button for emailing a link that would allow them to do that.

If it was necessary, I would give them the option to backup their account to an email address. This would just set the hash to something new so that the old cookie info no longer works, and they only have to click the reactivation email.

If this is an account where virtual goods are purchased (like Steam) and so there is actual value to the account, I would do email + phone backup. Phone backups aren't good enough on their own because people switch phone numbers. Emails aren't good enough on their own because people reuse login data all the time. This is the only case where I wouldn't store login data using cookies.

Forcing registrations and logins on the user really doesn't make sense 99% of the time.

Ask HN: If electricity was $1 per barrel could we see an electric jet engine?
5 points by mentos   ago   10 comments top 6
petra 2 days ago 1 reply      
Not an expert, just the result of a Google search:Fuel has roughly 100x better energy density than lithium-ion batteries(both in weight and in volume), and batteries improve pretty slowly. Before take-off , the weight of fuel is 25-47% of the aircraft's weight.

And since the propulsive efficiency of a jet engine is relatively high(rough search gives 45%-80%) an electric engine doesn't buy much here.

So this isn't really a question of money, but basic limits.

staunch 2 days ago 0 replies      
> "Given that practical lithium-ion batteries were capable of achieving energy-densities of 113Wh/kg in 1994, 202Wh/kg in 2004, and are now capable of approximately 300Wh/kg, its reasonable to assume that they will hit 400Wh/kg in the coming decade." -Elon Musk


sjs382 2 days ago 2 replies      
How much electricity is in a barrel?
gusmd 2 days ago 0 replies      
Not sure If I understand your question, but my understanding is that we don't yet have the means to store energy in such a dense manner as to able to power a jet engine. Energy density of aircraft fuel is much higher than any battery available.
flubert 2 days ago 0 replies      
Here's a starting point for you in your investigations into electrical propelled airplanes:


ksherlock 2 days ago 1 reply      
With a piston-prop or turbo-prop airplane, the engine rotates the propeller so it's easy enough to use an electric engine for that.

Jet engine thrust comes from the exhaust gas. How do you replace that with electricity? compressing air (pulse jets)? generate plasma?

Ask HN: What BI problems would you like an AI to solve for you?
4 points by cneumann81   ago   6 comments top 2
krmmalik 2 hours ago 0 replies      
Great question!I'd actually like to take one step back and would love to see AI assist with the data cleansing. The actual analysis with BI seems to be getting easier and easier already, especially since the bigger players are stepping in and competition is increasing day by day. If you have enough money you can get a tool to slice and dice the data anyway you want. But even if you have a big budget, cleaning up the data is always really hard. The number of people I've spoken to that say the data cleansing is the most nightmare bit tells me this is a huge and lucrative problem begging to be solved.
edimaudo 1 day ago 1 reply      
Helping people figure out what insight they are looking for then creating the reports that gets the data.
Ask HN: How do you deal with 2000 line functions?
26 points by pinkunicorn   ago   67 comments top 34
ndesaulniers 2 days ago 3 replies      
1. Unit tests. Otherwise modifying old code is full of potentially unforeseen landmines.

2. Read the function a few times to get a sense of what it's doing.

3. Break the function into blocks of statements that are performing a related task.

4. Factor those out into smaller functions.

5. Recursively repeat 3-5 until you're satisfied with the new functions' line count.

> Should I tell my manager that the function needs to be refactored and take time to refactor it?

It's absolutely worth mentioning. Time estimations are one of the harder tasks of Software Engineering. Being up front with your manager can help better set expectations.

tinco 2 days ago 2 replies      
Don't tell you manager anything, just do it. If someone tells you to add functionality to a 2000 line function, it takes extra time. If you want the company to benefit a little bit more from the time you spend on grokking it (by saving the next poor soul some time) by splitting it up.

Go to the part that you suspect you need to modify, identify a block of code that together forms something you can give a name, i.e. "initialize_doodad_struct", "validate_widget_params", pull it out put it in a function. Now look at all identifiers that are referenced or declared in your block of code, do a ack or ctrl+f through the 2000-N line function to 100% verify that they're not referenced anywhere. If they aren't you can safely encapsulate them in your new function (if you're working in a static language you probably could just right-mouse-click-extract to do all this).

Then immediately verify that the code still works. Run it, ideally in unit tests but most certainly also in real world(-like) scenarios. Do this for every small step. If your codebase takes 2 hours to compile, instead make a commit. Make a commit for every single 3-10 line extraction you do. (do it anyway, it'll look good and everyone will love you)

And then repeat until either the part you wanted to modify is clear to you, or there's nothing more to extract ;)

By the way, I'm a Ruby programmer mainly, and in Ruby any function over 10 lines is frowned upon. I know that in some programming language communities (looking at you C and C++!) a 200 line function doesn't raise any eyebrows, and they'll sometimes even scold you for extracting a function if it doesn't 'add' anything. I think this is because in C every function pollutes the global namespace, so there's a little more cost associated with it.

mod 2 days ago 3 replies      
You test the shit out of it, then re-write it ensuring tests pass, then add your new code.

It's probably easier to do that than to muck around in the 2000-line version hoping you don't screw something else up.

falcolas 2 days ago 0 replies      
Slowly and carefully, like you're defusing a malfunctioning clockwork bomb.

1) Understand at a very fundamental level what it does (there are probably multiple things).

2) Understand at a very fundamental level what it does (this is really the hard part)

3) Document your hard-earned understanding (tests, ironically, do not work well for this, since there are no fundamental units to test at, and there likely is a metric ton of shared state)

4) Refactor it into something easier to understand and test.

I've had to work with a similar 5,000 line C function at the heart of a DSL parser; literally the core of the entire business. Changes were made very slowly, and with a lot of consideration. Refactoring is still underway 6 years later.

kpil 2 days ago 0 replies      
Pft, 2000 lines :-)

What you do is that you:

A) Realize that there might be years of hidden bugs, but also fixes to complex problems, speedups, kludges, weird changes to requirements, etc, hiding in the code, so even really creative unit-test might not cover real-world edge-cases.

B) Take as small bit as you can, and just refactor out the smelly code into smaller parts. Often a good name around smelly code helps a long way.

D) Iterate. Until good enough.But not more... Maybe you have more important things to do than rewriting ugly code that works.

There is a big risk that since you probably won't understand everything that goes on, and why - you will break something important.

mh8h 2 days ago 1 reply      
Michael Feathers' book, Working Effectively with Legacy Code, is highly recommended. In that book he explains that you can choose between two approaches: Change and pray, or Cover and modify. Then he provides dozens of different strategies to "cover" the existing legacy codes before you make the changes.
azeirah 2 days ago 2 replies      
Something I found to be really useful is to remove all statements inside the code, so you'll be left with large skeleton structures. Look at it from a distance, (small font), see some patterns. Can you split it up?

getting a feel for the structure of the function helps me understand it.


function someFunction () {

 if () { for () { if () { } else { } } if () { for () { } } }}

yk 2 days ago 0 replies      
Depends, but very likely. There may be cases were there is practically no way around a 2000 line function, one example would be a something like a very long switch-case statement, were the logic is very simple, but there are a lot of cases to cover. For example something equivalent to (python pseudo code)

 dict[ keyword](args)
were dict is a large dictionary containing function objects. In that case the dictionary approach has the advantage of separating the logic from the clutter, but it is possible to work with 2000 lines of

 case something: foo(); break;
However if it is not such a case, then you are in trouble. Thing is, management does not like to be told that the code is a steaming pile of shit, and management is especially unhappy if you tell them that you are going to spend a few month on accomplishing absolutely nothing. From their perspective refactoring is accomplishing nothing: the functionality is there, it works and they do not care about the gory details. So you need to convince your manager that refactoring is a good idea, which just goes against every basic assumption of his job. So think about the actual problems you have with the code, and what the company gains by refactoring it. (Easier extensibility, less risk of bugs and faster turn around if a bug occurs.) Then make sure that you convince your manager that refactoring is the right thing to do. ( Ideally you should enlist your coworkers for that, if they know the kinds of problems.)

Speaking a bit more generally, this is part of why technical dept happens. Selling refactoring is hard, so everybody tries to tip-toe around the 2000 line gorilla until some unhappy soul (read someone else) can no longer avoid to wrestle with it.

noonespecial 2 days ago 0 replies      
I've had worse. I was instructed to add to the > 2000 line function of nested if/than/else but the function was written by the manager who said "Don't change any of my code, its been working perfectly".

This function was used as a container to hold all the business logic and flow control. It had dozens of parameters that all had to have some value or another passed to keep from throwing undefined errors. There was an integer called "wat_to_do" that would choose different blocks of if/than/else inside the function. Not like case, mind you, scattered everywhere.

I've never really been the same since then. Can you get code PTSD?

lutorm 2 days ago 0 replies      
I like this book, it has a lot of tips for situations like these:


joshka 2 days ago 1 reply      
A few people have mentioned Michael Feathers' book Working Effectively with Legacy code already, but I'll add my piece on this. The book describes legacy code as any code without tests.

It then goes on to describe the "legacy software change algorithm" (google that for more articles that will help you.Get targeted legacy code into test harness and cover with tests:1. Identify change points for the target change or new code addition. a. Find test points where the behavior of the code can be sensed. b. Break dependencies (very carefully and often without sufficient tests) and get the targeted legacy code into a test harness. c. Cover targeted legacy code with (characterization) unit tests2. Add new functionality with Test Driven Development (TDD)3. Refactor to remove duplication, clean up, etc.

It really is worth reading this book as it covers almost exactly your question: "22. I Need To Change a Monster Method and I Cant Write Tests for It." and various other relevant chapters.

Answering your manager question with a standard consultant answer "It depends". Refactoring code is about setting yourself up for future development. You should always be refactoring your code after you confirm it works. Asking your manager whether you do it should take on the same amount of importance as asking whether you should wash your hands after visiting the restroom. That said, developers can often feel a sense of ownership of code and not wish change for various reason (usually familiarity with the current crap situation).

davimack 2 days ago 1 reply      
I would actually approach this differently. I'd go back to whomever the authority is with regards to what the function is supposed to do, or to the spec, and then rewrite it from scratch. This won't ensure that it behaves as it does now but with a little bit added - it will ensure that it behaves as per the specification / user requirement. If the function is that huge, with just if's, it's very likely that it's buggy and that those bugs haven't been addressed. They won't be addressed if you duplicate the functionality in a refactor unless you can get a handle on the purpose of the thing to begin with. Scrapping it and rewriting it is not a bad thing - frequently, you'll make something much tighter if you do that.

(note: would be happy for you to have left the "offensive" word in - 2,000 lines of code for a single function screams for a refactor, and says that the original dev had no clue how to write good code. if the code makes you want to cuss, well....)

alkonaut 2 days ago 0 replies      
I think making small opportunistic fixes is best. Do what you can do without massively delaying your work every time you need to work in that area of the code. That is, leave the code better than you found it, each time.

If you add the new logic this time and also split it into four 500-line methods and maybe a few extra tests, you have done quite a lot and it is likely doable within the time frame of the work you are doing.


If there are zero tests and you aren't confident that you can create those tests then I'd bring it up with management. Maybe they'll say that changes in this functionality will be very rare after this small change and that it's very well tested manually and by customers - then that's it. Not all code has to be made concise and elegant, it's better to focus your effort on the code that regularly needs changing. However, in this case I'd ask management to consider not changing it at all, or make sure it will be very well tested manually after your changes).

wnevets 2 days ago 0 replies      
I would add landmarks and do small refactoring within the function until I'm confident in my ability to start splitting it up into smaller functions. This should happen naturally as you make changes and add new features. However if you're not in the function enough to make this happen then it's probably not worth refactoring to the business.
ufmace 2 days ago 0 replies      
Start out by studying and understanding the function, the way that it's used, and everything that it does. Does it mess with a lot of global state? Is it called on one place for one thing, or a whole bunch of places, or even for multiple different reasons? How hard would it be to set up some unit tests?

I would recommend against any kind of rewrites or radical refactoring right away. You probably don't know what it does well enough yet or what kind of workarounds and bug fixes are in there, so you're likely to bring back bugs. And not many businesses have the time to spare to actually redo something like that correctly all at once.

Aside: You could just give up and quit, but I consider it part of the job of a good developer to be able to take a mess of spaghetti code and gradually turn it into something easily understandable without causing huge delays in business processes or show-stopper bugs. I don't think a developer who is only willing to touch pristine code is very valuable in the real world.

I'd make the first goal to add the required changes with as few changes to the function as possible. Focus your refactoring work at first on trying to get some tests around this thing. Don't try to test every use case right away, but do try to comprehensively test a few tasks, including capturing whatever it does to any state in any other systems. Most likely, a lot of the initial refactoring work will hardly touch the function at all, but instead focus on putting the things that it touches into modular, testable parts. Getting good tests around it will help you understand what it does better, what parts of it are important, and how state is handled around the system.

Then as you go, start adding tests, and gradually refactor things that are tested. Write tests for any bugs that are reported back to you. Anything that looks weird, ask around and see if you can figure out what it's for and if you really need to test for it.

rbrogan 2 days ago 0 replies      
You could start by writing comments. There is little chance of any bugs coming from that. If there are any tests available then you could work on understanding the tests and then step through the code in the debugger. Hope that helps.
tienthanh8490 2 days ago 0 replies      
I know other people already suggested writing test, carefully documenting etc so I won't repeat that. Just want to add one more thing: try to prune the code first as such a large codebase is likely to have redundant code built up over time. By doing this you will have some time to understand the code (to know what you can kill and what you can't), and also save yourself some time as the codebase you have to refactor now is now much shorter and probably cleaner.
agentultra 2 days ago 0 replies      
I've had to do this once. They don't teach you managing code like this! A friend gave me a copy of Working Effectively With Legacy Code[0] which helped me.

The gist of it: a strong suite of integration and unit tests. Isolate small code paths into logical units and test for equivalency.

[0] http://www.amazon.com/Working-Effectively-Legacy-Michael-Fea...

odonnellryan 21 hours ago 0 replies      
You should read Clean Code, even if it is just the bits on refactoring, so you can refactor properly! :)
timonoko 2 days ago 0 replies      
I remember linear lists of 1000+ if-statements. These were "state machines", popular form of real-time multitasking 50 years ago. Nothing wrong with that. You might make an analyzer which recognizes longer series of events and impossible states, but why bother. This is a programming paradigm, best you can do is to go with the flow.
frozenport 2 days ago 0 replies      
Where a function ends and where a function starts is somewhat artificial. For example, if this were BASIC it would be just be a label.

I would read the thing a few times and figure out exactly where to add the functionality. Refactor second, if time permits. If the thing is 2k long clearly, refactoring it isn't a priority.

there4 2 days ago 0 replies      
This is a great presentation about refactoring that may be useful: "RailsConf 2014 - All the Little Things by Sandi Metz"https://www.youtube.com/watch?v=8bZh5LMaSmE
lectrick 2 days ago 0 replies      
1) Cover code with tests2) Refactor. Martin Fowler wrote a famous book on refactoring patterns that are guaranteed to merely transform the code and not break functionality.3) Rerun tests, repeat till everything passes
tahssa 2 days ago 0 replies      
Do a re-write. If your manager says no to the re-write then add another if condition to handle the current business logic and, at the same time, look for a new job (which is probably what the last guy did).
scarface74 2 days ago 0 replies      
It depends on the tooling you have available. If I encountered a 2000 line C# method, I would use Resharper and start with the extract method command and then extract class.
quintes 1 day ago 0 replies      
unit test first so you know if you've broken it. Then lots of test input variations best taken from production sources.

Refactor thereafter and test after each iteration of changes. It's not a rewrite, so don't lose the plot just Refactor into smaller methods :)

panamafrank 2 days ago 0 replies      
quit, get a job working in a newer more modern language or just a company working on 'green field' projects. I worked on legacy code bases for ~3 years as a junior grunt and it contributed to some kind of PTSD-lite disorder.

or read the 'ol refactoring book...

zippy786 1 day ago 0 replies      
Send it to me with requirements, I'll do it for 500$
jarsin 2 days ago 1 reply      
Get a new job :)
sharemywin 2 days ago 0 replies      
you probably need a ton of unit tests for this thing.
zerr 2 days ago 0 replies      
Do not touch it.
davidw 2 days ago 0 replies      
Indeed.com, Craigslist and maybe Linkedin.
PaulHoule 2 days ago 2 replies      
Yes, just don't use the word "shit".

The obvious refactoring is to split the function up into smaller pieces, even if you can split it into two 1500 line functions that is a win.

ACH File Parser
1 point by mortizbey   ago   1 comment top
mattkrea 1 hour ago 0 replies      
       cached 22 January 2016 05:05:01 GMT