Detailed Notes
Software design is an art more than a science. However, we can follow a process that helps us find the proper requirements and points us to the best solution. These simple steps help us become a better developer.
You can find out more through our online classes at https://school.develpreneur.com and register for free. Registration will add you to our email list and you will periodically receive coupons for courses as well as notifications of the latest releases.
Transcript Text
foreign [Music] well hello we are going to essentially start a project but talk about uh really in this episode we're going to focus on the question how do I design software what's a good approach to designing software and like most things I think the best way to think through this is to walk through the steps a little bit and give us some experience in designing an application and so now this one while we're gonna go in a little bit different directions as we go through this this essentially series of of videos of tutorials of instruction we're going to build something that we're going to call the URL shortener now I need to be able to type there and we're going to do this in Python and so I'm starting out in pie charm which we can start with if you want you can go answer the question how do I download pycharm and it's free we're gonna there's a Community Edition so you don't have to worry about paying anything signing up for anything anything like that and then once we get installed we're going to come in here we're gonna do file new project and here I'm just going to give it a name so I'm going to call it your url shortener but I'm not a big fan of having a name of a project that's just blah like that so this is going to be the URL shortener let's call him uh let's just call them shorty we're going to call this project shorty so we're going to give it a name which is usually a good thing to do now for these I'm just using sweet python 3.9 I'm just taking the defaults we may come back later and change this but right now I just want to get a project started because what I'm going to do and it's going to create my little virtual environment is I am going to actually sort of build our documentation as we go so this gives me a sample python script so if I wanted to jump into terminal I could come in right here mine is actually called python3 so if I do Python 3 main bam hi pie charm so this is what this is we'll get into that a little bit later but what I do want is I'm going to take this and I am going to start by now let's see I'm trying to say if I want to do this right now let's start by right now let's just do a we're going to create a document so we're going to do here we're going to create a folder uh we will call it a directory sorry directory and this is going to be called documentation and then in here I have a new file and this is going to be the uh we'll say the application design and we're going to call it uh we'll just we'll do this we'll make it mark down we're not really going to use the markdown stuff too much but we're going to use that so MD so let's just start thinking about our design so first the let's say the goal first we're going to have a goal and so shorty is a URL shortener it it's going to take it takes a a URL it provides a shorter link for the user to use okay easy enough so let's say we're going to have some requirements here so that's our goal we have our requirements and here let's just do it this way we're going to do one is we're going to be able to so we're gonna a little bit design but a little bit talk about requirements so we're going to be able to take in a URL provide a shorter one let's see short URL will be a uh let's see an address or server name because this is things like you know bitly or things like that address or server name and a parameter so let's say for example let's do an example here do an example I'm going to send it https developreneur.com switch article slash my really long article title I don't even do it like this because I think it usually does it like that is sent in in let's call it https going backslash uh short not SRV that's necessarily what it's going to be called I was going to call one two three four five six it's returned and then uh let's go here and then using the returned URL will send the user to the original so we need to to store the original and the short link Maybe and something we might want to do is Let's see we may want to have some sort of allow for branding we'll come back to this later because it may be that they just want it to be something like it could be a server name or a IP address so it could be HTTP it could be as simple as HTTP because we can do it without secure because we really don't care so it could be like uh 25 at 26.27.29 I don't know if that's a server so please don't assume that but it could be it could even be on a Forks it could be we'll make it a port we'll do that and it would be one two three four five six so it could be that that is our link maybe not but that's you know that could be it or it could be you know brand dot me something like that so we may allow that do we want to allow for multiple users let's do we're going to have some sort of user user registration let's make that a question mark because we need to think about that a little bit because the idea here is okay you give me a URL and I'm going to give you back a shorter one and then when you hit that shorter one it's going to hit my server or some server preferably I'm assuming it's going to hit my server pass it that and then that thing essentially just going to do a redirect so it's basically the steps are first is send a URL new URL is returned call new URL and then redirect to we'll call it the source URL so it's a pretty simple application when you think about it even though it has a lot of power because it's often that you would want to take some really long nasty thing like this and this could be very complex because it could even have like a parameter um you can have a series of parameters whatever it is it doesn't matter what it is we're going to want to give a short one and just for this it is let's see let's just note um whoops where'd that goes six there let's sit this way okay and then what I want is uh each well okay so we don't need the actual URL to be the source URL to be unique so we'll allow that so if you three people send the same URL you could get three different short links but the short links must be unique because you have to know which URL you're going to go back to now we could potentially let's say this would be a question is do we want to log traffic or other info because we may at some point want to do something with that link and that will prompt the idea of a dfv value for value it's a question that we will answer actually all of these are going to be questions we're going to end up answering um so we have we get a URL so now this is and this is sort of that process of design isn't it all right what's our problem basically my problem let's say problem definition I have a long URL and need to provide a shorter one basically for things like business cards and stuff like that so that is my problem definition so my goal is going to be we're going to have this application shorty it's going to be a URL shortener we're going to take that long URL and we're going to provide a shorter link for the user to use and basically here's requirements this is roughly how it works let's move let's move up because let's say input and then just note let's see result so that's pretty simple so now we need to think a few things is so we're gonna have some questions how do we allow a user to send us a URL and give them a short one and then from that and the the rough thing with that is going to be and that's going to be sort of wrapped up into that which is going to be let's see Part B sort of spoiler alert on the answer is how do I create a an API using python and then we're going to use a thing called flask so this is going to be how do I create an API and using flask and we're going to do how do I test an API call and what this is going to be where do I download Postman because we're going to use Postman for this within this is how do I create whoops oops how do I whoop create a database and table in my SQL Marie Marie DB with python because we're going to do this very specifically we're going to script this thing out how do I have so we've got our testing so we're going to be able to create this oh how do I search a table for a record and this is going to be within a relational rdbms our relational database oops management system already BMS and then probably it's going to be how do I API from let's say an application the uh JavaScript and let's also say or python because that's actually the whole goal of this is I've got an application I want to do this from python so I'm going to do it from there so that gives us a pretty good list of getting started so we're going to talk about creating an uh API using python which I think it's probably going to be in here these will be sort of combined then we're going to talk about testing an API call which is going to be downloading Postman so that's sort of our part two how to create a database and how do I search those are going to be together and then probably within here is how do I write a an API endpoint in flask and where would I use post get delete types we're going to call that request types and we'll talk a little bit about that so that's going to be probably together as well so that's what's coming up this should be a pretty quick a little application but now we have several things here we've got several things that we have walked through we've sort of said hey what is all of this let's move branding and user registration let's move those back here and now that's totally offs out of number I don't know there we go five six seven eight um and so that allows so I'm going to say what is value for value how do I brand my um how do I let's see how do I allow for user branding of data and then use your registration so I have to think about this is how do I create a user let's see an application that requires these are registration and this will be a bigger challenge we get to this this one's probably pretty easy uh actually that one's gonna be difficulty so basically these are going to require us to build an application so this would be uh how do I build a web application with python because we're going to use it all we're going to be doing python throughout this although it should be pretty straightforward you could also roughly do this in just about anything else out there C sharp Java you name it a lot of things have this option different ways to skin this cap but we are going to do it with flask because that's a pretty cool little tool so let's go ahead and we'll sort of wrap this one up so now we this is how you design as you sort of walk through and say hey what is my problem what is the problem I'm solving okay what is sort of the goal what is the solution I'm thinking about maybe give yourself a couple examples to work with and then start walking through it it's like how do I get from point A to point B how do I get from my problem to my solution essentially and that's what we've done here and now we're going to dive a little bit further as we go and actually walk into this so if you come around the next episode most likely you're going to want to look at is how do we allow users send this URL and give them a short one which is basically how do I create an API using python how to create an S and actually this one I'm going to split this one up uh uh because we're going to do this most simply is we're going to actually do this code first do something very simple and then we are going to turn around and add to that so actually we're going to do this so now see so that design thing is what I'm going to do is first without doing the API I am going to actually we're going to actually start building this thing out in our scripts right away so stay tuned very soon we will be coming back or just click right ahead to the next episode and we're going to talk about how do we create something in Python that allows the user to give us a URL and we're going to give them back a short one thanks for listening thank you
Transcript Segments
foreign
[Music]
well hello we are going to essentially
start a project but talk about uh really
in this episode we're going to focus on
the question how do I design software
what's a good approach to designing
software and like most things I think
the best way to think through this is to
walk through the steps a little bit and
give us some experience in designing an
application
and so now this one while we're gonna
go in a little bit different directions
as we go through this this essentially
series of
of videos of tutorials of instruction
we're going to build something that
we're going to call the URL shortener
now I need to be able to type there and
we're going to do this in Python and so
I'm starting out in pie charm which
we can start with if you want you can go
answer the question how do I download
pycharm and it's free we're gonna
there's a Community Edition so you don't
have to worry about paying anything
signing up for anything anything like
that
and then once we get installed we're
going to come in here we're gonna do
file new project and here I'm just going
to give it a name so I'm going to call
it your url shortener
but I'm not a big fan of having a name
of a project that's just
blah like that so this is going to be
the URL shortener let's call him
uh let's just call them shorty we're
going to call this project shorty so
we're going to give it a name which is
usually a good thing to do now for these
I'm just using sweet python 3.9 I'm just
taking the defaults we may come back
later and change this but right now I
just want to get a project started
because what I'm going to do and it's
going to create my little virtual
environment
is I am going to actually sort of build
our documentation as we go
so this gives me a sample python script
so if I wanted to jump into terminal I
could come in right here mine is
actually called python3 so if I do
Python 3 main
bam hi pie charm so this is what this is
we'll get into that a little bit later
but what I do want is I'm going to take
this
and I am going to start
by
now let's see I'm trying to say if I
want to do this right now let's start by
right now let's just do a we're going to
create a document so we're going to do
here we're going to create a folder
uh we will call it a directory sorry
directory and this is going to be called
documentation
and then in here
I have a new file and this is going to
be the uh we'll say the
application design
and we're going to call it
uh we'll just we'll do this we'll make
it mark down
we're not really going to use the
markdown stuff too much but we're going
to use that so MD so let's just start
thinking about our design so first
the let's say the goal first we're going
to have a goal and so shorty
is a URL shortener
it it's going to take it takes a
a URL
it provides a shorter
link for the user to use okay easy
enough
so let's say we're going to have some
requirements here
so that's our goal
we have our requirements
and here let's just do it this way we're
going to do one is we're going to be
able to so
we're gonna a little bit design but a
little bit talk about requirements so
we're going to be able to take in a URL
provide a shorter one
let's see short URL
will be a uh let's see an address
or server name because this is things
like you know bitly or things like that
address or server name
and a parameter
so
let's say for example let's do an
example here
do an example
I'm going to send it https
developreneur.com switch
article slash
my really long article
title I don't even do it like this
because I think it usually does it like
that
is sent in
in let's call it https going backslash
uh
short not SRV that's necessarily what
it's going to be called I was going to
call one two three four five six
it's returned
and then uh
let's go here
and then using the returned
URL will send the user to the original
so
we need to
to store the original
and the short link
Maybe
and something we might want to do is
Let's see we may want to have some sort
of allow for branding
we'll come back to this later
because it may be that they just want it
to be something like it could be a
server name or a IP address so it could
be HTTP it could be as simple as HTTP
because we can do it without secure
because we really don't care so it could
be like uh 25 at
26.27.29 I don't know if that's a server
so please don't assume that but it could
be it could even be on a Forks it could
be we'll make it a port we'll do that
and it would be one two three four five
six so it could be that that is our link
maybe not but that's you know that could
be it or it could be
you know brand dot me something like
that so we may allow that
do we want to allow for multiple users
let's do we're going to have some sort
of user user
registration
let's make that a question mark because
we need to think about that a little bit
because the idea here is okay you give
me a URL and I'm going to give you back
a shorter one and then when you hit that
shorter one it's going to hit my server
or some server preferably I'm assuming
it's going to hit my server pass it that
and then that thing essentially just
going to do a redirect
so it's basically the steps are
first
is send a URL
new URL
is returned
call new URL
and then
redirect to
we'll call it the source URL so it's a
pretty simple application when you think
about it even though it has a lot of
power because it's often that you would
want to take some really long nasty
thing like this and this could be very
complex because it could even have like
a parameter
um you can have a series of parameters
whatever it is it doesn't matter what it
is
we're going to want to give a short one
and just for this it is let's see
let's just note
um
whoops where'd that goes six
there
let's sit this way okay and then what I
want is uh each well
okay so we don't need the actual URL to
be the source URL to be unique so we'll
allow that so if you three people send
the same URL you could get three
different short links but the short
links
must be unique
because you have to know which URL
you're going to go back to
now we could potentially let's say this
would be a question is do we want to log
traffic
or other info because we may
at some point want to do something with
that link
and that will
prompt the idea of a dfv value for value
it's a question that we will answer
actually all of these are going to be
questions we're going to end up
answering
um
so we have we get a URL so now this is
and this is sort of that process of
design isn't it all right what's our
problem
basically my problem let's say problem
definition
I have a long URL and need to provide a
shorter
one
basically for things like business cards
and stuff like that so that is my
problem definition so my goal is going
to be we're going to have this
application shorty it's going to be a
URL shortener we're going to take that
long URL and we're going to provide a
shorter link for the user to use
and basically here's requirements this
is roughly how it works let's move
let's move up
because
let's say input
and then just note let's see
result
so that's pretty simple
so now
we need to think a few things is so
we're gonna have some questions how do
we
allow a user to send us a URL
and give them
a short one
and then from that and the the rough
thing with that is going to be
and that's going to be sort of wrapped
up into that which is going to be let's
see Part B
sort of spoiler alert on the answer is
how do I create a
an API
using python
and then we're going to use a thing
called flask so this is going to be
how do I
create
an API and using flask
and we're going to do how do I
test an API call
and what this is going to be
where do I download
Postman because we're going to use
Postman for this
within this is
how do I create whoops
oops how do I
whoop
create a
database and table in
my SQL
Marie Marie DB
with python
because we're going to do this very
specifically we're going to script this
thing out
how do I have
so we've got our testing so we're going
to be able to create this
oh
how do I search a
table for a record
and this is going to be within a
relational rdbms our relational database
oops management system already BMS
and
then probably it's going to be how do I
API from
let's say an application
the uh JavaScript
and let's also say or python because
that's actually the whole goal of this
is I've got an application I want to do
this from python so I'm going to do it
from there
so that gives us a pretty good list of
getting started
so we're going to talk about
creating an uh API using python which
I think it's probably going to be in
here these will be sort of combined then
we're going to talk about testing an API
call which is going to be downloading
Postman so that's sort of our part two
how to create a database and how do I
search those are going to be together
and then probably within here is
how do I write a
an API endpoint
in flask
and
where would I use post
get
delete
types we're going to call that
request types
and we'll talk a little bit about that
so that's going to be probably together
as well
so that's what's coming up this should
be a pretty quick a little application
but now we have several things here
we've got several things that we have
walked through we've sort of said hey
what is all of this
let's move
branding and user registration let's
move those back here and now that's
totally offs out of number I don't know
there we go five six seven eight
um
and so that allows so I'm going to say
what is value for value
how
do I brand
my
um
how do I let's see how do I allow
for user branding of data
and then
use your registration
so I have to think about this is how do
I
create
a user
let's see
an application that requires
these are registration
and this will be a bigger challenge we
get to this
this one's probably pretty easy uh
actually that one's gonna be difficulty
so basically these are going to require
us to build an application so this would
be uh how do I build
a
web application
with python because we're going to use
it all we're going to be doing python
throughout this although it should be
pretty straightforward you could also
roughly do this in just about anything
else out there C sharp Java you name it
a lot of things have this option
different ways to skin this cap but we
are going to do it with flask
because that's a pretty cool little tool
so let's go ahead and we'll sort of wrap
this one up so now we this is how you
design as you sort of walk through and
say hey what is my problem what is the
problem I'm solving okay what is sort of
the goal what is the solution I'm
thinking about
maybe give yourself a couple examples to
work with and then start walking through
it it's like how do I get from point A
to point B how do I get from my problem
to my solution essentially and that's
what we've done here and now we're going
to dive a little bit further as we go
and actually walk into this so if you
come around the next episode most likely
you're going to want to look at is how
do we allow users send this URL and give
them a short one which is
basically how do I create an API using
python how to create an S and actually
this one I'm going to split this one up
uh uh because
we're going to do this most simply is
we're going to actually do this code
first do something very simple and then
we are going to turn around and add to
that so actually we're going to do this
so now see so that design thing is what
I'm going to do is first without doing
the API
I am going to actually we're going to
actually start building this thing out
in our scripts right away so
stay tuned very soon we will be coming
back or just click right ahead to the
next episode and we're going to talk
about how do we create something in
Python that allows the user to give us a
URL and we're going to give them back a
short one
thanks for listening
thank you