Author Archives: CS@Worcester – Tyler Lundstrom

Capstone Project: Week 3 Reflections

Yet another week here and gone. This weeks reflections will be fairly brief due to it being the end of our sprint and having a weekend with nothing to work on. However, we did have a sprint retrospective this week due to our sprint completion! The retrospective went well. Our team has really great communication and that has helped us, so these retrospectives are just re-caps of things we found during the week.

One of the major issues we discussed was with our daily stand-ups. Due to us having to all do them remotely there leaves a lot open for loosely worded statements. We were using a lot of “I’ll try” or “I might get it done” and we wanted to clear up this language and be more precise. We found that two things happened when we became more precise.

  1. Others trusted what we said and knew we were going to get done what we said.
  2. We held ourselves personally accountable to truly get the things done that we said we were going to.

These two things I feel are very important for any scrum team!


We did our first real sprint planning today and I am very excited to start working with the AMPATH code and seeing what true professional software looks like!

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

Capstone Project: Week 2 Reflections

Another week, here and gone. Man time flies by when you’re having fun!

This past week the group and I made our first approach to google’s javascript framework, Angular 2. We dove right in with TypeScript and Angular2 by following the Tour of Heroes tutorial. This was pretty awesome but also very overwhelming. I found that it was quite a bit of information to digest in such a small amount of time. I, just as many others, learn best by solving problems of my own so I actually tried to tweak the tour of heroes a little bit here and there to learn a little bit more. As we dive head-long into the AMPATH project I am sure there will be times where I am completely overwhelmed, due to having to learn this brand new framework but something about that really gets me giddy like a child! I enjoy stretching my knowledge base and this is a for-sure way to do that.

In retrospect, one tutorial felt too short and I felt I didn’t learn enough. Myself and others in my group have decided to append our sprint, mid sprint to extend our Angular 2 learning. I have started reading the advanced guide to Routing on the Angular website to try and glean a little better understanding in this complex topic.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

The Clean Coder: Chapters 3 & 4

Another week done and two more chapters of The Clean Coder read. This book has been quite enjoyable and it’s nice to have assigned reading from school that isn’t so “text-booky”. It’s nice to have something to read that is someone’s personal experience in the field of software engineering and hear about his successes and mistakes.

Chapter 3 talked about the flip side of chapter 3, saying yes and when to say it. I really enjoyed this chapter because it’s something I had make an conscious effort to approach in the past 9 months or so. I noticed at work I was using the phrases “try to get it done” and “might get it done”. I noticed this was simply giving me an excuse to take things at more of a relaxed pace and maybe not giving 100% to my employer. In May or June (I do not recall the exact date) I was moved into more of an IT infrastructural role at work. My first task.. Fully rebuild the LAN/WLAN structure of the facility. The president of the company told me this was of high importance to get this done a.s.a.p. and requested I estimate how long this would take. After some research and getting the things I needed on order I gave my boss a definitive date of 2 weeks until completion. Because I gave the president a definitive date and completed 2 days ahead of that date. He then started giving me tasks that we meant for my immediate supervisors because he knew that we would get a date things would be done by. I have since found that using correct language and giving good time tables creates better channels of communication and makes everyone in the organization happier.


Chapter 4 was the first time I had some serious differences in my ideas compared to Uncle Bob’s ideas. This was negated by the fact that he explicitly stated:

You will likely not agree with everything I say here. After all, this is deeply personal
stuff. In fact, you may violently disagree with some of my attitudes and principles.
That’s OK—they are not intended to be absolute truths for anyone other than me.

I find it funny that he had to mention 3 AM code. It seems to me that the general idea behind anyone who has tried solving a difficult problem with programming has come across this at least once in their efforts. I know I’ve talked with multiple programmers who all say the same thing, “If you can’t solve it, walk away for a while”. I’ve even told this to many programmers. It’s just a fact of life with any issue you can’t solve immediately. If you walk away and let your subconscious mull on the issue, 9 times out of 10, you’ll find the solution.

The one major thing I disagree with Uncle Bob on, is listening to music when trying to be productive. I am never more productive without music. I imagine this is something that changes from person to person as well. I know for my wife, she’s the most productive when things are dead silent. Now she’s a not a programmer and has never written a line of code but everyone has their own way of steadying their brain to focus in on a task. Part of my ritual to steady my brain is put on some music. Now I know that he also mentions avoid getting into the zone and this is something I already avoided anyways. But what music helps me accomplish is two things. It helps me set a rhythm to my work that keeps easily distracted part of my brain busy. Also, when I have headphones in it lets others know that I am baring down to get work done. In my office there are times I simply need to get stuff done and don’t have time for idle chit-chat. These are the times I find music especially helpful. If someone needs me they know they can simply come in to my area and I will almost always take my headphones off immediately. However, it puts up some sort of barrier that tells people I am too busy to chat about non-work-related topics.


All-in-all, it was another good week of reading what Uncle Bob had to say on Software engineering! I look forward to see what he has to say in Chapters 5 & 6.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

Capstone Project: Week 1 Reflections

This was the first week we began working on the Capstone project class. This week we didn’t do too much in the line of actual development so I don’t have too much to talk about. However, we did form the teams that we’d be working with for the entire semester. Myself and a group of my friends were lucky enough to all be paired together. We’ve done some group projects before and know each other’s work ethic and what we need to do to push each other. I really enjoy working with these teammates as well, so that helps immensely when you’re about to spend the next 3 months with them working on a project.

We are going to be working in the Ampath project that is part of the OpenMRS group project. I have looked into the OpenMRS project prior to this class but never took the dive to begin developing for them. I am incredibly excited to have an opportunity to work with a code base as large as this one. This will be the first time I really dive into a project that I haven’t worked on or seen previously and will be working with someone else’s code quite a bit and that will be a new experience as well. The project we will be working in using Angular2 which is a javascript framework that I have done small personal projects in but haven’t done anything to this scale so I am incredibly excited to be getting this experience as well.


As a side note apart from school, I have been brushing up on my Angular2 skills by following this scotch.io tutorial as well as learning Ruby during some of my extra free time. I am enjoying Ruby as a language however, I find developing in PHP to be my comfort zone and ruby syntactically is a bit different. I find myself forgetting to close if statements with end as well as my loops. I am sure this is something I will get used to but it will take time!

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

The Clean Coder: Chapters 1 & 2

The Clean Coder, this is my first book by Uncle Bob (Robert C. Martin) that I’ve read. Clean Code was on my list of “to read” books along with many other great books for programmers and developers. I had been working through Godel, Escher, Bach: An Eternal Golden Braid, albeit at a sluggish pace and that is a great book as well. However, I read through the first two chapters of The Clean Coder this week and it is simply amazing. It’s a breath of fresh air from all the other “coding” books. What’s most interesting about this book is the fact that, at least with these first two chapters, the ideas extend far beyond just software development. His ideas of professionalism will essentially make any type of career better.


Chapter 1 began by talking about Professionalism. Uncle Bob’s main point in this chapter to strive towards professionalism was taking responsibility for our problems. He elaborated on this and really pushed the point of “Do No Harm”, and by this he meant strive create working and easily maintainable code. Obviously this is what we all strive for as programmers, but he went a step beyond that and began talking about making the responsibility of “perfect code” ours and ours alone. Don’t leave it to the QA team to find and report bugs, take that on yourself. Don’t leave it up to someone else to refactor your code to make it more extensible, do that yourself. I really appreciated this point, because sometimes I find myself slipping into the mindset of, “I don’t need to take care of that, it’s someone else’s problem. Even if I don’t have the answer 100% I should do my best to help the person reach the solution faster.


Chapter 2 talked about Saying no. This is something I personally struggle with. I am the kind of person who generally can’t tell people no – especially my bosses. I was bread with the mindset, from an early age, that when your employer instructs you to do something, do it. Now not to say this is a bad mindset by any means, but in the real world this can seriously hurt your career and your companies future.

My first major piece of “Software” the I ever attempted at building was a simple front end for a database that also had some data crunching abilities. I also had to design and build out the database. My company is not a software company but an environmental engineering firm so no one really had a clue about building software/coding. Fairly straight forward and easy to build project, for a Senior in his CS degree program. However, when I started this program I was in my first year as a CS student. At this point I had written small programs in languages like Java or Python, but each of these programs did simply CLI type functions and nothing too complicated. I think the most interesting thing I had done at this point was a Fibonacci calculator that used recursion and memoization. I hadn’t approached any problems that essentially required an architecture that used a front end as well as needed data persistence. I had no idea where to begin but I dove in anyways. I told my boss it was going to take 3 months or so to build something like this. I was going to work non-stop over the summer on this project to get it done. The end of the summer came and I felt I barely had anything done. I was probably half way done with the feature sets that had been requested but felt I was on a roll. When my boss asked when it wouldn’t be done, I responded with the fact that I was “unsure”. I wasn’t sure what more bumps I was going to hit along the way because I had no experience at this. He gave me three more weeks and he wanted it done. I said okay.

I got all the features done is this program and it’s still being used at my company today. But I get requests constantly to fix some bug because I didn’t have time to test it. Because I didn’t tell my boss “No I can’t finish it in three weeks”, I was left with an embarrassing piece of work that I always afraid to show people due to my unprofessionalism during the development of that project.


In summary, I am extremely excited about going through this book and being able to apply what I read to not only Capstone project but also to my day to day work life. I think that not only developers should read at least the first 2 chapters of this book but anyone who builds a product for a customer.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

A Test Post for Capstone

Hey everyone,

This is basically just a post saying hi and testing to make sure it links to the CS@Worcester blog. I am super excited for this Capstone class and to be working with the OpenMRS group. Excited for the semester ahead!

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

Lambdas vs. Closures

At one point in every persons life they’ve asked themselves the question.. What’s the difference between a lambda and a closure! Okay I admit maybe not everyone asks this questions but certainly I did a few days back. I was working on a project that kept referring to the use of closures and to me they looked a lot like lambda functions. I did a little googling and stumbled across this blog post.

The blog post went into depth about what a lambda is and what a closure is and the difference. Come to find out, they are extremely similar hence why I thought all those Closures looked like a lambda.

The main difference between the two is the fact that Closures can access variables outside of the scope that it was created which becomes incredibly powerful in certain circumstances.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

What is Reasonable Test Coverage?

Earlier this week I was reading through some blogs and stumbled across this particular piece that I found highly amusing but answered a question that I had been looking for an answer.

I found this article called The way of Testivus. It’s essential Confucius meets programming. While reading through and chuckling at most of the things mentioned on this page I stopped being side tracked and continued to see if I could find a good answer to my question – What is a reasonable amount of test coverage? As I continued to google I landed back onto the artima.com forums and found there was the question I had been searching for. Funny enough the writer of the “The way of Testivus” replied with an answer to this poster’s questions

Testivus On Test Coverage
Early one morning, a programmer asked the great master:

“I am ready to write some unit tests. What code coverage should I aim for?”
The great master replied:

“Don’t worry about coverage, just write some good tests.”
The programmer smiled, bowed, and left.

Later that day, a second programmer asked the same question.

The great master pointed at a pot of boiling water and said:

“How many grains of rice should put in that pot?”
The programmer, looking puzzled, replied:

“How can I possibly tell you? It depends on how many people you need to feed, how hungry they are, what other food you are serving, how much rice you have available, and so on.”
“Exactly,” said the great master.

The second programmer smiled, bowed, and left.

Toward the end of the day, a third programmer came and asked the same question about code coverage.

“Eighty percent and no less!” Replied the master in a stern voice, pounding his fist on the table.
The third programmer smiled, bowed, and left.

After this last reply, a young apprentice approached the great master:

“Great master, today I overheard you answer the same question about code coverage with three different answers. Why?”
The great master stood up from his chair:

“Come get some fresh tea with me and let’s talk about it.”
After they filled their cups with smoking hot green tea, the great master began to answer:

“The first programmer is new and just getting started with testing. Right now he has a lot of code and no tests. He has a long way to go; focusing on code coverage at this time would be depressing and quite useless. He’s better off just getting used to writing and running some tests. He can worry about coverage later.”

“The second programmer, on the other hand, is quite experience both at programming and testing. When I replied by asking her how many grains of rice I should put in a pot, I helped her realize that the amount of testing necessary depends on a number of factors, and she knows those factors better than I do – it’s her code after all. There is no single, simple, answer, and she’s smart enough to handle the truth and work with that.”
“I see,” said the young apprentice, “but if there is no single simple answer, then why did you answer the third programmer ‘Eighty percent and no less’?”

The great master laughed so hard and loud that his belly, evidence that he drank more than just green tea, flopped up and down.

“The third programmer wants only simple answers – even when there are no simple answers … and then does not follow them anyway.”
The young apprentice and the grizzled great master finished drinking their tea in contemplative silence.

 

In my early stage as a programmer I decided I am going to dedicate myself to not best understanding what I should be looking for in code coverage but better understanding how I can get there with quality tests.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

Creating Tests with Laravel

Laravel, Artisan and Testing

By: Tyler Lundstrom

The past few weeks I have been working on a project using the Laravel PHP framework. So far I love it and it has increased my abilities and knowledge for developing PHP immensely. One of the many great things about Laravel is it’s Artisan tool. Laravel’s Artisan tool is used to to create a lot of the boiler plate code for you as well as put the generated files in the proper repositories.

The command I’d  like to talk about today is php artisan make:test this command when given a name will auto generate the test boiler plate you need to running unit tests in Laravel. This saves you time from having to manual type out all the files you are using as well as the class name and extensions. As a side note about the extension, you extend a class called TestCase which is an abstract class that has many of the boiler plate style syntax already filled out and you simply just extend upon that.

Once your file is created and you are ready to start creating your tests writing PHPunit is now as simple as creating jUnit code.

public function testExample(){ $this->assertTrue(true); }

That’s all you need to know about testing with Laravel. Thank you Taylor Otwell for making PHP development a delight!

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.

Ugh! PHP Unit Testing

I tend to spend a lot of time programming in PHP in my free time. One of the things I have been looking at, since I am taking a software testing class, is PHPUnit and unit testing in PHP. I was getting discouraged with how odd PHPUnit seemed in comparison to the ease of use of something like JUnit. I stumbled upon this blog post that is a conversation between two people about PHPUnit.

The conversation starts with Ed explaining how he doesn’t like PHPUnit specifically:

Ed: I guess realistically my complaints are aimed at PHPUnit . It’s very powerful and very complete from what I can tell, but I think it’s difficult to pick up and I think that difficulty makes people less likely to use it. Because it’s by far the best known testing tool, I think that tends to limit the use of unit testing, period, in PHP.

He goes on to state how other languages have unit testing support that are far easier to use. Java and Python for example have extremely easy to use unit testing frameworks/built in features.

After a little while he continues to explain the reasons he believes PHPUnit is so intimidating:

Ed: I think boilerplate is part of the issue. I think that’s intimidating. Tools can mitigate that to some extent, but I don’t think it eliminates the problem entirely. I just don’t think writing a simple test should be anything more than a couple lines of code.

Previous to that quote the other host, Chris, gave a snippet of a simple unit test and it required 17 lines of code to simply write one assertion. That seems absurd!

At the end of the post Ed notes something that is very important and relates closely to TDD:

To write testable code, you really have to be thinking about testing when you write your code. It takes a bit of time to get used to that, but I think it’s very doable.

The number one reason that PHP developers have a tough time thinking in this manner is due to the fact that most of them are self taught. PHP has a really small learning curve which is great for people who want to get into web development, but in order for PHP unit testing to move forward and to better things, more developers have to get into the TDD mindset.

 

P.S. I find it amusing that in my WordPress (Mainly written in PHP) post editor, the acronym PHP isn’t included in the base dictionary.

From the blog CS@Worcester – Tyler Lundstrom by CS@Worcester – Tyler Lundstrom and used with permission of the author. All other rights reserved by the author.