<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ryan Posener</title>
    <description>The latest articles on DEV Community by Ryan Posener (@rposener).</description>
    <link>https://dev.to/rposener</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F132380%2F9227a8f2-69c7-484e-9318-2e4626df8209.jpeg</url>
      <title>DEV Community: Ryan Posener</title>
      <link>https://dev.to/rposener</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rposener"/>
    <language>en</language>
    <item>
      <title>Thinking about Zipf's law when coding</title>
      <dc:creator>Ryan Posener</dc:creator>
      <pubDate>Thu, 30 Jan 2020 00:06:12 +0000</pubDate>
      <link>https://dev.to/rposener/thinking-about-zipf-s-law-when-coding-4plk</link>
      <guid>https://dev.to/rposener/thinking-about-zipf-s-law-when-coding-4plk</guid>
      <description>&lt;h1&gt;
  
  
  The inspiration
&lt;/h1&gt;

&lt;p&gt;This article started when I watched &lt;a href="https://youtu.be/fCn8zs912OE" rel="noopener noreferrer"&gt;The Zipf Mystery&lt;/a&gt; on YouTube.  Michael (aka VSauce) explains Zipf's law in details there.  In summary this is just showing that many things naturally follow a logarithmic rate of occurrence.  This gives rise to the &lt;a href="https://en.wikipedia.org/wiki/Pareto_principle#In_computing" rel="noopener noreferrer"&gt;Pareto Principle aka 80/20 rule&lt;/a&gt; which has several impacts within computing code.&lt;/p&gt;

&lt;h1&gt;
  
  
  My thoughts
&lt;/h1&gt;

&lt;p&gt;As I was thinking about all of this and how it impacts the code that my team commonly writes it struck me where we experience this 80/20 rule everyday.  Writing application code is really writing the 80% of the application that is only 20% of the execution.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For Example:&lt;/em&gt; If you write a business application using ASP.NET and MVC, what you are doing is adding 80% of the code needed which accomplishes the business goals.  That 80% of the code though only accounts for 20% of the application execution.&lt;/p&gt;

&lt;p&gt;Now think about the ASP.NET MVC code that our code is built "over".  That code is only 20% of the code, but accounts for 80% of the execution - it's executed on every request, not just when the specific function is requested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F50n6q8bg9lhj0hbgzkl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F50n6q8bg9lhj0hbgzkl0.png" alt="Paretos Execution Count"&gt;&lt;/a&gt;&lt;br&gt;
Here we can see just how the first 20% accounts for about 80% of the execution.  Whereas our 80% is only executed 20% of the time, but it provides the width of functionality that accomplishes the specific business goals.&lt;/p&gt;

&lt;h1&gt;
  
  
  Take-Away
&lt;/h1&gt;

&lt;p&gt;My take away is that the bulk of developers spend most of our time focusing on the wide business needs.  This is very different from creating code that establishes a very effective framework.  For some of us that's great - but I think we should all challenge ourselves to dig into the hard stuff and write some framework-capable code.  Doing so opens us up to thinking about execution differently.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Why it's hard
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;It requires starting from zero.&lt;/strong&gt;  This is a different kind of thinking.  From blank you must come up with the M-V-C interaction.  You must "own" the methodology. Coming up with and reasoning this out is not natural for many of us. We want a framework to work within.  Writing a framework requires one to frame the generic problem (e.g. M-V-C = data-presentation-logic separation).  Maybe there are still better ways to frame things?  &lt;em&gt;Maybe data and logic should not be separated, isn't that the DDD approach?  Why does DDD still hide behind M-V-C in Web App development?&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;You must think about someone else's code.&lt;/strong&gt;  How do you make things work well for them? How can you keep things flexible? How will they think about their problem within your framing?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Documenting your code is very critical.&lt;/strong&gt;  Intellisense comments are critical for the consumer to be able to quickly understand what happens.  For example, consider a &lt;code&gt;Car&lt;/code&gt; class with a &lt;code&gt;Start()&lt;/code&gt; method.  Without intellisense, your caller must assume whether you mean Start Moving or just Engine started.  If this used only in 1 part of an application that's one thing.  But if you're writing framework code, we must assume everyone will need this method, and must understand it's purpose clearly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testing absolutely critical.&lt;/strong&gt;  When you write code that will be called so much, you must test into all the edge cases, and capture more as your work progresses.  If not, your bugs will account for 80% of the bugs. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why we should all do this
&lt;/h2&gt;

&lt;p&gt;Writing code and thinking along these lines pushes us to different limits. While I realize this isn't for everyone I do believe everyone can learn from this exercise.  If nothing else, it will help us to examine our own coding, testing, and documentation.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Web Components</title>
      <dc:creator>Ryan Posener</dc:creator>
      <pubDate>Fri, 24 Jan 2020 15:49:17 +0000</pubDate>
      <link>https://dev.to/rposener/web-components-45l0</link>
      <guid>https://dev.to/rposener/web-components-45l0</guid>
      <description>&lt;p&gt;The &lt;a href="https://www.webcomponents.org/"&gt;Web Components&lt;/a&gt; standard has been blogged and written about many times.  Many suggest the standard is not ready deferring to other popular frameworks.  This may be true for some people/teams - particularly those heavily invested in one framework or another. For new teams and projects I strongly recommend taking another look at native Web Components.  I am going to present a case that the standard is ready.  Remember that Native Web Components are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Universally compatible with every modern browser. Check the &lt;a href="https://www.webcomponents.org/"&gt;Browser Support&lt;/a&gt; here.&lt;/li&gt;
&lt;li&gt; The top Frameworks identify them as &lt;a href="https://reactjs.org/docs/web-components.html"&gt;complimentary&lt;/a&gt; &lt;em&gt;(React)&lt;/em&gt; , &lt;a href="https://angular.io/guide/elements"&gt;partially supported&lt;/a&gt; &lt;em&gt;(Angular)&lt;/em&gt;, and support as a &lt;a href="https://cli.vuejs.org/guide/build-targets.html"&gt;build/render&lt;/a&gt; &lt;em&gt;(Vue)&lt;/em&gt; target.&lt;/li&gt;
&lt;li&gt; Finally, they are the fastest - nothing can get much faster than using the raw browser APIs.&lt;/li&gt;
&lt;li&gt; As I'm going to &lt;em&gt;hopefully&lt;/em&gt; show you - easy and simple to use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;What are Web Components&lt;/em&gt;&lt;br&gt;
First, let me clarify what the Web Components standard really amounts to.  It's a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components"&gt;set of APIs to support developing Components&lt;/a&gt; for Web Applications that run in the browser.  It is not a framework with all the answers - this is just raw APIs.  Don't let this turn you off.  I'm going to demonstrate how you can accomplish the ease of a framework very easily.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why stick to a Framework&lt;/strong&gt;&lt;br&gt;
The plus to picking a framework is that hiring is eased as you can find people good at using your chosen framework.  A 3rd party framework also allows your Dev team a resource to look up recipes for how to accomplish a code challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use native Web Components&lt;/strong&gt;&lt;br&gt;
Not using a framework opens you up to more understanding, and frees your team to solve problems.  It requires your Architects and Senior Devs to discuss approaches and patterns and practices.  Your dev leadership will have to own the approach and teach the other team members instead of relying on another web site or courses to teach an approach dictated by a framework.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ok, convince me further...&lt;/em&gt;&lt;br&gt;
My &lt;a href="https://github.com/rposener/didactic"&gt;didactic project&lt;/a&gt; is a learning template for developers.  It solved many of the same benefits that frameworks are offer you.  This goal is to teach you to solve these problems yourself.  In the didactic project I intend to show how we can create &lt;a href="https://github.com/rposener/didactic/blob/master/instruct/OBSERVABILITY.md"&gt;declarative&lt;/a&gt; Web Components which are as &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM"&gt;isolated&lt;/a&gt; or not as you'd like.  Web Components that are light weight, fast and intelligently update the DOM. Web Components that use clean and concise code patterns that are SOLID and DRY.  Web Components that participate with the HTML and work as an application with visible and observable &lt;a href="https://github.com/rposener/didactic/blob/master/instruct/DATA.md"&gt;application data&lt;/a&gt; without the need for custom Dev tools.  Web Components that are easily &lt;a href="https://github.com/rposener/didactic/blob/master/instruct/MAKEANAPP.md"&gt;bundled and packed&lt;/a&gt; and work with every other framework (jQuery, Bootstrap, Angular, React Vue, Etc).  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now show me the code&lt;/strong&gt;&lt;br&gt;
What you will find is about 300 lines of well-documented code spread across 4 files.  That's it and I've created a pattern and solved for many of the same benefits of the big frameworks.  I think a new team could learn and understand a bit of code like this in such a manner that they will be as productive using these native APIs. Learning like this also opens the team to extending and growing parts of the code based otherwise typically off limits.  This in my opinion can be very freeing and empowering.&lt;/p&gt;

&lt;p&gt;Starting with no external dependencies and learning modern browser APIs your team is in a very different place than you find with a team that knows a framework and must look up the APIs.  Taking an approach like this will connect the development team with native browser and supports using the tools of your choice.&lt;/p&gt;

&lt;p&gt;Didact simply means to teach or instruct.  Take 15 minutes to read the couple pages and view the sample components.  Currently I have 3 example components, and I'm working on adding more samples.  If you have ideas or a challenge in mind for something you'd like to see how it can be accomplished with native Web Component API's - open an issue, clone or fork the code, or send pull request and let's give it a try.&lt;/p&gt;

&lt;p&gt;Here's the link again in case you missed it: &lt;a href="https://github.com/rposener/didactic/blob/master/README.md"&gt;github.com/rposener/didactic&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading my article.  I look forward to your feedback on my GitHub project site.  Maybe you can create an even better approach or something amazing.  If you do, share it!  I encourage you to review, learn and share these APIs.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Good to Great with Patterns</title>
      <dc:creator>Ryan Posener</dc:creator>
      <pubDate>Fri, 23 Aug 2019 15:10:55 +0000</pubDate>
      <link>https://dev.to/rposener/good-to-great-with-patterns-i5d</link>
      <guid>https://dev.to/rposener/good-to-great-with-patterns-i5d</guid>
      <description>&lt;h1&gt;
  
  
  The Project Pattern
&lt;/h1&gt;

&lt;p&gt;Each project seems to have a pattern.  In the .NET world, we typically start with some form of MVC. If you're doing micro-services, then REST becomes a top-priority for the team to agree about. On some projects it's DDD. I feel like no matter the team or project the team gravitates toward establishing a pattern statement like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We follow the ________ pattern on this project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's great to have a team talking patterns.  Code is looking clean and organized, things are making sense to new the jr. devs. And they are looking up to mid- and sr. devs who are glad to answer the questions from their vast experience with _____ pattern.  Those devs tell stories about it gone wrong, and experiences with teams that did it so much better than this team.  The team boasts and prides itself on working this pattern.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;These are good devs! This is a good team.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  The Pattern is a problem
&lt;/h1&gt;

&lt;p&gt;90% or more of all applications I have worked on use more than 1 pattern. The patterns cross each other, intersect and weave into the code.  But there gets to be so much discussion about 1 pattern everything revolves around it. Other patterns are mere after-thoughts. Thus starts the problem...&lt;/p&gt;

&lt;h2&gt;
  
  
  An Example
&lt;/h2&gt;

&lt;p&gt;The team that starts with MVC building a micro-services architecture which focused on REST endpoints has made everything REST-based.  Each element has it's own endpoint supporting GET, POST, PUT, DELETE and the occasional PATCH for each and every object they encounter.&lt;/p&gt;

&lt;p&gt;Their application is working with 50 requests to their micro-services per page view to build the up the view, and things start to get slow.&lt;/p&gt;

&lt;p&gt;Someone suggests a cache service returning a "composite" object in 1 request to speed things up.  It's micro-services, so why not add another query service to do just that?  Excellent idea - the team just gave themselves &lt;a href="https://martinfowler.com/bliki/TwoHardThings.html"&gt;the two hardest questions in computer science&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What they missed
&lt;/h2&gt;

&lt;p&gt;So a new kid joins straight out of DDD training, and dares to ask "why didn't you use DDD and leverage a nice aggregate root".  99% of this code requests everything from these 2 roots, and performs actions aligned to these roots.&lt;/p&gt;

&lt;p&gt;Of course, at this point the team quickly dismisses the notion because it's not the REST pattern that we have working.  After all that's just how micro-services are supposed to be done.&lt;/p&gt;

&lt;h1&gt;
  
  
  Take-away
&lt;/h1&gt;

&lt;p&gt;With any project, keep an open eye towards new patterns. Be astute and understand where different patterns are in the code.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This turns a good developer a GREAT developer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Be constantly asking questions like this to yourself as you code.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the JS-code following &lt;a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel"&gt;MVVM&lt;/a&gt;? &lt;/li&gt;
&lt;li&gt;Is there an aspect of code within that service layer that would benefit from a full &lt;a href="https://dddcommunity.org/"&gt;DDD&lt;/a&gt; approach? &lt;/li&gt;
&lt;li&gt;Are repository patterns consistent, or would they just splitting up and confusing an aggregate root?
&lt;/li&gt;
&lt;li&gt;Is there an &lt;a href="https://en.wikipedia.org/wiki/Multitier_architecture"&gt;n-Tier&lt;/a&gt; pattern and if used, how does our &lt;a href="https://www.thereformedprogrammer.net/is-the-repository-pattern-useful-with-entity-framework-core/"&gt;Unit-of-Work&lt;/a&gt; pattern work?&lt;/li&gt;
&lt;li&gt;Is State-Transfer &lt;a href="https://en.wikipedia.org/wiki/Representational_state_transfer"&gt;REST&lt;/a&gt; the right thing for your application or would it be more logical to use a &lt;a href="https://en.wikipedia.org/wiki/Remote_procedure_call"&gt;RPC&lt;/a&gt;-style method?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: &lt;a href="https://www.smashingmagazine.com/2016/09/understanding-rest-and-rpc-for-http-apis/"&gt;this article on REST confusion&lt;/a&gt; is a great read, and covers more specific examples in detail.&lt;/p&gt;

</description>
      <category>mvc</category>
      <category>mvvm</category>
      <category>ddd</category>
      <category>rest</category>
    </item>
  </channel>
</rss>
