<?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 kevin zhang on Medium]]></title>
        <description><![CDATA[Stories by kevin zhang on Medium]]></description>
        <link>https://medium.com/@kezhangkezhang?source=rss-b1a188b4c10d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XxF7rwU29vzmXeAY.</url>
            <title>Stories by kevin zhang on Medium</title>
            <link>https://medium.com/@kezhangkezhang?source=rss-b1a188b4c10d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 05:26:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kezhangkezhang/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[My 10 Principles to follow as a Developer]]></title>
            <link>https://medium.com/@kezhangkezhang/my-10-principles-to-follow-as-a-developer-ec7d3e2fdc0f?source=rss-b1a188b4c10d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec7d3e2fdc0f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programmer-life]]></category>
            <dc:creator><![CDATA[kevin zhang]]></dc:creator>
            <pubDate>Tue, 17 Sep 2019 16:44:34 GMT</pubDate>
            <atom:updated>2019-09-17T18:29:14.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kG2jccZ2XoxOrHrs" /><figcaption>Happy Coding</figcaption></figure><p>As a code advocate and writing code constantly on daily basis, I am striking to follow<strong> 10 </strong>simple practices for myself. These principles have no particular orders.</p><blockquote>Quality vs Time vs Quantity</blockquote><p>Never sacrifice quality for the time and quantity. When you receive pressure to deliver something, don’t tell yourself: I don’t have enough time so I will lower the quality of my code (e.g. error handling) to reduce the coding time. You can even tell yourself: I will make it better later.</p><p>In reality, we are all so busy and we will never have chance to go back to fix/improve the code. We are measured by the value we bring into our professional work.</p><p>It will be shame if my program is just implemented and bug is reported immediately.</p><blockquote>Format code &amp; document</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a6lNr2uvw7dGwocy" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Coding is for human communication. When code is formatted probably, it will make your life easily: debugging, readability, understanding the logic.<br>More important: this is one of the indicators between junior vs. senior programmer</p><p>There is no self-documenting code. Always create technical spec to explain high-level data flow, business logic, assumption etc. document is your life saver once: we can’t memorize everything.</p><blockquote>Check out file</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cAviQUxPdPxrcPvz" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When modifying an existing file, make sure you always check it out from revision control system. More important: make sure you are working on the latest version as production. You will cry a lot after spending hours coding and found out the code you started is not matching to latest production version</p><blockquote>Be a Lazy Developer</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ft_chLsm0CNowjo4" /><figcaption>Photo by <a href="https://unsplash.com/@simonmigaj?utm_source=medium&amp;utm_medium=referral">Simon Migaj</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Before you create any new object (e.g. function), always ask yourself: is there any existing object already there so that I can leverage? Don’t re-invent the same wheel. Leverage existing reusable components.</p><blockquote>Naming Conversion</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mX42Ty6WyQfjOS3E" /><figcaption>Photo by <a href="https://unsplash.com/@petekasprzyk?utm_source=medium&amp;utm_medium=referral">Peter Kasprzyk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As a developer, we like be innovative; however, when coming to the naming conversion, you should avoid innovation &amp; always follow the group practice naming file/DB object/Variable/Program etc.</p><p>Just like you want to give a meaningful name for your kids, make sure you name your stuff properly. It pays a lot!</p><blockquote>DRY and modular your code</blockquote><p>DRY: DO NOT REPEAT YOURSELF. If you find you are writing very similar code (e.g. a select statement) again and again with minor difference, considering to create a common function (reusable object). This is always a key indicator between junior vs. senior developer.</p><p>Try to avoid writing many lines of code for the same procedure. Such code is hard to debug and understand. Try to break it into multiple small logical code units.</p><blockquote>Confidence &amp; Ask Help if you don’t know</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4tcto_FY_SPm1olc" /><figcaption>Photo by <a href="https://unsplash.com/@mimithian?utm_source=medium&amp;utm_medium=referral">Mimi Thian</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In IT world, code is either 1 or 0. Don’t makeup the result. Study the business case, ER diagram. If you really can’t figure out, ask your peer to help you.<br>It is NOT A SHAME to say, “I don’t know. can you help me?”. This is much better than endless rework cycles.</p><p>Always doubt, for both your own ideas and others; however, don’t doubt your doubting: Stay confident!</p><blockquote>Dare to make the change and go beyond</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T2we-oODBe_OeRRw" /><figcaption>Photo by <a href="https://unsplash.com/@rossf?utm_source=medium&amp;utm_medium=referral">Ross Findon</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Just because something is running correctly, that doesn’t make it is running in the most efficient way or there is no room to improve.</p><p>Technology is always emerging and progressive. When working on some piece of code, try to see if you can improve any exiting code. Force yourself to rethink and refactor. This is a key indicators between leader developer vs. follower developer.</p><blockquote>Pay attention to New object</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rnu9gjlfCjPHlOka" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>when you introduce a new thing (object, table, code etc), you should put extra effort to make it best.</p><p>Typically, the footprint of an object is primarily established when it is born first time.</p><p>It is like building a new house, you want to build it correctly / efficiently / effectively … The benefit is long-term. if something starts with a defect from beginning, it is will take lots of effort to correct. So why not try your best to make it best first-time.</p><blockquote>Learn New Technology</blockquote><p>Always be aware of new technology. Just because you don’t use it today, that doesn’t make you will not use it tomorrow. Be prepared and ensure you are always progressing!!!<br>Exiting your <strong>comfort zone </strong>and challenge yourself by taking on features at the edge of your ability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d2Yh36tCLGEvjmAc" /><figcaption>Photo by <a href="https://unsplash.com/@ross_sokolovski?utm_source=medium&amp;utm_medium=referral">Ross Sokolovski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.</blockquote><blockquote>Henry Ford</blockquote><p>I hope these principles can help you to grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec7d3e2fdc0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Date Time Tips & Tricks for dummies and newbies]]></title>
            <link>https://medium.com/@kezhangkezhang/python-date-time-tips-tricks-for-dummies-and-newbies-9b3aad330eeb?source=rss-b1a188b4c10d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b3aad330eeb</guid>
            <category><![CDATA[datetime]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[kevin zhang]]></dc:creator>
            <pubDate>Tue, 17 Sep 2019 16:25:41 GMT</pubDate>
            <atom:updated>2019-09-17T16:25:41.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K44m-Pje7IW5d0LltMZnaA.jpeg" /><figcaption>Photo by Wil Stewart on Unsplash</figcaption></figure><p>In any programming languages, date / time is one of the most important building block and concept. For Python’s date / time, you don’t need to master all the functions for it; I’d like to list some common features that you will use on daily basis. here it is.</p><h3><strong>What is the date of today?</strong></h3><pre><em># import datetime library<br></em>from datetime import datetime</pre><pre>current_date = datetime.now()</pre><pre><em># print out<br></em>print(&#39;Today is: &#39; + str(current_date))</pre><pre><em># using formatted string literal for python 3.6+<br></em>print(f&#39;Today is {current_date}&#39;)</pre><pre>================== Result ======================<br>Today is: 2019-09-17 10:00:47.297912</pre><pre>Today is: 2019-09-17 10:00:47.297912<br></pre><p>Please notice you need to convert current_date (which is a datetime object) using <strong><em>str()</em></strong> function to print it out</p><p>Please notice if you are having python 3.6 or above, you can use <strong><em>Formatted String Literals</em></strong> ‘f’ string to format the string output.</p><h3><strong>Past date or future date</strong></h3><pre><em># import library<br></em>from datetime import datetime, timedelta</pre><pre>today = datetime.now()</pre><pre><em># using timedelta defining period of time<br></em>seven_days = timedelta(days=7)<br>today_on_last_week = today - seven_days<br>seven_days_from_today = today + seven_days</pre><pre><em># print out<br></em>print(&#39;Seven days ago was: &#39; + str(today_on_last_week))<br>print(&#39;Seven days from now will be: &#39; + str(seven_days_from_today))</pre><pre><em># using formatted string literal for python 3.6+<br></em>print(f&#39;Seven days ago was: {today_on_last_week}&#39;)<br>print(f&#39;Seven days from now will be: {seven_days_from_today}&#39;)</pre><pre>================== Result ======================<br>Seven days ago was: 2019-09-10 11:00:27.334369<br>Seven days from now will be: 2019-09-24 11:00:27.334369</pre><pre>Seven days ago was: 2019-09-10 11:00:27.334369<br>Seven days from now will be: 2019-09-24 11:00:27.334369</pre><p>Here the recipe is <strong><em>timedelta() </em></strong>module from <em>datetime </em>library</p><h3><strong>Slicing the Date time</strong></h3><pre><em># import datetime library</em></pre><pre>from datetime import datetime</pre><pre>today = datetime.now()</pre><pre>day = today.day<br>month = today.month<br>year = today.year<br>hour = today.hour<br>minute = today.minute<br>second = today.second<br></pre><pre>print(&#39;day is: &#39; + str(day))<br>print(&#39;month is: &#39; + str(month))<br>print(&#39;year is: &#39; + str(year))<br>print(&#39;hour is: &#39; + str(hour))<br>print(&#39;minute is: &#39; + str(minute))<br>print(&#39;second is: &#39; + str(second))</pre><pre><em># using formatted string literal for python 3.6+<br></em>print(f&#39;day = {day} month = {month} year = {year} hour = {hour} minute = {minute} second = {second}&#39;)</pre><pre>================== Result ======================</pre><pre>day is: 17<br>month is: 9<br>year is: 2019<br>hour is: 11<br>minute is: 3<br>second is: 56<br>day = 17 month = 9 year = 2019 hour = 11 minute = 3 second = 56</pre><h3><strong>String to Date Time conversion</strong></h3><pre># import datetime library<br>from datetime import datetime</pre><pre>cruise_day = input(&#39;What date you will cruise this year (dd/mm/yyyy)? &#39;)<br>cruise_day_date = datetime.strptime(cruise_day, &#39;%d/%m/%Y&#39;)<br>print(f&#39;Good luck for your cruise on {cruise_day_date}&#39;)</pre><pre>================= Result ========================<br>What date you will cruise this year (dd/mm/yyyy)? 12/12/2019<br>Good luck for your cruise on 2019-12-12 00:00:00</pre><p>I hope this thread inspire you to learn Python for your future project. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b3aad330eeb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>