
I wrote the SQL query in 5 mins. Why does my engineer say it will take a month? - atomos
https://wtfismyengineertalkingabout.com/2017/03/11/i-wrote-the-sql-query-in-5-mins-why-does-my-engineer-say-it-will-take-a-month/
======
unethical_ban
On the flip side, when something DOESN'T need HA, sub-millisecond query
response time, or lynx and IE Edge compatability, people need to know when
"good enough" is good enough.

On my ops team, we've gotten some flak for not building robust enough of a
request queue for some tasks. But it's been down several hours in the past
year. The server almost never needs maintenance. None of the workload is real-
time. App restarts are acceptable if memory leaks occur.

If we did everything by the enterprise book, we'd still be 70% of the way to a
deployed product, instead of 15 months into its completion.

~~~
arethuza
I once had an infrastructure guy who worked in the same company quote me £70K
for new hardware to host a single static HTML web page.

£70K of new hardware!

I stuck it on an existing server and nobody noticed though I might have got
into trouble with the Change Prevention Board for not using the right form or
something...

Edit: He did have a carefully worked out explanation of where the money had to
be spent.... which I ignored after hearing "£70K".

~~~
mabbo
Tsk, poor choice on your part. You should have started a side consultancy (get
a spouse to own it maybe?) and say that you can do it for a mere £40K.

Then dump the static file on S3, and let the interest from the £40K in your
bank account pay for it.

~~~
WrtCdEvrydy
Okay, that sounds pretty cool. S3 can host static HTML files?

~~~
Luuseens
Yes, I host my blog that way:

\- Generate static files using Pelican

\- Dump the files to S3

\- Set up Route53 to point a domain at the bucket

\- Set up CloudFront (Amazon's CDN) to sit in front of the S3 bucket, since I
found pure S3 to be too slow

Works incredibly well.

~~~
Pxtl
Why use Amazon for static pages? My github page works just fine.

~~~
projektir
I believe Amazon is more robust if your website gets hit by a lot of traffic.

~~~
Jack000
keep in mind S3 bandwidth is roughly 20~30x more expensive than a VPS.

I put my photo/video blog on S3 reasoning that it'll handle spikes better. At
one point it reached the front page of HN and cost me $450. Afterward I looked
at the logs and found that my single $20 linode would have handled it fine...

~~~
mabbo
Definitely depends on your requirements. AWS can indeed charge a bit for
bandwidth.

But if you're talking about small static websites, AWS gives you an easy
interface, Cloudfront, Route53, etc. It's a very easy way to do some very
complex things.

You might also look into billing alarms. I've got some simple background jobs
that I run on lambda, pulling some files to S3 every hour. It costs me a buck
or two a month. But if it ever looks like it might charge me $20, it will
alarm and email me.

------
AnonNo15
"Maybe you ran your SQL query a few times, fixed the errors you got, eyeballed
the results, and called it a day. That’s not good enough for code integrated
with a product."

Biggest lie ever. That's pretty much a production-quality code here.

~~~
bykovich2
You ran it more than once? That's battle-hardened, in my book.

------
coding123
You definitely need to think through your requirements or you end up with
this:

Asked to get some kind of analytics query to someone, and they need it fast
and want it in some kind of visualization tool.

1\. You open Zeppelin, take a bunch of database tables and whip out a query
that is basically what they want and export it to an Elasticsearch + kibana
instance.

Now comes the edge cases:

Oh I forgot, it needs to be on the internet

2\. Need to set up a public IP, DNS, Nginx server and a series of rules to
make it read-only (and it's still dangerous mind you)

Why isn't this password protected?

3\. Add a nginx basic-auth with a single password

It needs to be available to admins and sales managers only.

4\. Set up ngx_http_auth_request_module to hit the our authentication server
(the cookies should be present - OHH the DNS name doesn't match the cookies.
Set up a /subpath on the existing application.

It needs to work as an embedded view in the company's mobile app.

5\. That uses tokens not cookies, so the auth-request module no longer works
for this, need to come up with a SSO solution with a cookie and a place to
store the cookie in a database. That requires a REST service on the existing
app server, which will require a redeploy.

I just added a product to our system and it's not in Kibana

6\. Need to modify the spark code to use spark streaming

The Spark server restarted and my new products aren't showing up!

7\. Need to set up a service on the system to auto-start the spark job.

It is feasibly an actual product feature at this point, but (1) was asked for,
but they really wanted 1 - 7. I would argue that (1) would only take 25% the
time 2-7 takes to do. Not every product change is like that, obviously, but
sometimes people think all changes are just so simple. Often it's the history
and unstated features that make a huge difference.

Also this for fun: [http://outofmymind.scanlen.com/wp-
content/uploads/2011/04/Wh...](http://outofmymind.scanlen.com/wp-
content/uploads/2011/04/What-the-Customer-Wanted.jpg)

------
Declanomous
> Nothing ever works as soon as an engineer writes code; it is an iterative
> process.

One of my complaints about working in an environment where I am the only
person who can program is that nobody else understands this. I've taken the
time to explain this point to people, and they seem to grasp it fairly well,
but once they see something that somewhat resembles the final product they get
really impatient.

The last 25% of functionality takes far more time than the first 75%,
especially once you consider handling edge cases, etc.

~~~
taneq
Pro tip: Do the user interface last. Or, if you need to do it first for
prototyping / mockup reasons, _don 't show it to anyone you don't have to_.

Learned that one in my first ever project. We mocked up the entire application
in Visual Basic (just windows and buttons, no actual functionality
implemented, we just wanted to know if it'd work for them) and then the client
got really upset when we couldn't come round and install it the next day.
Classic case of failing to manage expectations.

~~~
acdha
That one's hard, however, since it's frequently the case that the user
interface is what makes it real to people and leads to plan revisions once
they realize that e.g. the cool visualization they asked for doesn't work with
100k data-points.

I haven't found a way around this other than careful communication, which
works with most but not all clients.

~~~
woliveirajr
Perhaps doing the user interface in a mockup way. I mean, really like it was
draw on paper and not a software-looking software.

Like this: [https://media.balsamiq.com/img/examples/wiki-
sketch.png](https://media.balsamiq.com/img/examples/wiki-sketch.png)

------
cnnsucks
Because your "5 minutes" is pure bullshit and your engineer knows it.

Your engineer knows that if she writes your "5 minute" query without careful
analysis, peer review and documentation and the query ever produces a
questionable result --- whether it was anticipated by your requirements or not
--- it's your engineers ass; you'll throw your engineer under the bus
_instantly_.

Your engineer knows that if she writes your "5 minute" query and it produces
any actual value you'll be back the next day with a "5 minute" enhancement.
Anything you ask for that might matter the next day has to be built to be
maintained by others because if she happens to take the day off when you show
up and demand a revision to your "5 minute" wonder query and there is nothing
for the other engineers to go on (revision controlled work, documentation,
etc.) then that's her ass; she knows you won't stand up for her.

Your engineer didn't just fall out of the boat and is in no hurry to obligate
herself to take responsibility for your adhoc miracle queries and the
questions that will emerge when you go waving the output under everyone's
nose, and she knows that's exactly what you'll do with it. Your little query
is _your_ view of the world and that view is _highly unlikely_ to survive the
first bit of scrutiny that's applied by anyone other than yourself, much less
the second.

~~~
hermitdev
I had a veteran DBA close to retirement (she was my cube-mate) warn me about
this when I was an intern. I had a very simple request come in to update some
data. Didn't even take 5 minutes. She told me: never do the simple tasks
immediately. Sit on them for a bit. Business users don't understand complexity
of different tasks and think they should all take the same amount of effort.
So, if you do one thing in just a few minutes, they'll expect everything to
take the same amount of time. In my experience, it's proved to be true.

~~~
technofiend
I heard a story from an ex-wall-street engineer who related he was once asked
to fix a message passing system so that it could now pass something like 10 x
as many messages per second that before. He rewrote it and it now passed 1000
x messages / sec. He _almost_ turned it in that way and then realized he was
undercutting his future self. So he backed off the improvements to the
required 10 x. Sure enough he got a big bonus and kudos for his work and a
year later he was asked if he could pull another miracle out of his hat.
Indeed he could. He sat on it for weeks, updated one line of code and then got
another big bonus. LOL.

~~~
hencq
Haha, that reminds me of the speed-up loop:
[https://thedailywtf.com/articles/The-Speedup-
Loop](https://thedailywtf.com/articles/The-Speedup-Loop)

------
sofaofthedamned
Had a similar thing a while ago. Very complicated IPSEC tunnels, routers
switches firewalls and whatnot between us and our customer. Customers techs
were - not great - so needed to make sure port 443 worked through the tunnel.
Our side mainly Linux, theirs was mainly Windows 10.

Asked a programmer our side (.net) who said it'd take a couple of hours to
write a simple webserver, package it up into an .msi and give it us. I got
annoyed, did it in Golang in about 10 lines of code.

I then realised i'd compiled a Linux executable on Linux, remembered it did
cross-compiling, 10 seconds later I had a Windows .exe. All for a simple
webserver that printed "cock", not useful but it proved the tunnels worked.

Sometimes we overcomplicate the simplest shit.

EDIT: As it wasn't clear (my fault) - we were trying to get to port 443 at
their end - they were on Windows, we mainly Linux but the guys I asked were
.net programmers..

~~~
kogepathic
_> Sometimes we overcomplicate the simplest shit._

Indeed. Why not use nc and telnet on port 443 to test? Linux already has nc
and Windows already has telnet.

~~~
sofaofthedamned
The endpoint at their end was Windows. No nc. Apologies if that wasn't clear.
I was testing our end reaching their endpoint at port 443.

~~~
catmanjan
nc is the client, if you could host a webserver surely you could have run
nc...

~~~
kogepathic
Actually I misunderstood and thought the server was Linux.

You could of course use nc as the client too, but it would be an additional
install on Windows. [0]

And nc wouldn't help if the firewall was stateful and actually expected to see
HTTPS traffic on port 443, so I do see their logic of putting an actual
webserver there.

But without sufficient detail, it does seem at first glance to be overkill ;-)

[0] [https://joncraton.org/blog/46/netcat-for-
windows/](https://joncraton.org/blog/46/netcat-for-windows/)

------
kemiller2002
Unless I catch myself breaking my own rule, I never second guess my
developer's time estimate unless I think it's too short. I've been a developer
(still am one even though I manage people now too), and I've learned that I
can't factor in all the things going through that person's mind.

I have cleaned up too many messes because of negligence from people who do not
understand how hard programming actually is. That's what most people,
especially us developers at times, fail to recognize. That 5 minutes someone
took to write an "easy" query against the CI and deployment server almost
brought it down (true story, luckily I was monitoring it look at another
issue).

The ability to write code is taken for granted, because anyone can learn it.
Some programming is easy, and some is extremely difficult and the real trick
is knowing which. What scares me most about the code being written are the one
off queries, etc. The ones that will "only be used once" or "only for low
transaction instances". That's never true, someone will always have it laying
around for that time when "we just really needed to make that update".

An old boss of mine used to say "the perfect is the enemy of the good." This
is true, there are a number of times you need get something up and running and
worry about fixing it along the way. There are other times when that "good
little app" got used in the wrong way and cost us hours of downtime because of
a mistake due to rushing. Now the perfect solution doesn't look like it was
such a bad choice after all. I can wait a day or so for a query that I could
write in 5 minutes. In the long term, waiting a few extra hours isn't going to
impact anything that much. I'd rather the developer be through then explain
why no one went home that night because we had to clean up a mess.

------
bichiliad
This is a little off-topic, but I'm not entirely sure I understand who this
article was written for. It reads as a bit condescending to people who might
benefit from it (namely the hypothetical MBA who wrote the query), and most of
this is what engineers already know about.

------
pascalxus
Great Post! Most people understimate the depth of simple-looking tasks: it's
not just managers that make this mistake. Even experienced engineers can end
up not realizing all the complexity in the beginning.

------
philfreo
Nice. I wrote something similar [1] after noticing that it's easy for
developers to make this mistake too (especially more junior developers) --
once your proof of concept works, you still are far from shipping.

[1] [http://philfreo.com/blog/the-last-20-before-
shipping/](http://philfreo.com/blog/the-last-20-before-shipping/)

------
trhway
seems to be apples and oranges. Ad hoc query vs. a modification/new feature of
a product. Depending on the product and dev process around it, it may take a
month even for the minor among minor modifications/features.

>Why does my engineer say it will take a month?

if you don't know the answer to that, you're a bad manager. Either you hired
bad engineers or you have no idea how your dev process works.

------
geori
Adam, great to see you on HN. I assume you're the same ABS that founded
calc.org. I always love seeing people from the TI Calculator community doing
well.

\- Harper

------
kristianc
This is a popular anti-pattern with a name - Yak Shaving:
[https://medium.com/@firehoseproject/a-guide-to-yak-
shaving-y...](https://medium.com/@firehoseproject/a-guide-to-yak-shaving-your-
code-d30f98dc759)

~~~
viraptor
That's not yak shaving. Yak shaving is trying to fix issue A and running into
issue B. So you try to fix issue B and run into issue C, etc.

This post is about engineering a future-proof solution rather than fixing
bugs.

------
kwillets
Because he's using Hadoop :P

------
SQL2219
SELECT * FROM ObviousTable?

------
wcummings
Ugh that domain. "my" engineer? Fuck off.

~~~
paulddraper
"my" parents?

"my" employer?

"my" spouse?

"my" country?

------
zitterbewegung
If I was a CEO, and wanted to create a way for me to analyze data and I don't
know much about efficiencies of SQL for ad-hoc analysis If instead I did have
an issue where I did create this issue while doing my ad-hoc analysis I would
try to search for solutions that would solve the problem. If this occurs then
you probably want a data lake or even a local version/snapshot of production
if possible.

