good Monday morning I am mpj and you are
watching fun fun function this is part 2
of the questions and answers our double
episode vacation Edition I’m doing and
I’m recording both of these at the same
in the same day which makes it super
easy the previous episode is there what
was the most difficult bug or problem
you face and how did you solve it
oh man back when I was a much younger
programmer I did the e-commerce back-end
for my own company at the time and we I
did it in asp.net asp.net has had at the
time this very cool thing I think it was
called the data set not sure exactly
what but it was you could basically load
at your database into like in memory
state and then you performed operations
on it and you said sync and it
automatically synced down to the
database it was strongly typed and it
was I was super cool so I used that and
things were great dandy everything
worked it was a right whoo architecture
he wasn’t really but I thought so at the
time and as endless time progressed are
we we got more customers and I decided
to buy a new server a Pentium 4
hyper-threading server we moved aside to
the new server and ah yeah everything
was a lot faster but just subtle weird
things started to happen people would
report that things were disappearing
from their shopping carts and they were
reporting that they were paying but
their order was not being showing up as
paid basically they were reporting the
worst possible bugs and e-commerce site
could have but actually not it turned
out to be even worse because those
people ended up like the payment that
they did ended up paying the orders of
other people so there was a payment that
just they chose away and then it hit
another order
it was just nightmarish and this was
because the data set that back to fright
that was not that was never intended to
be a thread safe so when we introduced
this hyper threading server which was by
this time life it was pretty uncommon
with multi-core processors but this was
this was actually not multi-core but it
behaved sort of like a multi-core so
when multiple sessions started messing
with the data set at the same time Duke
things broke and again this was pretty
early in my programming career so this
was this was the first time I
encountered a problem with concurrency
the short term fix that I did for that
was basically just to create a big look
in the application a global lock so when
one one session needed to interact with
the data set it would basically just
grab the global lock and say that nobody
else is allowed to write to this data
set until I’m done and then it will do
its thing and then release the lock
which was just a dreadful solution
because it completely negated any
performance benefit from the hyper
threading server I don’t think we ever I
don’t think we ever made a good solution
for it in that version of the code base
I think we just eventually rewrote it
and created a completely new stack then
a whole ordeal taught me a lot about
concurrency but most importantly it
created the credit isn’t a pain in me
related to concurrency it taught me that
it’s really really important I like in a
core level ah that to think about
concurrency learning through fire and
brimstone thoughts on ORM versus plane
sequel versus some hybrid ORM
if you don’t know what Oh forums are
it’s it’s a layer that you put between a
relational database of no sequel
database and your object oriented
architecture and it kind of creates this
this mapping between your objects and
classes and and the database I
a lot of them I’ve worked a lot with
orange in my day and they were very cool
when I first encountered them and over
the years I have concluded that they are
basically insanity you should use them
there are sane people that do disagree
with me on that but there are no sane
people saying that you should use a
complete over a model you should always
use the last hybrid model even like Oren
and hibernate guide he wrote a blog
article recently saying that I’ve never
said that this should be used for
everything like our ends are really good
for like some parts of Europe but when
you find yourself with a tricky query
you should you should just use sequel
it’s dumb not to use sequel for what
it’s for but I I personally don’t think
that there is a valid use case for them
ever it’s whenever I’ve used it or I’m I
always end up with this annoying middle
layer that I had to coerce into doing
what I want and it’s always end up being
really inefficient and convoluted what
an Oren tries to do is that it tries to
encapsulate your interaction with the
database and encapsulating is very very
hard thing to do
correctly whenever I try to encapsulate
something it’s very often that I fail
the encapsulation just ends up being it
not really encapsulated I I the purpose
of the encapsulation is so that I don’t
have to think about what it encapsulates
but often I fail in that mission and I
just when I interact with the
encapsulated thing I also need to at the
same time think about what’s inside the
encapsulated thing thus defeating the
purpose with the encapsulation in the
first place and I found that our chances
of me failing with encapsulating
something they increase the the more
complicated thing
is that I’m trying to encapsulate my
chances increase if it’s just a very
simple thing a very narrow thing that I
want to encapsulate like our make order
or something like that it’s very narrow
it just does one thing but if you try to
encapsulate something as generic as
interacting with the database in my
experience that that then it kind of a
capsulation is almost bound to fail
trying to encapsulate something as
generic as database interaction that is
that is almost definitely bound to fail
nowadays I really like being close to
the metal of the database just do the
query create objects from that query and
unreturned it it’s not that hard it’s
very clear what is happening it’s very
easy to track it easy it’s hard to write
bugs in that code it ain’t nice you
don’t need an ORM I shouldn’t tell you
what you need I don’t feel I need it and
coming from c-sharp
do you miss types in JavaScript I used
to be a seizure programmer ah no I often
ask myself why though it’s very weird um
I also recently talked to a Anandi see a
short programmer who has recently
started doing jeaious and he’s doing
this project where he does the backend
in node and I just asked him like ah why
do you do it like as a c-sharp program
or why do you do it voluntarily in node
when you could be doing it in c-sharp
and I asked it because I I felt the same
way I would have built it in node
ah but I I just couldn’t put my finger
quite what what that was and he said
that he just feels a lot more productive
in jazz and I can really relate to that
and what he said it disturb him that he
just couldn’t write something like this
in NC shop just declare a function it
has arguments a string that is argument
text and then you know edit it the
implementation like JavaScript doesn’t
stand in your way
it just lets you do the thing that you
want to do directly and you do it I mean
it doesn’t hold your hand this allows
you to do a lot of stupid things but I
think that the reason I don’t miss types
as much and he doesn’t miss types much
either is that we are both very
aggressive unit testers I think that
helps a lot because it gives you a lot
of the safety that a type system does
doesn’t catch all the problems that a
type system checks like I don’t want to
put a time system down too much because
strong typing strong static typing I
think it’s actually proven in studies
that it creates it tends to have a
slight quality improvement but for me
personally a weekly typed programming
language that is very focused on letting
me do what I need to do coupled with a
really good unit testing suite that
creates a very productive and safe
environment for me to work in and I’m
very happy about it as a junior dev how
much should you know how much are you
allowed to Google I don’t know how much
are you allowed not to know well you’re
allowed to Google as much as you want
this is not school you’re employed to
solve a problem nobody cares if you
solve that problem by googling or if you
solve it by remembering it from another
googling when we do interviews at at
work I don’t we never ask for like
things that you can easily Google I
think that the interviewee should
essentially be allowed to just google
things if if you ask questions like that
I think that they’re basically useless
questions just memorizing facts that’s
not a very useful skill as a developer
ah what is a useful skill is you know
understanding the computer thing what
I’m looking for in an interview is not
stuff like that this is what I mean I
wanna know what this this person is
except for googling do they know how if
it’s a web developer do they know how
the internet works one question I was
asked when I
was interviewed at Google what I really
like the question it was if you type an
address like yahoo.com into the browser
and press Enter what happens at where is
it sent and how does the web page end up
in your browser how does everything work
they’re having a person explain all that
and more importantly because there’s
gonna be steps where a person you know
doesn’t know and they are sometimes they
are often able to reason their way to
the next step that’s also very important
like does this person have this innate
understanding because I’ve used
computers for such a long time today we
have been programming for quite a while
do they have a feel for how things are
put together my advice are to you as a
junior dab is trying to always keep a
healthy interest in what you’re doing
like when you learn something try to not
just learn how to use it but try to
learn why it’s there and a little bit
like dig a little bit under the scenes
of how does this work and how does this
tie together with everything because a
good interviewer will ah with know the
difference our app if between you just
knowing the upper layer of things or if
you’re the kind of person that takes a
little deeper that’s it for the second
and final part of this questions and
answers episode vacation edition next
week we are back to our ordinary
scheduled program you have watched
episode of fun fun function I release
these every Monday morning Oh 800 GMT
time this episode was a bit weird
because I’m in one vacation but the
other episodes are kind of like this you
should you gotta check out the channel
below check out some of the other videos
and see if this channel is something
that you could
maybe consider subscribe if you I am mvj until next Monday morning stay