<?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: Nicholas Bilyk</title>
    <description>The latest articles on DEV Community by Nicholas Bilyk (@nbilyk).</description>
    <link>https://dev.to/nbilyk</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%2F560499%2Fe9d6a30b-8739-4486-a553-507094db5941.jpg</url>
      <title>DEV Community: Nicholas Bilyk</title>
      <link>https://dev.to/nbilyk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nbilyk"/>
    <language>en</language>
    <item>
      <title>How to Become a Millionaire</title>
      <dc:creator>Nicholas Bilyk</dc:creator>
      <pubDate>Fri, 17 Jun 2022 01:17:35 +0000</pubDate>
      <link>https://dev.to/nbilyk/how-to-become-a-millionaire-3daf</link>
      <guid>https://dev.to/nbilyk/how-to-become-a-millionaire-3daf</guid>
      <description>&lt;p&gt;This post is about how to achieve financial independence as a software engineer. Admittedly a clickbait title, but now please stay awhile and listen.&lt;/p&gt;

&lt;p&gt;We're entering what will likely be a pretty sharp recession. The fed has raised interest rates, growth-focused stocks, particularly tech stocks have fallen like a piano, and inflation is at an all-time high. This article is how to use that to your advantage.&lt;/p&gt;

&lt;p&gt;Firstly, why you should listen to me. I could honestly say that I'm a Silicon Valley Entrepreneur, and have made, lost and made again fortunes. However, the real reason you should listen is that I'm just a lazy schmuck that's figured out at least a little bit how to make things work. &lt;/p&gt;

&lt;p&gt;My family never talked about money. We never talked about how to invest, never talked about compound interest or where to find it. I was in the fifth grade talking to a classmate and he was looking up things he was going to buy with the stock dividends he was making. It took me a decade to even know what on earth he was talking about. &lt;/p&gt;

&lt;p&gt;We're all very busy people. I know I don't have time to be studying all the ins and outs of investing. That's why a lot of times as young professionals we're approached by financial managers. They will buy you lunch in order to give their pitch, they'll kiss your butt and somehow convince you to give your money to them with their promises to multiply your money.&lt;/p&gt;

&lt;p&gt;Here's the funny thing about that. You know they charge fees for their services. You only assume that those fees are won back many times over by their expertise. Expertise in what? Predicting the future? Nobody can do that. Your money goes into a big pool where it's distributed in various ways you're perfectly capable of investing in yourself after an hour of research. &lt;/p&gt;

&lt;p&gt;You're familiar with the phrase in gambling, "The house always wins." This is based on discreet math. Casinos make sure that the expected value of every game they have is over 50% in their favor. Enough time at the table you'll always lose. You might have a good night, a good week, or even a good month, but you'll always lose in the long run.&lt;br&gt;
This is the opposite in the stock market. Yes you have winners and losers, but overall on a whole the stock market will make money. It's not gravity, it's not a Ponzi scheme, the stock market will always go up in the long run as long as companies are still making profits. If this weren't true the economy would collapse and the money you stuffed under the mattress would be about as valuable as toilet paper (which who knows, maybe that's a lot).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1TNtPMT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd8h4xfuotixtm7ddnzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1TNtPMT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd8h4xfuotixtm7ddnzj.png" alt="Image description" width="880" height="661"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you haven't heard of index funds, look them up. It's a way of investing in a diverse range of stocks. It's a way of "being the house" so to speak. VTI, which is the Vanguard Total Index fund, for example, has had an average return of 10% / year and 1.5% dividends for the last 40 years [citation needed]. This means if you invested 10K/year for 30 years you'd have about $2M [citation needed].&lt;br&gt;
Compare this to your 401K. They have you make all the decisions anyway, so you're the one deciding what ratios of investment, whether that's money market accounts, stocks, etc. And then they charge you annually for each account, even if a human hasn't so much as looked at your account in decades. With long term investment, every fee and percentage point matters. Look at your 401K closely. Are you impressed with the 0.01% APYE yields and $150 recurring fees? Why do you even bother? Buying gold and burying it in your back yard would do better. Literally spending all your money buying Legos and making little Lego houses would give you better rates of return.&lt;/p&gt;

&lt;p&gt;So what does this mean in a slump? In an imminent recession?&lt;br&gt;
The crux of it is that neither you, nor anybody else, can predict the future. Well, kind of. You can make obtuse logical statements such as, "It will either go down indefinitely until money isn't worth anything anymore, or it will bounce back at some indefinite point in time."&lt;br&gt;
Your 401K has no intelligence. You at least hopefully have the basic intelligence to buy low and sell high. Right now everything is on sale. Even if the market continues to slide for the next decade, because you're buying low, when there's the inevitable rebounds, you will make money.&lt;/p&gt;

&lt;p&gt;If you liked my ramblings, I have another one brewing about self-funded development projects :)&lt;/p&gt;

&lt;p&gt;GL HF&lt;br&gt;
-Nick&lt;/p&gt;

</description>
      <category>money</category>
      <category>investing</category>
    </item>
    <item>
      <title>Which Test Framework?</title>
      <dc:creator>Nicholas Bilyk</dc:creator>
      <pubDate>Fri, 15 Oct 2021 23:29:16 +0000</pubDate>
      <link>https://dev.to/nbilyk/which-test-framework-5c3a</link>
      <guid>https://dev.to/nbilyk/which-test-framework-5c3a</guid>
      <description>&lt;p&gt;I'm going to keep this short, sweet, and very opinionated. I recommend you do your own research but for those looking into testing JavaScript or TypeScript I hope to help with a very high level overview. Also a disclaimer that this is the web, check the dates on your sources, this article might be obsolete tomorrow :)&lt;/p&gt;

&lt;p&gt;So you're choosing a testing framework, which to choose? What are the kids using these days?&lt;/p&gt;

&lt;p&gt;(Ranked by popularity, not by my personal preference)&lt;/p&gt;

&lt;h1&gt;
  
  
  #1 Jest
&lt;/h1&gt;

&lt;p&gt;Creator: Facebook &lt;br&gt;
Weekly Downloads: 13,942,759&lt;/p&gt;

&lt;p&gt;Pros: &lt;br&gt;
  Most popular&lt;br&gt;
  Good tooling / plugins for IDEA, VSCode, CLI&lt;/p&gt;

&lt;p&gt;Cons:&lt;br&gt;
  NodeJS only, if you want to run Jest in a browser it takes considerable effort with puppeteer. Jest-puppeteer is poorly maintained.&lt;/p&gt;

&lt;p&gt;Overall:&lt;br&gt;
  Jest is great for unit tests. My staunch opinion is that code written for a browser should be integration tested in a browser. This is at the very least more difficult to do in Jest than Mocha or Jasmine, so this is a non-starter for me.&lt;/p&gt;

&lt;p&gt;Jest has batteries included, that means it is full-featured in that you get a test runner, assertion libraries, and many utilities like mocking, spies, time harnesses, asynchronous testing, you name it. &lt;/p&gt;

&lt;h1&gt;
  
  
  #2 Mocha
&lt;/h1&gt;

&lt;p&gt;Creator: OpenJS Foundation&lt;br&gt;
Weekly Downloads: 5,293,954&lt;/p&gt;

&lt;p&gt;Pros:&lt;br&gt;
  Works well with Node and browsers&lt;br&gt;
  Has good tooling for IDEA, VSCode, and CLI&lt;/p&gt;

&lt;p&gt;Cons:&lt;br&gt;
  Requires additional libraries for everything. Typically chai for assertions, sinon for mocking.&lt;br&gt;
  Chai syntax is obscure and hard to remember.&lt;/p&gt;

&lt;p&gt;Overall:&lt;br&gt;
  If you want to get started with mocha, you'll need a combination of libraries, for example &lt;code&gt;npm i -D mocha chai sinon chai-sinon&lt;/code&gt;&lt;br&gt;
Besides a more complicated setup, Mocha, or more specifically Chai, in my opinion, takes behavior driven development a little too far. When building your assertions in Chai there is this chaining syntax that's meant to be a human language to your tests. For example instead of: &lt;code&gt;expect(undefined).toBeUndefined()&lt;/code&gt; it's &lt;code&gt;expect(undefined).to.be.undefined&lt;/code&gt;&lt;br&gt;
or instead of &lt;code&gt;expect(foo).toEqual(bar)&lt;/code&gt; it's &lt;code&gt;expect(foo).to.deep.equal(bar)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This can lead to easily made mistakes in your tests. &lt;code&gt;expect(foo).to.be.defined&lt;/code&gt; will always pass because &lt;code&gt;defined&lt;/code&gt; doesn't exist. Instead you should have written &lt;code&gt;expect(foo).to.not.be.undefined&lt;/code&gt;, which IMHO is insane. &lt;/p&gt;

&lt;h1&gt;
  
  
  #3 Jasmine
&lt;/h1&gt;

&lt;p&gt;Creator: Pivotal Labs&lt;br&gt;
Weekly Downloads: 1,865,652&lt;/p&gt;

&lt;p&gt;Pros:&lt;br&gt;
  Very similar to Jest&lt;br&gt;
  Batteries included&lt;br&gt;
  Works out of the box in Node and a browser&lt;/p&gt;

&lt;p&gt;Cons:&lt;br&gt;
  Not &lt;em&gt;quite&lt;/em&gt; Jest&lt;br&gt;
  Ugh, what is that color, cannon pink?&lt;br&gt;
  IDEA extension needs work&lt;/p&gt;

&lt;p&gt;Overall:&lt;br&gt;
  This framework feels like it's trying to be Jest; the syntax is almost identical, and except for a couple nitpicks, Jasmine is succeeding. Being able to run in a browser out of the box is the real selling point here. I can create selenium tests that execute my Jasmine unit and integration tests in a headless browser for continuous integration, and I can create a static page that can run my tests on any device with a browser. &lt;br&gt;
The IDEA extension needs to add debug support, debugging unit tests is a must-have for me and the only way to currently do this with Jasmine tests is to debug the main npm run test task.&lt;/p&gt;




&lt;p&gt;TypeScript Notes:&lt;br&gt;
They all work with TypeScript, but with some additional work.    Namely, you have to register something like ts-node to transpile at runtime.&lt;br&gt;
Example:&lt;br&gt;
&lt;code&gt;npm i -D ts-node&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In your run configuration template:&lt;br&gt;
Node options: &lt;code&gt;-r ts-node/register&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Jest with React has a project creator that can set things up for you out of the box. This is great if you're using React :)&lt;/p&gt;




&lt;h1&gt;
  
  
  Bottom Line
&lt;/h1&gt;

&lt;p&gt;You do you, mang. &lt;/p&gt;

&lt;p&gt;I'd use Jest if it had browser support (Puppeteer doesn't really cut it for me.) Maybe there's a better way, let me know :). Until then, Jasmine has been great!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting JSDoc to work with TypeScript typedef imports.</title>
      <dc:creator>Nicholas Bilyk</dc:creator>
      <pubDate>Wed, 27 Jan 2021 19:07:32 +0000</pubDate>
      <link>https://dev.to/nbilyk/getting-jsdoc-to-work-with-typescript-typedef-imports-28nf</link>
      <guid>https://dev.to/nbilyk/getting-jsdoc-to-work-with-typescript-typedef-imports-28nf</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sQxTX6fr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cm61eyu809ir862x9bax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sQxTX6fr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cm61eyu809ir862x9bax.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've been on a journey to write less esoteric, more accessible code. Before I start writing up my experiences, I'd like to announce a tiny, tiny utility that solves a simple problem I hit when doing plain javascript development. &lt;/p&gt;

&lt;p&gt;To document and get type hinting for plain JavaScript, the easiest way to do so is to use a tool called jsdoc. The problem is when you wish to import type definitions &lt;code&gt;/** @typedef ... */&lt;/code&gt; into another file for re-use. VSCode doesn't understand the jsdoc module import format, and jsdoc doesn't understand the typescript style import. My utility works to translate.&lt;/p&gt;

&lt;p&gt;For more information, head over to:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/polyforest/jsdoc-tsimport-plugin"&gt;https://github.com/polyforest/jsdoc-tsimport-plugin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jsdoc</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>typedef</category>
    </item>
  </channel>
</rss>
