For this weeks Blog Post I will discussing the pattern known as “Sustainable Motivations”. The Sustainable Motivation pattern is almost what it sounds like, where you require motivation to keep going. Anyone who knows programming knows that if a programmer is given the chance to do it there way, that is there biggest motivation. The context behind this is that you must develop your technical skills because of this you will find yourself working in a messy reality of specified projects for customers with different demands. The problem that arises is that when working in the real world trenches of projects you will find rigorous, tedious, exhausting, frustrating and constraining effects. The solution to this is that you need to ensure your motivations for craftsmanship will be able to adapt and survive through the Long Road ‘s (pattern) trials. For the most part there will be days and more that you love your job, getting paid to develop software and such. Where the work will just come natural to you without much effort. These days wont be ordinary days, because most programming jobs you will face tedious, vague definitions, and overly complex problems. You could even face some spotty leadership problems, difficult coworker personalities and other troubles. Because of this you may begin to question your commitment to the craft. When faced with these problems its almost imperative that you are aligned with the Long Road. Some examples could include you hating your programming job and are only motivated by the money. Where you value climbing the corporate ladder over honing the skills of your craft. But also are motivated by your reputation as a technologist, allowing you to survive and endure to the sun shines once more in your job. Another example could be you are motivated by your enjoyment of actual programming, where you then come up on a length of time where you cant find the love. But you are motivated by the money, and that programming is financially the best option right now, causing you to be motivated. All of these are good examples of how to be motivated but the best way to figure out yourself is to write down some motivations for you. Keeping this list somewhere safe where you can come upon it when times get tough. This pattern is something 96% of people can relate to, in almost any motivational situation and one I will see myself using down the road.
Angular Unit Testing
For this week’s blog post I thought I would take a look at Angular Testing considering in class we have been discussing it and are going to use it for our final project. From the site I found they go into great detail as why it is good to use angular and overall how to conduct it properly. They first start off by listing an example of code that complies properly and “works” but under a more complex situation with dozens of tests in a suite it may begin to fall apart. They go on to explain that for every run it will recompile the components and operations taking up to 75% of your time recompiling and not actually running the tests themselves. Next, they show an Angular Testbed monkey patch that will patch the testing framework resetting the testing module before each run and each test. The TestBed.resetTestingModule function they use will clean up all the overrides, modules, module factories and disposes all active fixtures as well, essentially cleaning up what you have. A _initIfNeeded function then comes into play , preserving the factories from the previous run doing what they need to do. If the flag is false the TestBed function will re-create components required for the test, creating a new zone and testing module but not recompiling anything if moduleFactory is in its correct place. After this they run the code they have, clocking in at a 24 second run time to complete its test suite. Then they apply the patch by calling a setupTestSuite function and replacing beforeEach with beforeAll causing the run time to become 8 seconds. A notice 3x time increase in time efficiency for this certain example. With this patch it allows them to preserve the compliation results and re-use them for multiple test per suite.
After this they start up Karma parallel tests, allowing for the tests to be run in parallel. This website shows all the code which is quite lengthy and I wouldn’t want to subject you all to a blog post that takes up too much space. By clicking the link below you can see all the code they have and more. All and all this website was pretty handy and interesting with what they described and how to show angular to its potential.