I am programming an ecommerce website and I know I am going to add a blog to the mix. I am unsure, however, if it is better for me build the blog portion into the website or could I just use a service like Tumblr or wordpress and host it somewhere else.
It depends upon what you are talking about.
For example, if your blog ends up being under another domain such as example.blogger.com, then I would say do not do this. However, if you can create a sub-domain of your own domain, then this would be fine. The danger is if you do host your blog on another site and create a sub-domain that points to the other site. For example, if content can be found on both example.blogger.com and a sub-domain of your own parent domain, that would be bad.
Another example. If you can host an application within a sub-directory within your own site, then that would be best. The reason for this is simple. Assuming that your company blog remains on-topic, then you significantly increase your search potential. If you use a sub-domain versus a sub directory, it does not help the company's domain but rather the sub-domain.
There is a lot of debate on the web, sub-domain versus sub-directory, however, the argument has been settled on this site. Using a sub-directory is always better unless it dilutes the topic of the parent domain. However, if the topics are complimentary, then it is always better to host a blog on the site itself. Not on a sub-domain. Not on another domain. But on your own domain.
There are advantages and disadvantages to each option and there is much discussion about this that there is no definitive answer. But I would recommend building the blog portion into the website for the sole purpose of control.
You have less control when hosting with a third party service like Wordpress or Tumblr, though you can also do both (host it on the site and use a third party service) but you will have double the efforts in doing so.
It is better you to build a blog portion into the website because creating blog for the website really add a unique functionality to the website. By adding a blog to your websites enhance a lot of traffic towards your website and business. Blogging is the best way to drive traffic and reach your website at the top.
Would recommend hosting it on your own. Lets assume your website is :
Then a good blog url would be : http://www.example-commerce-website.com/blog/
and an example blog entry url with a slug : http://www.example-commerce-website.com/blog/smartphone-price-trends-2016
This way the SEO authority of your root domain grows stronger. And with same domain for both your website and blog, you will have to host the blog.
For hosting your blog on other platforms say wordpress or Tumblr with hosting service and custom domain name, you will not be able to use your www.example-commerce-website.com as the custom domain name there as DNS would map to your ecommerce website servers. So,host it on your servers only.