<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joe Mancuso on Medium]]></title>
        <description><![CDATA[Stories by Joe Mancuso on Medium]]></description>
        <link>https://medium.com/@joseph.mancuso?source=rss-a9dacdd54ccb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qAHcYcpuiqyU4QxdqCfFxQ.jpeg</url>
            <title>Stories by Joe Mancuso on Medium</title>
            <link>https://medium.com/@joseph.mancuso?source=rss-a9dacdd54ccb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:18:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joseph.mancuso/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Masonite Lessons — Using The Factory Pattern]]></title>
            <link>https://medium.com/@joseph.mancuso/masonite-lessons-using-the-factory-pattern-9b38bd21ef6e?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b38bd21ef6e</guid>
            <category><![CDATA[masonite]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 00:55:10 GMT</pubDate>
            <atom:updated>2019-01-27T00:55:10.517Z</atom:updated>
            <content:encoded><![CDATA[<h3>Masonite Lessons — Using The Factory Pattern</h3><h4>Preface</h4><p><a href="https://github.com/masoniteframework/masonite"><strong>Masonite</strong></a> has a lot of very front facing and explicit design patterns. It has always been my goal that developers using <a href="https://github.com/masoniteframework/masonite"><strong>Masonite</strong></a> will become better developers by being exposed to these patterns either by use or by reading about them in the documentation and understanding through real world examples.</p><p>I will be creating these articles that talk about various design patterns and how I use them in my applications on a daily basis.</p><h4>Introduction</h4><p>Design Patterns are pretty simple. We as developers encounter problems with our code. We as developers have 5 goals of software development is to deliver a product that is</p><ul><li>on time</li><li>within budget</li><li>fault free (no bugs)</li><li>satisfies needs now</li><li>satisfies need in the future</li></ul><p>We as developers need to be able to accomplish these tasks in a way that can satisfy needs now and in the future. These are problems developers face all the time. Throughout the years, developers have encountered the same issues over and over again and the same way a carpenter has “tricks of the trade,“ so do developers. These tricks-of-the-trade are called Software Design Patterns. They are simply solutions to problems we encounter all the time in our development life.</p><p>Once you start to get good as a developer, you will be able to map issues to certain design patterns and be able to layout a software architecture to fit the needs of the problem you are solving.</p><h4>The Pattern</h4><p>The factory pattern is used to instantiate an object at runtime. That’s it. It’s just a class that can return different types of objects dependent on whatever value is passed to it. For example you may pass in the value of `chocolate` into the `IceCreamFactory` and get back a `ChocolateIceCream` class.</p><p>This may need to be done at runtime which is where this pattern comes into play. The value of `chocolate` may be stored in a database column that is fetched for a certain user for example.</p><h4>Code Example</h4><pre>class IceCreamFactory:</pre><pre>flavors = {<br>   &#39;chocolate&#39;: ChocolateIceCream,<br>   &#39;vanilla&#39;: VanillaIceCream,<br>   &#39;strawberry&#39;: StrawberryIceCream,<br> }</pre><pre>def make(self, flavor):<br>   return self.flavors[flavor]()</pre><p>That’s it. We just created a factory using the factory pattern. Now all we have to do is specify a flavor we need and we can get back the correct flavor:</p><pre>flavor = IceCreamFactory().make(&#39;strawberry&#39;) <br>#== &lt;some.module.StrawberryIceCream&gt;</pre><h4>The Problem — Real World Example</h4><p>Here is a real world example of how I used this pattern. We are provisioning a server. For simplicity sake, we have 2 services we want to provision:</p><ul><li>Postgres</li><li>Nginx</li></ul><p>Now we need to provision both of these services on 2 different types of servers:</p><ul><li>Ubuntu</li><li>Debian</li></ul><p>Now notice here we have several different possibilities we can choose from:</p><ul><li>Installing Postgres on Ubuntu</li><li>Starting Postgres on Ubuntu</li><li>Stopping Postgres on Ubuntu</li><li>Installing Nginx on Debian<br>…<br>… so on and so forth</li></ul><p>There is an exponential number of possibilities, especially as we add new servers, new servers or add layers in between them (for example installing via docker instead of bash commands).</p><p>How do we solve this issue? A bit of a combination of several patterns but we’ll focus on the Factory for this article.</p><h4>Solution</h4><p>The solution here is to use 2 factories.</p><p>The first factory will be a ServerFactory which will be responsible for fetching any one of several servers (Ubuntu, Debian, Centos, ..).</p><p>The second factory will be a ServicesFactory which will be responsible for fetching any one of several services (Postgres, Nginx, RabbitMQ, ..).</p><h4>The Server Factory</h4><p>Using the boiler plate above let’s go ahead and create our ServerFactory:</p><pre>class ServerFactory:</pre><pre>servers = {<br>   &#39;ubuntu&#39;: UbuntuServer,<br>   &#39;debian&#39;: DebianServer,<br>   &#39;centos&#39;: CentosServer,<br> }</pre><pre>def make(self, server):<br>   return self.servers[server]()</pre><p>Notice we just changed out the ice cream flavors for servers (UNIX flavors?). <strong><em>You can actually copy and paste this boilerplate to create your own factories in your own codebase.</em></strong></p><h4>The Service Factory</h4><p>Now let’s do the exact same thing for services:</p><pre>class ServiceFactory:</pre><pre>services = {<br>   &#39;postgres&#39;: PostgresService,<br>   &#39;nginx&#39;: NginxService,<br>   &#39;rabbitmq&#39;: RabbitMQService,<br> }</pre><pre>def make(self, service):<br>   return self.services[service]()</pre><p>notice all this code is the same boiler plate.</p><h4>Combining The Factory</h4><p>Now if we think of it from a database perspective:</p><pre>A server <strong>has many</strong> services</pre><p>Right? Since a server <strong>has many</strong> services, let’s mimic that. Let’s make the UbuntuFactory have access to the ServiceFactory:</p><pre>from app.factories import ServiceFactory</pre><pre>class UbuntuServer:<br> <br>   services = ServiceFactory()</pre><pre>def connect(self):<br>   self.establish_connection()<br>   return self</pre><p>Boom. Done. Now our UbuntuServer has access to all of our services.</p><h4>Using It All Together</h4><p>Let’s go ahead and use these 2 factories in our application:</p><pre>from app.factories import ServerFactory</pre><pre>def show(self):<br>   user = User.find(1)<br>   user.server #== &#39;ubuntu&#39;</pre><pre>   server = ServerFactory().make(user.server) <br>   #== &lt;app.servers.UbuntuServer&gt;<br>   <br>   server.connect()</pre><pre>for service in (&#39;postgres&#39;, &#39;nginx&#39;, &#39;rabbitmq&#39;):<br>   server.services.make(service).install()</pre><h4>The Future</h4><p>Design patterns are useful for solving problems now and in the future. This pattern is useful because:</p><ul><li>supporting more servers is as simple as creating new servers.</li><li>supporting more services is as simple as creating new services.</li></ul><p>These two things can exist separately of each other and therefore can be scaled up or down separately of each other.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b38bd21ef6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Masonite Notifications]]></title>
            <link>https://medium.com/@joseph.mancuso/introduction-3ff5e7d6a988?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ff5e7d6a988</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 01:05:10 GMT</pubDate>
            <atom:updated>2018-07-30T01:07:04.221Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p><a href="https://github.com/masoniteframework/masonite">Masonite</a> is an awesome Python web framework that has been picking up a lot of speed in the past few months since the release of Masonite 2.0.</p><p><a href="https://github.com/masoniteframework/masonite">Masonite</a> Notifications can easily add new notification sending semantics for your Masonite project. These notifications could be sending an email or a slack message. This package is designed to be extremely simple and modular so allow new notification abilities to be added to it through third party integrations.</p><h3>Installation</h3><p>In order to get started using Masonite Notifications, we first have to pip install it:</p><pre>$ pip install masonite-notifications</pre><p>And then add the provider to our PROVIDERS list:</p><pre>from notifications.providers import NotificationProvider<br>...<br>​<br>PROVIDERS = [<br>    ...<br>    NotificationProvider,<br>    ...<br>]</pre><p>Thats it! Let’s see how it works!</p><h3>Usage</h3><p>There are a few concepts we’ll need to cover so you can fully understand how Notifications work. First we will cover the high level stuff and then slowly work down into the lower level implementations. For the purposes of this documentation, we will walk through how to setup a welcome notification so we can send an email when a user signs up.</p><h3>Creating a Notification</h3><p>In order to use it we can create a notification class. We can do this simply with a new craft command.</p><pre>$ craft notification WelcomeNotification</pre><p>This will create a notification in the app/notifications directory. Feel free to move it wherever you like though.</p><p>This will create a class like so:</p><pre>&#39;&#39;&#39; A WelcomeNotification Notification &#39;&#39;&#39;<br>from notifications import Notifiable<br>​<br>class WelcomeNotification(Notifiable):<br>​<br>    def mail(self):<br>        pass</pre><h3>Building Our Mail Notification</h3><p>Let’s now walk through how to build a notification so we can send the email to our user.</p><p>Since our notification inherits from Notifiable, we have access to a few methods we will use to build the notification. We’ll show a final product of what it looks like since it’s pretty straight forward but we’ll walk through it after:</p><pre>from notifications import Notifiable<br>import os<br>​<br>​<br>class WelcomeNotification(Notifiable):<br>​<br>    def mail(self):<br>        return self.subject(&#39;New account signup!&#39;) \<br>            .driver(&#39;smtp&#39;) \<br>            .panel(&#39;GBALeague.com&#39;) \<br>            .heading(&#39;You have created a new account!&#39;) \<br>            .line(&#39;We greatly value your service!&#39;) \<br>            .line(&#39;Attached is an invoice for your purchase&#39;) \<br>            .action(&#39;Sign Back In&#39;, href=&quot;http://gbaleague.com&quot;) \<br>            .line(&#39;See you soon! Game on!&#39;) \<br>            .view(&#39;/notifications/snippets/mail/heading&#39;,<br>                  {&#39;message&#39;: &#39;Welcome To The GBA!&#39;})</pre><p>Notice here we are calling a few methods such as driver, panel, line, etc. If we send this message it will look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*kNIuALkbD5xxYzy5.png" /></figure><p>Not bad. We can use this logic to easily build up emails into a nice format simply.</p><h3>Options</h3><p>For a full list of notifications, head over to the <a href="https://docs.masoniteproject.com/official-packages/masonite-notifications#options">Official Documentation</a> page to see a nice table.</p><h3>Sending the Notification</h3><p>Now that we have built our notification above, we can send it in our controller (or anywhere else we like):</p><pre>from app.notifications.WelcomeNotification import WelcomeNotification<br>...<br>​<br>def show(self, Notify):<br>​<br>    Notify.mail(WelcomeNotification, to=&#39;user@gmail.com&#39;)</pre><p>Notice here we simply specified the Notify class in the parameter list and we are able to pass in our awesome new WelcomeNotification into the mail method.</p><p>NOTE: The method you should use on the notify class should correspond to the method on the notification class. So for example if we want to execute the slack method on the WelcomeNotification then we would call :</p><pre>Notify.slack(WelcomeNotification)</pre><p>The method you call should be the same as the method you want to call on the notification class. The Notify class actually doesn’t contain any methods but will call the same method on the notification class as you called on the Notify class.</p><h3>Building Our Slack Notification</h3><p>Out of the box, Masonite Notifications comes with Slack support as well in case we want to send a message to a specific slack group.</p><p>NOTE: In order to use this feature fully, you’ll need to generate a token from Slack. This token should have at minimum the channels:read, chat:write:bot, chat:write:user and files:write:user permission scopes. If your token does not have these scopes then parts of this feature will not work.</p><p>Going back to our WelcomeNotification, we can simply specify a new method called slack.</p><pre>class WelcomeNotification(Notifiable):<br>​<br>    def mail(self):<br>        return self.subject(&#39;New account signup!&#39;) \<br>            .driver(&#39;smtp&#39;) \<br>            .panel(&#39;GBALeague.com&#39;) \<br>            .heading(&#39;You have created a new account!&#39;) \<br>            .line(&#39;We greatly value your service!&#39;) \<br>            .line(&#39;Attached is an invoice for your recent purchase&#39;) \<br>            .action(&#39;Sign Back In&#39;, href=&quot;http://gbaleague.com&quot;) \<br>            .line(&#39;See you soon! Game on!&#39;) \<br>            .view(&#39;/notifications/snippets/mail/heading&#39;,<br>                  {&#39;message&#39;: &#39;Welcome To The GBA!&#39;})</pre><pre>      def slack(self):<br>          pass</pre><p>Notice the new slack method at the bottom. we will use this method to build our slack notification. Again we will show you a full example and then run through all the methods:</p><pre>class WelcomeNotification(Notifiable):<br>​<br>    def mail(self):<br>        return self.subject(&#39;New account signup!&#39;) \<br>            .driver(&#39;smtp&#39;) \<br>            .panel(&#39;GBALeague.com&#39;) \<br>            .heading(&#39;You have created a new account!&#39;) \<br>            .line(&#39;We greatly value your service!&#39;) \<br>            .line(&#39;Attached is an invoice for your recent purchase&#39;) \<br>            .action(&#39;Sign Back In&#39;, href=&quot;http://gbaleague.com&quot;) \<br>            .line(&#39;See you soon! Game on!&#39;) \<br>            .view(&#39;/notifications/snippets/mail/heading&#39;,<br>                  {&#39;message&#39;: &#39;Welcome To The GBA!&#39;})</pre><pre>    def slack(self):<br>        return self.token(os.getenv(&#39;BOT&#39;)) \<br>            .text(&#39;Masonite Notification: Read The Docs!, https://docs.masoniteproject.com/&#39;) \<br>            .channel(&#39;#bot&#39;) \<br>            .as_user(&#39;Masonite Bot&#39;) \<br>            .icon(&#39;:fire:&#39;) \<br>            .button(&#39;Sure!&#39;, &quot;https://docs.masoniteproject.com/&quot;)<br>            .button(&#39;No Thanks!&#39;, &quot;https://docs.masoniteproject.com/&quot; style=&#39;danger&#39;)</pre><p>This will return a result like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*6uI6LsRAmK1w1ZlA.png" /></figure><h3>Slack Options</h3><p>For a full list of notifications, head over to the <a href="https://docs.masoniteproject.com/official-packages/masonite-notifications#options-1">Official Documentation</a> page to see a nice table.</p><h3>Sending a Slack Notification</h3><p>Now that we have built our notification above, we can send it in our controller (or anywhere else we like):</p><pre>from app.notifications.WelcomeNotification import WelcomeNotification<br>...<br>​<br>def show(self, Notify):<br>​<br>    Notify.slack(WelcomeNotification)</pre><p>Notice here we simply specified the Notify class in the parameter list and we are able to pass in our awesome new WelcomeNotification into the slack method.</p><h3>Building Integrations</h3><p>The Notifiable class is very modular and you are able to build custom integrations if you like pretty simply. In this section we’ll walk through how to create what are called Components.</p><h3>What are Components?</h3><p>Components are classes that can be added to a Notification class that extend the behavior of the notification. In fact, the Notifiable class is just a simple abstraction of two different components. Let’s look at the signature of the class that we have been inheriting from.</p><pre>from notifications.components import MailComponent, SlackComponent<br>​<br>​<br>class Notifiable(MailComponent, SlackComponent):<br>    pass</pre><p>The Component classes are the classes that have our methods we have been using. If you’d like to see the source code on those components you can check them out on GitHub to get a lower level understanding on how they work.</p><h3>Creating a Component</h3><p>Let’s walk through a bit on how we created our MailComponent by creating a simplified version of it. First let’s create a simple class:</p><pre>class MailComponent:<br>    pass</pre><p>Now let’s add a line and a subject method to it:</p><pre>class MailComponent:</pre><pre>    def line(self, message):<br>        pass</pre><pre>    def subject(self, subject)<br>        pass</pre><p>and let’s use these two methods to build a template attribute</p><pre>class MailComponent:<br>​<br>    template = &#39;&#39;</pre><pre>    def line(self, message):<br>        self.template += template<br>        return self</pre><pre>    def subject(self, subject)<br>        self._subject = subject<br>        return self</pre><p>Since we returned self we can keep appending onto the notification class like we have been.</p><p>The actual MailComponent class is a bit more complex than this but we&#39;ll keep this simple for explanatory purposes.</p><h3>The Fire Method</h3><p>Whenever we insert the notification into the Notify class:</p><pre>Notify.mail(WelcomeNotification)</pre><p>This will call the mail method on the notification class (or whatever other method we called on the Notify class).</p><p>Once that is returned then it will call the fire_mail method which you will specify in your component.</p><p>If you have created a discord notification then you should have a fire_discord method on your component and you will call it using:</p><pre>Notify.discord(WelcomeNotification)</pre><p>Since we want to call the mail method on it, we will create a fire_mailmethod:</p><pre>class MailComponent:<br>​<br>    template = &#39;&#39;</pre><pre>    def line(self, message):<br>        self.template += template<br>        return self</pre><pre>    def subject(self, subject)<br>        self._subject = subject<br>        return self</pre><pre>    def fire_mail(self):<br>        pass</pre><h3>Protected Members</h3><p>Sometimes you will want to pass in data into the fire_mail method. In order to keep this simple and modular, any keyword arguments you pass into the Notify class will be set on the notification class as a protected member. For example if we have this:</p><pre>Notify.mail(WelcomeNotification, to=&#39;admin@site.com&#39;)</pre><p>It will set a _to attribute on the notification class BEFORE we get to the fire_x method.</p><p>So using the example above we will be able to do:</p><pre>def fire_mail(self):<br>    self._to # admin@site.com</pre><p>We can use this behavior to pass in information into the fire_mail method while keeping everything clean.</p><h3>Sending The Mail</h3><p>Ok so finally we have enough information we need to send the actual email. The fire_mail method is resolved by the container so we can simply specify what we need to send the email from the parameter list.</p><p>Our notification class will look like:</p><pre>from your.package import MailComponent<br>​<br>class WelcomeNotification(Notifiable, MailComponent):<br>​<br>    def mail(self):<br>        return self.subject(&#39;New account signup!&#39;) \<br>            .line(&#39;We greatly value your service!&#39;)</pre><p>Our Notify class will look like:</p><pre>Notify.mail(WelcomeNotification, to=&#39;admin@site.com&#39;)</pre><p>and our fire method will look like:</p><pre>class MailComponent:<br>​<br>    template = &#39;&#39;</pre><pre>    def line(self, message):<br>        self.template += template<br>        return self</pre><pre>    def subject(self, subject)<br>        self._subject = subject<br>        return self</pre><pre>    def fire_mail(self, Mail):<br>        Mail.to(self._to) \<br>            .subject(self._subject) \<br>            .send(self.template)</pre><p>Remember the _to class attribute that came from the keyword argument in the Notify class.</p><p>If you are curious about sponsoring this package then send an inquiry email over to <a href="/service/mailto:joe@masoniteproject.com">joe@masoniteproject.com</a> for more information.</p><p>Be sure to give a star on the <a href="https://github.com/masoniteframework/masonite">GitHub</a> page or join the <a href="http://slack.masoniteproject.com/">Slack</a> channel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ff5e7d6a988" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Masonite 2.0 and Django]]></title>
            <link>https://medium.com/@joseph.mancuso/masonite-2-0-and-django-beb4986d967f?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/beb4986d967f</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[masonite]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Sat, 16 Jun 2018 19:52:39 GMT</pubDate>
            <atom:updated>2019-06-14T12:12:50.833Z</atom:updated>
            <content:encoded><![CDATA[<p>NOTE:: This article is detailing an older version of Masonite. Please see more information on Masonite’s GitHub page for what is going on in the community lately: <a href="https://github.com/MasoniteFramework/masonite">https://github.com/MasoniteFramework/masonite</a></p><p>I always get the question of “how does Masonite compare to Django?” or “Why would I choose Masonite over Django?” In this article I’ll try to address the many aspects of Masonite and how they compare with Django. This article will likely be an ongoing process of section additions.</p><h3>Disclaimer</h3><p>Before I start, I am not saying Django is awful. Django is a great framework and it’s been going strong in the Python community for a long time. It is clearly here to stay. I personally like pieces of features from other frameworks and enjoy writing in Python so I grabbed tools and tips and architectural concepts from other frameworks and created something that fit my personal use cases perfectly.</p><p>Masonite does things differently and i’ll be the first to admit that it’s slightly opinionated in the way me and our maintainers code and our developer practices.</p><p>If you try out Masonite and realize that it’s a great framework then I hope you continue using it and contribute to the community. If you do not like Masonite and instead think that Django is much better than more power to you; I hope you keep using Django and create some awesome software, although we’ll miss you :’(.</p><p>In each section I’ll talk more about Masonite than I do Django because I will assume you understand Django already so it’s not that I am purposely being biased or explaining only 1 side in more detail than the other. If i mention things like “Settings” I will assume that you understand how Django settings works.</p><p>I’ll explain the behind the scenes stuff slightly for Masonite but add links to the documentation if you wish to read more into it and learn how it actually works.</p><h3>Thoughts</h3><p>Masonite is completely developer centric. We try to get a framework with the developer in mind and how the developer will be interacting with the framework on a day to day basis and strive to tweak that interaction in a way that make sense. We focused an entire release dedicated to polishing the tiny things in the framework.</p><p>Masonite is not a framework written for a news corporation (Django) or written as an april fools joke (Flask). Although these two frameworks have strived for a long time and remain the two most dominant Python frameworks, Masonite will be an excellent fit and is a framework written for developers by developers.</p><p>Masonite is for those weekend warrior projects that could become something. It’s for that next SaaS idea that you want to write but dread writing all the boiler plate involved in getting it to production or uploading to S3 or integrated with Stripe or getting an API setup to get developers to connect to your service or getting recurring tasks setup with cron or all those annoyances that only take a few minutes to setup but you need to setup 10 different packages just to get where you want to be to start developing.</p><p>You KNOW you’re going to need whitenoise for static files, you KNOW you’re going to need to accept subscriptions with Stripe, you KNOW you’re going to need some websocket requests in order to make your application more responsive. Why worry about getting those setup when you can just use a framework that has those for you?</p><p>Masonite is the awesome starter project for your next idea all packaged up and waiting to handle your application logic.</p><h3>Architecture</h3><p>The architecture between Masonite is completely different than that of Django.</p><p>Not only does Masonite follow an MVC architecture and Django follows an <a href="https://djangobook.com/model-view-controller-design-pattern/">MTV architecture</a>.</p><p>No, these are not the same. If these were the same then they would be called the same thing. Yes, they both accomplish the exact same thing but they do so in different ways.</p><h4>Django</h4><p>Django is designed to break a single application into multiple “apps”. This is a good architecture for abstracting a lot of logic away for those developers that require it but many developers don’t know which parts of their application need to be in separate apps so they start breaking them up until they realize that it simply created more complexity because now I have to know where I put this specific model in order to play nice.</p><p>Django does not have a true MVC architecture. Their architecture as they put it themselves in MTV which is Model Template View.</p><h4>Masonite</h4><p>Masonite is very different. Masonite is designed to make a single application like Django but it instead breaks up the logic into multiple controllers which are in their own modules.</p><p>Unlike many other Python frameworks, Masonite has a true MVC architecture. Masonite has controller classes and methods that can be used to really abstract away a lot of the business logic in a clean and pragmatic way.</p><h3>Service Container and Service Providers</h3><h4>Django</h4><p>Django’s version of Masonite’s Service Container is their INSTALLED_APPS. Some third party apps require adding an app to the INSTALLED_APPS list which loads features into the framwork. Django uses strings in order for these apps to be loaded in which are located and add features in the app. Some third party packages don’t require this.</p><h4>Masonite</h4><p>Masonite adopted the concept of a Service Container early on. The Service Container is simply a way to add functionality simply to Masonite which is available throughout the application. This is a form of an IOC container into which objects can be put and retrieved into. Masonite takes it a step further and allows objects to be “resolved” by the container. Simply speaking it will determine what your object needs depending on the parameters and retrieve those objects from the container.</p><p>Read more about the Service Container here:</p><p><a href="https://docs.masoniteproject.com/architectural-concepts/service-container">https://docs.masoniteproject.com/architectural-concepts/service-container</a></p><p>These features are added to Masonite in the form of Service Providers (because they provide a service).</p><p>Service Providers can add functionality like new drivers, new features, entire packages, new commands and a lot more. For example, adding a service provider for Mail could add support for sending emails etc etc.</p><p>These service providers (from 2.0 onwards) are classes which speeds up the time it takes to serve a request because they do not have to be “found” on the backend.</p><p>If you are coming from Django, you can think of Service Providers as a form of “adding a thirdparty app to my application.” Although apps and service providers perform very differently under the hood, the very high level concept is similiar.</p><h3>Drivers and Settings</h3><h4>Django</h4><p>Django uses a few setting files and abstracts them based on where they should run. For example se may have a settings.py and a settings_local.py. This works and is great but I personally never liked adding all of my settings to a single configuration file. It just seemed messy to me but many developers like it which is fine. I would just prefer another abstraction on a feature level. This can also be done in Django by importing all the settings of individual files into the master setting file if you so choose to do it.</p><p>Django doesn’t necessarily have a concept of “Drivers” the same way Masonite does but adding these are fairly straight forward for Django. They usually require a pip install and a handful of configuration options.</p><h3>Masonite</h3><p>Masonite’s setting files are broken down into different features of out the box and is something like:</p><pre>config/<br>  application.py<br>  mail.py<br>  database.py<br>  ...</pre><p>You can change settings and allow third party application to create them for you.</p><p>Masonite also has a concept of drivers. Because of Masonite’s architecture, things can be turned on, turned off and switched around at will. If you need a Postgres database connection then you switch from driver from “mysql” to “postgres” which will switch the inner workings of the application to use the Postgres connection. Everything will remain exactly the same but use the other connection.</p><p>Masonite also has several drivers ready to go out of the box such as an SMTP driver and a Mailgun driver for sending email. Masonite uses drivers for several things such as file uploading. We can simply switch drivers like:</p><pre>def show(self, Upload):<br>    Upload.driver(&#39;disk&#39;).store(..) # stores in the file system<br>    Upload.driver(&#39;s3&#39;).store(..) # stores into Amazon S3</pre><p><strong>You can also set default drivers in the configuration file so you don’t have to explicitly declare them in your code.</strong></p><p>Because of the concept of Masonite contracts, we can ensure that all classes of the same type have the same methods so we can switch functionality at the drop of a hat and everything will work just fine.</p><p>If you start off a project uploading everything to a disk and then one of your developers say that we should really move to the cloud then that is fine. Either use the drivers supplied with Masonite or create your own driver.</p><h3>Scaffolding</h3><p>This section is a little opinionated and may or may not be the accepted option of doing things but it is only an option with Masonite and you can skip this completely.</p><p>The concept of “scaffolding” basically means the ability to add boiler plate directly to your code. Making a model or a controller is extremely repetitive.</p><ul><li>create the file</li><li>create the class</li><li>add the first method to it</li></ul><p>We do this 100 times in our application. It doesn’t take very long at all but its a mild distraction to the task at hand. It only shaves 15-30 seconds off the development time but if you are doing it 100 times then that could be a considerable amount of time shaved off.</p><h4>Django</h4><p>Django doesn’t have the concept of scaffolding at the class level. Django has a way to scaffold a new app but not the ability to scaffold a new model or view or template.</p><p>Masonite takes this a step further</p><h4>Masonite</h4><p>Masonite adds the ability to create models, controllers and templates (which Masonite calls views to keep with the MVC architecture).</p><p>We have two options:</p><ul><li>find out way to the controller directory</li><li>create the file in the controller directory</li><li>create the DashboardController class in the controller file</li><li>add the first method to it</li></ul><p>or we can just run:</p><pre>$ craft controller Dashboard</pre><p>Which will create the file, the class, the first method (which you can obviously rename) and put it in the correct directory for us. It’s just the little things in the framework that make it feel really awesome. I use these craft commands all the time.</p><p>Remember you don’t need to use craft commands. These are typically just helper commands that allow you to shave a few seconds to a few minutes off your development time that day.</p><h3>Batteries Included</h3><p>Django and Masonite have a very similar concept of batteries included in terms of features and they can honestly be pretty equal in what they have out of the box but Django needs just a little bit of tweaking for each added feature.</p><p>In this arena, it’s not so much the amount of features that separates Masonite and Django but HOW a Masonite developer interacts with the objects in the application. The features between Masonite and Django are very comparable and I won’t waste time explaining every feature of Django and how it each one compares with Masonite but you can read the Masonite docs for any information on features you are looking for.</p><p>Any framework can come with features but it’s really how we as developers are interacting with those features that really matters. It’s the ways and classes we use to interact with these features that really make or break a framework.</p><p>Where Masonite really shines is how it’s built and how the application and controllers interacts with the IOC container. This alone is what should really drive a lot of developers to Masonite but it’s a little foreign to how we normally develop.</p><p>Once you start interacting with Masonite you can further understand the architecture behind it.</p><p>You can read more in depth about the architecture in the docs starting with the Request Lifecycle: <a href="https://docs.masoniteproject.com/architectural-concepts/request-lifecycle">https://docs.masoniteproject.com/architectural-concepts/request-lifecycle</a></p><h3>The Little Things</h3><p>Masonite really focuses on the little things when developing and really keeps a “Separation of Concerns” approach really well. Separation of Concerns says that units of code should be broken up in a way where they only perform 1 job or jobs in similar categories.</p><h4>Abstracting Class Methods</h4><p>Take this example in Django:</p><pre><strong>def</strong> upload_file(request):<br>    <strong>if</strong> request.method == &#39;POST&#39;:<br>        # Some Logic Here To Upload<br>        <strong>return</strong> HttpResponseRedirect(&#39;/success/url/&#39;)</pre><pre>    <strong>return</strong> render(request, &#39;success.html&#39;, {&#39;key&#39;: &#39;value&#39;})</pre><p>This is Django code that shows the form on a GET request and stores the form on a POST request. In Masonite we break this down further into an UploadController:</p><pre>class UploadController:</pre><pre>    def show(self):<br>        return view(&#39;upload&#39;, {&#39;key&#39;: &#39;value&#39;})</pre><pre>    def store(self):<br>        # Form Logic Here</pre><pre>        return view(&#39;success&#39;)</pre><p>According to our routes, the url of upload/ will either point to show or store depending on if its a GET or a POST (these method names can be whatever you want them to be)</p><p>So the separation of logic is an awesome perk of Masonite.</p><h4>Input Data</h4><p>Masonite understands the concept of input data well.</p><p>Take this example again from above in Django:</p><pre><strong>def</strong> upload_file(request):<br>    <strong>if</strong> request.method == &#39;POST&#39;:<br>        firstname = request.POST.get(&#39;firstname&#39;)<br>        <strong>return</strong> HttpResponseRedirect(&#39;/success/url/&#39;)<br>    <br>    request.GET.get(&#39;firstname&#39;)</pre><pre><strong>    return</strong> render(request, &#39;success.html&#39;, {&#39;key&#39;: &#39;value&#39;})</pre><p>Notice that we to specify what type of input we need. This was always a strange concept to me and seemed odd.</p><p>Masonite knows the request method and what you need:</p><pre>class UploadController:</pre><pre>    def show(self):<br>        firstname = request().input(&#39;firstname&#39;) # GET</pre><pre>        return view(&#39;upload&#39;, {&#39;key&#39;: &#39;value&#39;})</pre><pre>    def store(self):<br>        firstname = request().input(&#39;firstname&#39;) # POST</pre><pre>        return view(&#39;success&#39;)</pre><p>Notice the same code here works whether it is a POST request or a GET request.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beb4986d967f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s next for Masonite]]></title>
            <link>https://medium.com/@joseph.mancuso/whats-next-for-masonite-6a1e9170ee32?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a1e9170ee32</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[framework]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Sun, 20 May 2018 00:58:37 GMT</pubDate>
            <atom:updated>2018-05-20T00:58:37.755Z</atom:updated>
            <content:encoded><![CDATA[<p>The release of Masonite 1.6 brought a lot of awesome changes you can <a href="https://docs.masoniteproject.com/whats-new/masonite-1.6">check out here</a>.</p><p>Not only did it bring a lot of changes to Masonite in terms of features but also in terms of how Masonite releases. After Masonite 1.6 was released, another Pythonist found the project and brought a lot of awesome ideas and changed the way Masonite is being developed is a few ways.</p><h3>Feature Releases</h3><p>Previously, a version of Masonite was released and then all new development was focused on the next release and all bug fixes were patched as usual.</p><p>From Masonite 1.6 onwards, all new non-breaking features will be merged into the current release and only breaking changes will be merged into the next release.</p><p>This means that you can enjoy keeping your Masonite application up to date and enjoy new features as they are released and also makes new major releases easier to migrate to as they won’t be bombarded with new features.</p><h3>Release Cycle</h3><p>Masonite has been on time with it’s releases thus far. Starting in February, Masonite has been on a 1 month major release cycle in order to promote rapid development and get Masonite off the ground without the fear of rapidly changing the framework.</p><p>The release cycle has been:</p><ul><li>Masonite 1.3 — February 2018</li><li>Masonite 1.4 — March 2018</li><li>Masonite 1.5 — April 2018</li><li>Masonite 1.6 — May 2018</li><li>Masonite 2.0 — June 2018</li><li>Masonite 2.1 — December 2018</li><li>Masonite 2.2 LTS — June 2019</li></ul><p>Starting in June 2019, Masonite will be extremely stable and I am sure we will be confident enough to release an LTS version which will be Masonite 2.2. This may change in the future but we will announce it next year as we get closer to the date.</p><p>What i’m thinking is that LTS version will get the usual 3 year security fixes and 2 year bug fixes while all normal release get the usual fixes until the next release.</p><h3>Features</h3><p>There are a few new features planned for 2.0 and even a few that are already developed and waiting to be released. Since Masonite 2.0 will focus on really polishing the framework and getting it ready for a 6 month release cycle.</p><p>Here are a few of the breaking changes for the next release of Masonite:</p><h4>Auto-reloading Server</h4><p>An awesome contributor added a way to auto reload the wsgi server on file changes. Now we don’t have to keep closing the server and restarting it but we can now make changes and have the server auto reloading.</p><p>This will look something like:</p><pre>$ craft serve -r</pre><p>short for reload.</p><h4>Redesigning Request Inputs</h4><p>Currently there is a bit of a mess when it comes to creating third party packages which require specific input variables. The Masonite request inputs were rewritten in a previous release of Masonite in order to handle uploaded images via form requests.</p><p><a href="https://github.com/MasoniteFramework/core/issues">There are a bunch of other issues planned for Masonite 2 which you can find here</a></p><p>Don’t be afraid to open up an issue and I can do my best to explain how you can contribute.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a1e9170ee32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s Next For Masonite 1.6]]></title>
            <link>https://medium.com/@joseph.mancuso/whats-next-for-masonite-1-6-fc3425dc49ed?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc3425dc49ed</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[masonite]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 18:35:34 GMT</pubDate>
            <atom:updated>2018-04-17T18:36:52.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDsNdpgt2bcxrbgJHihPVA.jpeg" /></figure><p>Recently, <a href="https://github.com/MasoniteFramework/masonite">Masonite 1.5</a> was release with the help of @<a href="http://twitter.com/mapeveri">mapeveri</a> who is really passionate about seeing the framework be successful! If you haven’t already visited the framework then be sure to <a href="https://github.com/MasoniteFramework/masonite">check it out</a>!</p><h3>What will be in 1.6</h3><p>Masonite 1.5 was a really big release and came with a lot of <a href="https://masoniteframework.gitbook.io/docs/whats-new/masonite-1.5">new features and changes</a></p><p>We worked hard to bring you this release and I think everyone will really enjoy it but for Masonite 1.6, we are going to slow the roll for new releases and focus primarily on polishing the features already implemented. We have been building software with Masonite and have noticed things that work perfectly but could be changed around a bit to improve developer happiness.</p><p>Although there may be some new features with Masonite 1.6 and possibly a new official package called Masonite Billing, our primary goal with the current core developers (and any new contributors that would like to come along) is to focus on small improvements to the overall API in order to improve the happiness of the developers using it.</p><p>Some of the polishing changes will include:</p><ul><li><a href="https://github.com/MasoniteFramework/core/issues/68">Adding an optional </a><a href="https://github.com/MasoniteFramework/core/issues/68">http_only flag to setting cookies so Javascript code can interact with cookies better.</a></li><li><a href="https://github.com/MasoniteFramework/core/issues/67">Brainstorm and implement improvements to redirecting backwards</a></li><li><a href="https://github.com/MasoniteFramework/core/issues/32">Driver requirements should be installed as needed instead of all coming with the framework bundle.</a></li><li><a href="https://github.com/MasoniteFramework/core/issues/33">Add improvements to the controller command to scaffold out templated controllers</a></li><li><a href="https://github.com/MasoniteFramework/core/issues/51">Add custom error pages</a></li><li><a href="https://github.com/MasoniteFramework/core/issues/57">Add a static file helper method inside templates</a></li></ul><p>And any other small issues that come to the minds of Masonite’s developers throughout the days.</p><p><a href="https://github.com/MasoniteFramework/core/milestone/4">Checkout the entire Milestone here</a></p><h3>Release Cycle</h3><p>Masonite 1.6 will be the last 1.x release. Masonite 1.6 will release in mid May and Masonite 2.0 will be released in mid June. All of the Masonite 1.x releases have been monthly but Masonite 2.0 will start the 6 month release cycle. In other words, Masonite 2.0 will release in June 2018 and Masonite 2.1 will release in December 2018.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc3425dc49ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Feature and Package Complexity]]></title>
            <link>https://medium.com/@joseph.mancuso/software-feature-and-package-complexity-e4a1bd55136d?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4a1bd55136d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-design]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Sat, 31 Mar 2018 16:35:27 GMT</pubDate>
            <atom:updated>2018-03-31T16:35:27.736Z</atom:updated>
            <content:encoded><![CDATA[<p>So many times I hear developers say “Yeah package X is really complex but once you get used to it, it’s really powerful.” <strong>This is sheer nonsense.</strong></p><p>The definition of package here is basically any piece of code that plugs into a larger piece of code. Meaning packages like Requests for Python or Laravel Cashier for Laravel. I want to be clear that I don’t mean frameworks themselves only because they do have a justifiable limitation on their complexity because of the amount of moving parts. Frameworks typically have a plethora of packages merged together so it makes sense that it will take some time to learn each package along the way towards developing an application. I want to define a package here as a specific feature set of a framework or as independent code that can be plugged into a framework.</p><p>A package that has a high learning curve means that the package is 1 of two things.</p><p>The first is that is has a bad API. The API here will be defined as the end product of the code that the user (typically the developer) will be using to interact with your package. This can include the various public methods and classes the developer will use in order to implement your package into their software.</p><p>The second is that the API was not built from the outside in but the inside out. In other words, a lot of developers build the engine of the package first and then, when it is working, will question what the best way is of working with this package. This kind of programming promotes either poor implementation and excess coding to integrate their package or requires what seems like low level coding that should have been left up to the package author.</p><h3>Complying With Standards</h3><p>We have to remember that when we are building frameworks, libraries and packages that we are not building it for the PEP or PSR gods that will either accept or destroy the project based on their written words on a website. We are building these packages for other developers. Developers that need to implement these packages into their software and therefore our utmost priority is developer happiness. Everything else comes second.</p><p>Now standards are great and should be implemented as much as possible but if following a standard means that it lowers developer happiness in any way then that implementation of the standard should be reconsidered for your specific project. It may not change and you may choose to follow the standard but at least it was considered. To think that a specific community guideline or standard will fit into every single scenario of every package for the remainder of eternity is just inane. Never let standards get in the way of writing good code. If you have to question that your implementation is better than what the implementation would be with the standard then do not hesitate <strong>if and only if that code is front facing.</strong> <strong>Standards and consistency is important. Standards and consistency in a specific project is more important.</strong></p><p>In many cases, some implementations of the standards looks like it is adding value to your package but it actually isn’t; and in many cases it removes value. For example if you write beautiful docstrings for your class and it is extremely readable and a pleasure to look at and read, but it is not PEP 8 or PSR-2 compliant, does changing code to the comply with the standard improve the project?</p><p>In fact this same question was asked by <a href="https://twitter.com/raymondh?lang=en">Raymond Hettinger</a> and he argued that refactoring code to comply with standards can actually not improve the codebase but instead introduce bugs. A fair argument.</p><h3>Front Facing Code</h3><p>Developers that use your package will only ever see the front facing API of your package. Because of this, any code that the developer will see should be the upper most simplistic representation of your package.</p><p>The engine of your code can be as complex or non complex as you like but whatever the developer see’s should be the simplest representation of your package. Period. If any part of your package is more simple than what the developer sees and uses that you should consider refactoring your code until it is. Your under the hood code should always be more complex no matter what.</p><p>Developers should not be content with high learning curve package API’s and if they are then they are complacent with the tools they have available to them, which is a dangerous place to be as a community. As soon as a community enters complacency then that communities ability and speed to adapt to modern web applications die.</p><p>Packages with high learning curves means that they are not intuitive enough. Developers who use unintuitive packages is a sign that there either are no packages better, meaning that a developer can come along and create better packages, that there are better packages but are not advertised enough and underused, or that developers have jumped on a speeding bandwagon and want to use packages that other developers are using; essentially creating a domino effect of using overused and undervaluable packages.</p><h3>Personal Standard</h3><p>My personal standard is that if I can’t explain and implement a 90–95% of a specific package or feature of the Masonite framework in a 15 minute video then that feature is too complex, unintutive and should be refactored and reconsidered.</p><p>Also the rules of abstraction should also be used for features. The rule here is that if any feature takes more than 5–10 lines of code to implement then it should be refactored and shortend any way possible. It should not take me 15 minutes and 30 lines of writing code to implement a simple RESTful API endpoint.</p><p>Also if I have to every second guess what a method name was called and have to reference the documentation or original code <strong>after</strong> I have already checked once then that specific method is not intuitive enough and should be refactored or renamed.</p><p>Lastly, all code should start from the outside and work it’s way inside. In other words, when developing a package, the front end code, or the code that the users of your package will be using for implementation, should be written first and then the engine should be built around it. If you were designing a beautiful car then you should start with the body of the car and build the engine for the car around the design instead of designing a car around an engine block. Too many developers build a really awesome engine and then try to design a car around it which leads to a strangely designed vehicle that is quickly questioned but justified with it being the simplest way to work with the engine they built.</p><p>As developers and authors of packages, you should be able to look at a line of code and instantly tell what classes, inheritances, abstractions, methods, attributes, or even magic methods that are required to create it. If you write a line of code and realize that the backend implementation will be too complex then simply change that line of code until you realize that it looks great, it’s intuitive, and the backend implementation will be simple enough to maintain.</p><p>Thank You.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4a1bd55136d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Road To Masonite 2.0]]></title>
            <link>https://medium.com/@joseph.mancuso/the-road-to-masonite-2-0-4572f0d82a9e?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4572f0d82a9e</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Mon, 26 Mar 2018 17:09:08 GMT</pubDate>
            <atom:updated>2018-03-26T17:09:08.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u1VNyk5G-0my400IODPW3A.png" /></figure><p>Masonite is a rapid application Python web framework. Masonite was started in December of 2017 and has gone through some rapid changes and came out with a 1.0 release in late January. A week later was the release of 1.2 which brought a huge architectural change and the advent of Service Providers which are designed to load framework capabilities into a “Service Container” which makes the framework extremely modular.</p><p>If you need Caching capability then you simply add a caching Service Provider. If you don’t then you can remove what you don’t use. Everything is designed to be additive. Along with the release of 1.2 was an understanding on what the framework should be and the dawn of stable releases.</p><p>The trick is to start at Masonite 1.2 and do a major release every month until June 2018. Once June hits there will be a Masonite 2.0 release and then Masonite will start a 6 month major release cycle. There will of course be bug fixes and improvements spread throughout that time but the major releases will be every 6 months.</p><p>So there has been Masonite 1.3 in February, Masonite 1.4 in March and now Masonite 1.5 will be release in mid April. Each release focuses on a core element of the framework.</p><p>Masonite 1.3 brought a lot of changes to the core of the framework such as middleware, perfecting the Service Providers, changed how form input is processed, added several new methods to the routes, etc etc. A lot of these changes were at the framework level.</p><p>Masonite 1.4 brought additional change but focused more on adding new features through Service Providers that nearly every application would be able to benefit from. These included caching, web socket support with Pusher and Ably, CSRF protection and other various improvements.</p><h3>Masonite 1.5</h3><p>Masonite 1.5 will be released in the next few weeks and focuses on API features. Nearly every application can benefit from having an externally accessible API, whether it be for making compatible mobile apps or creating micro services that connect to your application. Masonite 1.5 will come pre installed with a new package called Masonite Entry. There will be no actual integration of the package but the package will be installed and await the installation command.</p><p>In addition to Masonite 1.5 will be the release of some improvements to caching and a new craft command. The craft command which is the masonite-cli package that is installed is rebuilt from the ground up and designed to integrate extremely well with third party packages. The packages can now add new commands to craft and even add new migration directories by simply adding a service provider in.</p><p>This is extremely helpful for integrating a package. So many times you go through a tutorial it says “copy and paste X”, “copy and paste Y” then “change this” and “add that.” A lot of this is just nonsense and is a fatal flaw in the design on Python frameworks. Installing a package should look like this:</p><ul><li>Pip install package</li><li>Add Service Provider to PROVIDERS list.</li><li>Run craft package_name:install</li><li>Done.</li></ul><p>Because of the setup of Masonite, It’s simple for packages to know exactly where you want to put code and will just put it there for you. This can be adding routes, creating controllers, adding migrations or models etc.</p><h3>Masonite 2.0</h3><p>After the release of Masonite 1.5, we will still create a new release for May of Masonite 1.6. This will be the last major release for the Masonite 1.x family. The next release will be Masonite 2.0 which will be the most stable release.</p><p>The Masonite team as learned a lot along the way from Masonite 0.3.0 to now Masonite 1.5. We’ve learned what to do and what not to do, how to create stable releases and most importantly how to maintain an extremely large scale project. Building a batteries included framework is a tremendous task not only in terms of getting developers to use it but organizing the project in a way that is maintainable. This is why Masonite 1.5 will not be shipping with a direct integration with Masonite but instead be it’s own package added as a dependency.</p><p>That will most likely be the future growth of Masonite. From Masonite 1.5 onwards, any large scale features that need to implemented (like an API feature with rate limiting, token authentication, resources, permission scopes, providers etc) will be it’s own package. In order to maintain the maintainability of Masonite, certain features need to live in their own repositories in order to reduce all the noise of improving it. Now if someone want’s to be a feature maintainer of the API stuff, we can attach them to that repository and let them dabble in improvements which is it’s own controllable beast.</p><p>I highly recommend that any feature that has even a mid sized scope should be it’s own repository and then added with a single line of code in your main project (like adding a Service Provider in your configuration setting like Masonite has). Once you have this capability, adding to your project gets extremely fast.</p><p>It’s much easier to task out 5 people to build blocks, and then stack those blocks onto one large tower than it is to task out 5 people to build 1 really large tower. A lot of the required attention to detail will be lost when you’re working with ten’s of thousands of lines of code compared to a fresh repository where you only have to worry about you’re specific feature and nothing else.</p><h3>Masonite 2.0 Ecosystem</h3><p>So once Masonite 2.0 is release that will be the gold rush of adding to the Masonite ecosystem. Since it will be releasing on a 6 months major release cycle and almost all of those major releases will have nothing more than improvements and new features, the ecosystem will be able to thrive because the underlying architecture should not change.</p><p>Upgrading projects and libraries will only take 10 minutes or less so each author will be able to keep up with the 6 month release cycle nature of Masonite. Masonite will be able to adapt and become really solid quickly.</p><p>We have a lot of planned software and libraries for Masonite 2.0 which includes:</p><ul><li>An official website</li><li>An online Python learning platform shaped around learning Masonite</li><li>An official blog that will most likely use the Medium API</li></ul><p>Most of these applications will be written in VueJS and use the API features of Masonite. This will improve the portability and expandability of the ecosystem so we can build a lot of micro services and mobile applications.</p><p>If you would like to contribute just head over to the official <a href="https://github.com/MasoniteFramework/masonite">GitHub repository</a> of get in touch on Twitter <a href="https://twitter.com/masoniteproject">@masoniteproject</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4572f0d82a9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Branding Masonite]]></title>
            <link>https://medium.com/@joseph.mancuso/branding-masonite-bcfcfe0ccc5b?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcfcfe0ccc5b</guid>
            <category><![CDATA[masonite]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Fri, 16 Mar 2018 17:21:15 GMT</pubDate>
            <atom:updated>2018-03-16T17:21:15.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEJ6ja9T8NZOxhy-5TOOeg.png" /></figure><p>It’s so vitally important to brand a project, service or product from the very start. It’s pretty difficult to make sure people know what kind of product something is and getting the word out there. With <a href="https://github.com/MasoniteFramework/masonite">Masonite</a>, it didn’t take me too long to know what the message should be but trying to portray the message was the hard part</p><h3>Campaign Inspiration</h3><p>I’ve got hooked into watching those old videos of Steve Jobs and I watched one video which was taken after he came back to Apple and was put in charge of re-branding what he wanted Apple to become</p><p>So he chose the “Think Different” slogan, came out with a bunch of unused infographics of great leaders and used those to symbolize what he wanted Apple to be.</p><p>I thought that was a great idea and chose to do something similar with little info graphics of things like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PzwswJ3TuKQbeFAVlR0Bg.png" /><figcaption>Easily upload to Amazon S3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*hY6zVOZ_QhZvxwuUW59Rgg.png" /><figcaption>The simple way of sending web socket messages</figcaption></figure><p>I think these small info graphics (just what I call them) really brings to light what Masonite is.</p><h3>What Should The Masonite Brand Symbolize?</h3><p>When Masonite was in the early stages of development, I met with a designer who wanted to be in charge of creating the logo. We jumped on a Google Hangouts call and I did a huge 10 minute rant.</p><p><strong>I just want Masonite to be artistic. I want it to become the creative of Python. Django to me is so dull. It’s an uncreative monstrosity that is simple designed to go from point A to point B and not really caring about the developer. The logo is gross and bland. Python developers are so hung up on the ‘Python way of doing it’ that they code for guidelines and PEP’s instead of for developers. It’s like if you don’t abide by a PEP then you should be exiled. If Django is IBM then I want Masonite to be Apple. Python pirates that want to get their application up and running in the <em>smoothest and intuitive </em>way possible.</strong></p><p>These info graphics of bright and simplistic is what Masonite is and what it should be moving forward. This will be the campaign for Masonite for a while.</p><p>GitHub: <a href="https://github.com/MasoniteFramework/masonite">https://github.com/MasoniteFramework/masonite</a></p><p>Twitter: <a href="https://twitter.com/masoniteproject">https://twitter.com/masoniteproject</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcfcfe0ccc5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Masonite 1.4 Keynote]]></title>
            <link>https://medium.com/@joseph.mancuso/masonite-1-4-keynote-f8f1574a2b56?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8f1574a2b56</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[masonite]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Tue, 13 Mar 2018 16:54:01 GMT</pubDate>
            <atom:updated>2018-03-13T16:54:01.057Z</atom:updated>
            <content:encoded><![CDATA[<p>Masonite 1.4 brings a lot of awesome features to the Masonite framework such as real time support with <a href="http://pusher.com/">Pusher</a> and <a href="http://ably.io/">Ably</a> drivers, template caching, easy email sending with SMTP and <a href="http://mailgun.com/">Mailgun</a> drivers, simple upload support with disk and Amazon S3 drivers. Only a few of the powerful features of Masonite are in this post so be sure to dive further by:</p><ol><li>Starring the repo: <a href="https://github.com/MasoniteFramework/masonite">https://github.com/MasoniteFramework/masonite</a></li><li>Or reading the docs: <a href="https://masoniteframework.gitbooks.io/docs/content/">https://masoniteframework.gitbooks.io/docs/content/</a></li></ol><p>For those that watch to a watch a simple video that explains this post in more detail then feel free to watch the video below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmlWHOZntPfA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmlWHOZntPfA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmlWHOZntPfA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e95225bc050864a4f69cfb1ed6d09cc/href">https://medium.com/media/3e95225bc050864a4f69cfb1ed6d09cc/href</a></iframe><h3>Real-time Support</h3><p>Modern web frameworks need ways to keep up with the needs of modern web applications so Masonite 1.4 comes with a broadcast feature. Out of the box Masonite ships with Pusher and Ably drivers which are just third party services for implementing web sockets. Those of you who have used Pusher already know how great these services can be.</p><p>Masonite ships with a config/broadcast.py configuration file with a few preset driver settings which are very straight forward. Just put your authentication settings in your .env file. Using it in our controller method will look something like:</p><pre>def show(self, Broadcast):<br>    Broadcast.channel(&#39;channel-name&#39;, &#39;message&#39;)</pre><p>That’s it. You have just broadcasted your event to Pusher (or whatever your default driver is).</p><h3>Upload Support</h3><p>There are two main methods in which we want to typically upload images.</p><ul><li>Upload an image to our disk (our file system)</li><li>Upload an image to Amazon S3</li></ul><p>Since these are the two most common scenario’s, Masonite comes with both. Uploading to a disk is simple. If we have a form like this:</p><pre>&lt;form action=&quot;/upload&quot; method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;</pre><pre>    {{ csrf_field|safe }}</pre><pre>    &lt;input type=&quot;file&quot; name=&quot;file_upload&quot;&gt;</pre><pre>    &lt;input type=&quot;submit&quot; value=&quot;Upload&quot;&gt;</pre><pre>&lt;/form&gt;</pre><p>Then we can simply grab that file_upload input which will return our image and upload it. This will look like:</p><pre>def show(self, Upload):<br>    Upload.store(request().input(file_upload))</pre><p>Done. It will be stored in the default directory which is storage/uploads by default.</p><p>We can also use an UploadManager which we can use to specify the driver we want to use. By putting your Amazon S3 credentials in the .env file we can do this:</p><pre>def show(self, UploadManager):<br>    UploadManager.driver(&#39;s3&#39;).store(request().input(file_upload))</pre><p>Bam! We can now upload directly to Amazon S3. Watch the video to see the results.</p><h3>Templates Caching</h3><p>There are likely to be high traffic areas of your website that:</p><ul><li>receive a lot of hits</li><li>have a high order of magnitude (multiple for loops inside for loops)</li><li>don’t change on a per week, per day, per minute or per second basis</li></ul><p>These types of templates could be landing pages, home pages, about or contact pages, etc etc.</p><p>These templates are perfect for caching. Instead of having Masonite render the templates over and over again, we can just cache it. Instead of Masonite rendering the template over and over it will just read it from the cache.</p><p>We can now do something like:</p><pre>def show(self):<br>    return view(&#39;complexity&#39;).cache_for(8, &#39;seconds&#39;)</pre><p>The template will now be cached for 8 seconds. When the cache expires, Masonite will render as usual and cache another copy for 8 seconds. All users who hit that page will see the cached version instead of the rendered version until the cache expires.</p><h3>Mail Support</h3><p>Nearly every side project you have uses or could benefit from sending emails. Whether it’s user account information like notifcations or success messages or even sending an email to the site admin that a new user signed up. Either way, sending email is simple:</p><pre>def show(self, Mail):<br>    Mail.to(&#39;user@email.com&#39;).send(&#39;Welcome!&#39;)</pre><p>This will of course send a simple text of “Welcome!” to the user at that email address. We can also send entire templates:</p><pre>def show(self, Mail):<br>    Mail.to(&#39;user@email.com&#39;).template(&#39;welcome&#39;).send()</pre><p>This will actually send the entire welcome template in the email. Just remember to also pass any variables the template requires like: .template(&#39;name&#39;, {&#39;variable&#39;: &#39;value&#39;}).send()</p><p>Masonite has become an excellent framework on a rock solid foundation and there have been a few developers who have already contributed some excellent features such as the template caching you read or watched above and CSRF protection.</p><p>Developers who have discovered the framework and have explored a bit really love it and I think you will to. This is a tool built by a developer, for developers to get that side project up and running in as little time as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8f1574a2b56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django and Masonite 1.4]]></title>
            <link>https://medium.com/@joseph.mancuso/django-and-masonite-1-4-6f510430db76?source=rss-a9dacdd54ccb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f510430db76</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[masonite]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Joe Mancuso]]></dc:creator>
            <pubDate>Tue, 13 Mar 2018 02:02:59 GMT</pubDate>
            <atom:updated>2018-03-13T02:12:02.444Z</atom:updated>
            <content:encoded><![CDATA[<p>Django really is a great web framework but I’ve been a software developer for almost 8 years now and built software with several different web frameworks. I have always had a huge passion for building things from the ground up just to see how it’s really built; fully knowing that there are great tools out there.</p><p>Recently I set out on an adventure to build a new Python framework. There were several pain points I had with the Python frameworks available which Masonite fixes for me: <strong>Batteries Included, Model Migrations and Removing Redundency.</strong></p><p><a href="https://github.com/MasoniteFramework/masonite">https://github.com/MasoniteFramework/masonite</a></p><p>Some of this may seem crazy, nonsense or controversial but whenever you build something using <a href="https://medium.com/the-mission/elon-musks-3-step-first-principles-thinking-how-to-think-and-solve-difficult-problems-like-a-ba1e73a9f6c0">First Principles</a>, things start to get really weird and you begin to question: <strong>Why is X the current way of doing things? Why isn’t it as simple as Y? </strong>Sometimes when you start to question the status quo like Django, you begin to realize that developers do feature X a strange way either because of the architecture of how a framework is built which leads to doing things in a strange way so it can fit inside the architectural box of a framework or that there actually are better ways of doing something but it wasn’t thought of when it was implemented and now it’s too late.</p><h3>Batteries Included</h3><p>Nearly all developers I come across have side projects. It’s just the curse of being a Software Developer. We have adapted our minds so much to problem solving that as soon as we encounter a real world problem we immediately think “wow, I can solve that with some great software.” But many times we just let those ideas slide because we don’t have the time. Why don’t we have the time? Because it takes too long to build it.</p><p>To create a simple SaaS, we need an authentication system, password resets, stripe integrations, payment plans, multi-plan members only areas, subdomains, file uploading, template caching, S3 buckets, simple web socket events, environment variables, API’s, Sass, et. al. <strong>The list goes on and on and we don’t even know if our idea is market validated.</strong></p><p>Yes, there are better steps to take before building software like validating the problem you are trying to solve but sometimes we just want to build an MVP (Minimum Viable Product) and get it out there. If it doesn’t work then we’ll get back to the drawing board and build something else.</p><p><strong><em>But have you noticed that almost all of your application are extremely similar? How many times have you implemented an API system? How many times have you implemented Stripe? How many times have you built a simple login system or Bootstrap navigation bar? Do you use web sockets? Why not? Because you don’t want to bother spending a day or two integrating it and then a day or five debugging it?</em></strong></p><p>If you want to get your side project up and running quick with everything you really need for you out of the box, then Masonite is the framework to use.</p><p>With Masonite 1.4 you get real time support with Pusher and Ably drivers out of the box. You get email support with SMTP and Mailgun drivers. Need that login, register and dashboard in your project? Great that’s 1 command. Need to cache your templates because that route is killing your server? We’ve got that. Need an API? Of course you do, we’ve got that. Upload to S3 because you are deploying to Heroku? We’ve got that. Need stripe support? We have an official package you can set up in 5 minutes that integrates directly into your model.</p><p>Django is a great framework for what it does but it’s not the end game for Python frameworks. If Django works well and does exactly what you need it to do then awesome! But for a framework to be batteries included, it doesn’t even handle static files very well. You can barely extend your User model without jumping through hoops.</p><h3>Model Migrations</h3><p>Django model migrations are actually really cool. It’s an extremely unique spin on how migrations are done and no frameworks outside of Python (maybe even Django?) has model migrations like Django does. Changing a model and having it auto generate a migration is really cool but how many of you have changed something slightly on a model and completely screwed up your migration tree? The migration is automagic because only maybe a handful of people really know how they work.</p><p>There is a HUGE different between something being automagic and something being automatic. Automatic is easy to debug, automagic is not.</p><p><strong>Django migrations are designed to save time in development, which it does, until something breaks. Then Django takes back all that time back but with interest when I have to search StackOverflow.</strong></p><p>Masonite migrations are much simpler and actually have nothing to do with migrations. You specify which columns you want and done. Masonite uses Active Record instead of Data Mapper. Django uses Data Mapper which makes the database table resemble the Model. Active record makes the model resemble the database table. Make changes to the table and the Model will take shape. Much simpler and much easier to debug. <strong>And you can swap out the model system if you like (although you may lose some small features of Masonite) since the migration system is it’s own stand alone feature.</strong></p><h3>Removing Redundancy</h3><p>If you’ve ever used a web framework before, there are only really a handful of tasks that are done over and over again: create a route, create a view, create a model, create a controller. Most developers will be spending their time on any one of these architectures.</p><p>What if instead of saying “ok let’s make a controller. I need to build the class, and then add a method which takes a ‘self’.” or saying “ok let’s make a model. So let’s make a class named X and import this class and inherit from it and blah blah.”</p><p>As developers, we know that if a peice of code looks redundant, it should be abstracted out, right? That’s why Masonite comes with command line helpers called craft commands.</p><p>Need to create a controller? craft controller DashboardController</p><p>Need to create a model? craft model Company</p><p>Each command will scaffold the correct class for you, import any required statements and set up a basic model or controller boiler plate.<strong> So much of the redundancy is abstracted out into these commands so you can actually spend more of your time coded what is necessary and removing all the boiler plate you dread writing over and over again.</strong></p><p>Masonite has become an excellent framework and I really do think it will be able to take a decent market share of Python frameworks and find a nice warm spot in the heart of so many of you Python developers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f510430db76" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>