Live data from Hacker News

Ask HN: What has made you a better problem solver in software engineering?

news.ycombinator.com

31–40 of 68 posts

Re: Ask HN: What has made you a better problem solver in software engineering?

#31

Some things that have helped me: 1. Look at prior art. Many problems have been solved before. It can be more fun to dive in and create your own solution, but looking for previous solutions first often saves time, results in a better solution, or may show you that you don't need to write the code in the first place. 2. Write down the problem you are trying to solve before solving it. 3. Solve the problem multiple time…

>It doesn't generally help with big systems design

What do you think helps specifically with that?

Re: Ask HN: What has made you a better problem solver in software engineering?

#32
Always asking "why".

No one will ever successfully transfer the problem in their head to your head first try. You will need to ask a lot of questions to try and bring your understanding near their understanding.

Equally you need to actually understand why the problem you're solving is a problem. If someone wants the header on their website to be bigger, that's a very easy thing to do but there's always a reason why they want it bigger and knowing that will help you do it properly.

Also, always ask why whatever solution you came up with works. There are very few situations where the actual answer is "Invoke these magic runes in the right order and pray". Spending the time to find out what the magic runes are and what they do will help you make sure that a) The problem won't come back b) Your solution is actually a good one c) You can solve similar problems in the future.

Re: Ask HN: What has made you a better problem solver in software engineering?

#33
Fixing bicycles.

all the normal pain points are there: proprietary standards, 16 standards, major tooling fights, bandaid fixes that “we’ll refactor later”, tech debt, etc.

But the architecture is really really visible. And when you’re done you have a bike!

Re: Ask HN: What has made you a better problem solver in software engineering?

#34
Start at the bottom, make your bottom layers solid first.

You can't reliably deduced anything about what your current problem is, if the things it depends on are flaky.

Design by Contract. Understand it. Used it. Turn your asserts on always.

Turn on all warnings that don't give false positives that your compiler / tools provide.

Fix them don't mute them.

Run around your code base and find every damn place where some damn fool has discarded an error code and check and report all failures.

You'd be flabberghasted by how many "it's impossible" bugs I have found and fixed by that one simple action alone!

Re: Ask HN: What has made you a better problem solver in software engineering?

#35
post #21

Throwing away assumptions and trusting nothing, where it makes sense to do so. I've been burnt too many times by library bugs, framework issues and the other layers between me and what I'm actually doing. When I first started out I used to think that browsers such as Chrome were infallible and any problems had to be with my code. As a result of being burnt, I'm happy to give up on logging and trawling through code in…

> ...where it makes sense to do so. Certainly being able to trace code is one skill, and knowing how deep to go is another.

Yes, exactly! If I gave up on my language's debugger or compiler every time I was troubleshooting something because I didn't trust it, I'd waste an absolute ton of time. I think finding a balance is important, but also not being afraid to consider the possibility that libraries, browsers and tools that you generally don't consider flawed might have their own issues.

Re: Ask HN: What has made you a better problem solver in software engineering?

#36
a few principles I've found helpful:

There are no coincidences, unless proven otherwise.

If something smells wrong, it probably is. Trust your gut.

Make sure you're building the right thing, before you build the thing right.

Don't be clever. Elegant one-liners that make you feel like a genius when writing it are probably not very maintainable.

The second best piece of code is the one you just deleted. The best one is the one you didn't write in the first place.

Plan to fail, and gracefully degrade.

Re: Ask HN: What has made you a better problem solver in software engineering?

#37
post #21

Throwing away assumptions and trusting nothing, where it makes sense to do so. I've been burnt too many times by library bugs, framework issues and the other layers between me and what I'm actually doing. When I first started out I used to think that browsers such as Chrome were infallible and any problems had to be with my code. As a result of being burnt, I'm happy to give up on logging and trawling through code in…

To be honest, for me the point where you discover "this media query does not behave correctly on this device that I need to support" is where you stop digging and find a different solution for detecting pointing devices.

It's very clever that you managed to discover a bug in OnePlus's version of Android but then what?

Re: Ask HN: What has made you a better problem solver in software engineering?

#38
use proper logging with log levels.. just being able to switch on debug level and get a wealth of info is a big step in the right direction.. my debug lines have method names and line numbers.. I take this so seriously that I have my custom logging method for bash and python (I script a lot in both).. I drop a lot of info lines as I code and switch them debug once I'm finishing up..

confirming fundamentals is another tried and tested method..

other than logging and methodology, having the right tools is important.. I use pudb for my debugger in python.. and bash -xv for shell..

error reporting is also important.. I use 'trap' and set -E in bash to capture all errors, provide a lot of info and even email it to me..

in python I have exception hook.. I even monkey patched threading to report its uncatched errors to the main threads exception hook (I use python2.7 for work.. this is fixed in latest python3)

during my dev phase I always give more time to coming up with a solution vs with running with an idea.. this allows you to engineer a solution..

and lastly.. in my down time I think about the problems I couldn't solve at the desk.. this could be when I'm about to sleep.. when I'm playing pool.. etc.. I find that solutions come easier at these moments..

Re: Ask HN: What has made you a better problem solver in software engineering?

#39
post #34

Start at the bottom, make your bottom layers solid first. You can't reliably deduced anything about what your current problem is, if the things it depends on are flaky. Design by Contract. Understand it. Used it. Turn your asserts on always. Turn on all warnings that don't give false positives that your compiler / tools provide. Fix them don't mute them. Run around your code base and find every damn place where some…

My coworker is a fan of:

  try: 
    something() # that throws nonfatal errors frequently
  except:
    pass

"it saves time in development" they say. Good luck if something in that (non trivial) function call breaks.

Ugh.

Don't be like that.

If you don't know the precise error, heres the solution (in python):

  except Exception as exc:
    log("{}: {}".format(type(exc).__name__, exc))
Bingo, you now know what to catch. Catch that error, move your broad exception down (or remove if you can)
Post reply on HN