<?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: Mariia Kornieva</title>
    <description>The latest articles on DEV Community by Mariia Kornieva (@mariia_kornieva).</description>
    <link>https://dev.to/mariia_kornieva</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%2F159575%2Fcde8e192-9026-43f3-af3b-81a8bb40213a.jpg</url>
      <title>DEV Community: Mariia Kornieva</title>
      <link>https://dev.to/mariia_kornieva</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mariia_kornieva"/>
    <language>en</language>
    <item>
      <title>Create your first Flask application</title>
      <dc:creator>Mariia Kornieva</dc:creator>
      <pubDate>Mon, 17 Aug 2020 07:36:16 +0000</pubDate>
      <link>https://dev.to/mariia_kornieva/create-your-first-flask-application-gpb</link>
      <guid>https://dev.to/mariia_kornieva/create-your-first-flask-application-gpb</guid>
      <description>&lt;p&gt;Flask is a micro web framework. It means that it is lightweight and extensible. By no means, Flask lacks in functionality due to its 'micro' nature. &lt;/p&gt;

&lt;p&gt;To create a basic Flask application, you have to go through the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Set up a Python virtual environment in your project directory.&lt;/p&gt;

&lt;p&gt;There are a lot of options here. I use the built-in module &lt;code&gt;venv&lt;/code&gt;. In order to activate it you need to execute next commands:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 -m venv venv
$ source venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Once you're done, execute this to deactivate your virtual environment.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ deactivate
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Install Flask in this virtual environment with:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m pip install flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a python file for your application. I usually call it &lt;code&gt;server.py&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Flask uses special environment variables &lt;code&gt;FLASK_APP&lt;/code&gt; and &lt;code&gt;FLASK_ENV&lt;/code&gt; when you start a flask application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;FLASK_APP&lt;/code&gt; should be assigned to the name of the file that Flask should run. In our case, it is &lt;code&gt;server.py&lt;/code&gt; that we've just created.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FLASK_ENV&lt;/code&gt; is used to toggle the Debug mode for the Flask app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To set up those execute following commands in your shell:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export FLASK_APP=server.py
$ export FLASK_ENV=development
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We are ready to create our first Flask app! In the &lt;code&gt;server.py&lt;/code&gt; add the following:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;In this code snippet, we imported the Flask class, which represents a flask application. On the second line, we create an instance of that class and pass the &lt;code&gt;__name__&lt;/code&gt; variable to it. &lt;code&gt;__name__&lt;/code&gt; is assigned to the string &lt;code&gt;__main__&lt;/code&gt; if the python module is executed, otherwise, it is assigned to the name of a module if it is imported.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then add the following function definition to your flask app:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'Hello, World!'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Here we use the decorator &lt;code&gt;@app.route('/')&lt;/code&gt; (decorator is a way of adding functionality to a function without altering that function implementation) to bind the specified URL with the function that should get called once the user tries to access that URL. In our case, we add a base URL &lt;code&gt;/&lt;/code&gt; and bind it to the function &lt;code&gt;index&lt;/code&gt;, which will return a string &lt;code&gt;Hello, World!&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In order to run this application, execute the following command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flask run
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;In your browser, go to the &lt;code&gt;127.0.0.1:5000&lt;/code&gt;, and if you have set up everything correctly, you will be able to see &lt;code&gt;Hello, World!&lt;/code&gt; in your browser window.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the next blog post, I will cover how to use HTML templates and template inheritance using the Jinja templating engine, to utilize the fundamental principle of software design, the DRY principle. Stay tuned!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>flask</category>
      <category>python</category>
    </item>
    <item>
      <title>Learning Tips for Software Engineers</title>
      <dc:creator>Mariia Kornieva</dc:creator>
      <pubDate>Sat, 15 Aug 2020 10:32:46 +0000</pubDate>
      <link>https://dev.to/mariia_kornieva/learning-tips-for-software-engineers-307m</link>
      <guid>https://dev.to/mariia_kornieva/learning-tips-for-software-engineers-307m</guid>
      <description>&lt;p&gt;We all struggle to learn new things. It is tough, but in the end, it's gratifying.&lt;/p&gt;

&lt;p&gt;It's easy to passively watch dozens of tutorials, seeking inspiration and motivation to start building your next project finally. But the truth is that when you actually start developing, you struggle. What seemed so easy on a video is hard to do if you aren't used to it.&lt;/p&gt;

&lt;p&gt;I have been through this process a lot of times, but I adopted two handy techniques that help me learn easier. Those two are active recall and spaced repetition.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Active Recall&lt;/strong&gt; means that in order to learn something, you need to retrieve information from your brain actively. This is exactly the reason why you feel like you better understand concepts when you teach others or when you're writing a blog post, making a video, you name it. All of these involve a lot of active recall.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traditionally flashcards are used to make use of the active recall technique. However, I haven't found flashcards useful when learning to code. In my opinion, the best way to &lt;em&gt;practice active recall as a programmer&lt;/em&gt; is to &lt;strong&gt;&lt;em&gt;build projects&lt;/em&gt;&lt;/strong&gt;! Just think about it. Every time you start a new project, you often go through many similar steps again and again.&lt;/p&gt;

&lt;p&gt;Let's take CSS as an example (I've been learning it lately). Every single time you need to style a new webpage, you make use of the same properties over and over again, you position elements using flexbox or CSS Grid over and over again. And every single time, you have to retrieve the styling and positioning information from your brain, or if it's not yet in your brain, you need to upload it into it. That is a perfect use of active recall. And that is the reason why you don't need to learn all CSS properties by heart ahead of time. When you start applying them, it will be just uploaded into your brain. Consistency is the key!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Spaced Repetition&lt;/strong&gt; is about deliberate repetition over time. Basically, it uses active recall as a method of repetition, since it is the most effective one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spaced repetition is a vital technique due to the fact of what's known as a forgetting curve. You forget most of what you learn in the first 24 hours. To reduce this rate of memory decay, you should repeat what you've learned. I highly recommend reading &lt;a href="//ncase.me/remember"&gt;this webpage&lt;/a&gt;. It contains a fantastic explanation of the science behind the forgetting curve phenomenon. Hope it will convince you that repetition is crucial.&lt;/p&gt;

&lt;p&gt;The most important fact is that these two techniques work if and only if they are applied together. It would help you if you built a durable and long-lasting habit of repeating learned concepts to make them stick.&lt;/p&gt;

&lt;p&gt;So the next time you're watching a tutorial or reading a book, try to do the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Repeat what you've just read&lt;/li&gt;
&lt;li&gt;Code an application you've just seen in the tutorial&lt;/li&gt;
&lt;li&gt;Tell others about what you've learned&lt;/li&gt;
&lt;li&gt;Repeat!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Yes, it takes time, but it leads to long-lasting fundamental knowledge that you can use to build upon when learning more advanced topics. And as for learning, it's a continuous process.&lt;/p&gt;

&lt;p&gt;Thanks for reading my post and happy learning!&lt;/p&gt;

</description>
      <category>learning</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
