Author Archives: Pawel Stypulkowski

Project, part 2…

Project for my databases and software architecture has been going well so far. But lately my luck has run out. In my last post about this project I have outlined the steps me and my group member took to design our website as well as make sure the back end of it is working correctly. That part won’t be a problem anymore in my opinion. All that is left in the backend is to make some extra triggers in the database and confirm that all the information is being passed correctly. Like I said I do not foresee any problem with that part.

The fun part or the rabbit hole as I like to call it is now implementing correctly the front end. I have a lot of knowledge base available, but the problem comes in the fact that I want to make certain things work the way I want them to and that might not be how they actually work. To begin with I have started with reading the Angular tutorials (everything can be found here) and trying to figure out how to do some simple programs and designs. Me and my group partner have been working somewhat separately at this point because of our conflicting schedules but we have a working version that, if we run out of time, will use. For me the biggest problem at this point is to have the layout working correctly, all the functions and their behavior are not a problem, but to have the components line up where I need them to be causes me no small amount of headache.

While trying to make this project look nicer on my own, I have met with my partner at a café so we could finally work together and try to figure out some of the problems we were having. One such problem turns out to be a database trigger, we need at least one to have somewhat good database design. The trigger, when we finally learned how to create one, is a simple one that assigns 0 to a column value for a new row in a table. It is nothing spectacular or advanced, but it works and to be honest this is for an introduction database class so in my opinion we do not need anything fancy. (again here is a tutorial for triggers).

As the school year approaches rather fast, I will be spending most of my days on the near future either on this project or on studying for final exams. I cannot wait to be finally done with this semester, as much as I have had fun and learned a lot, I’m starting to suffer from senioritis and my motivation wanes.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Technical Review

The school semester is almost over and slowly everything is coming to a completion. This will be my last post for the Testing Class, Over the course of it I have learned quite a lot of valuable skills in the Computer Science field.

The last covered topic of the class was the Technical Review, maybe not as advanced as previous exercises this one let us practice probably one of the most important and widely used techniques, the Technical Review, or simply code review. Some info about that can be found here. This is a form of static white-box testing technique which is conducted to spot the defects early in the life cycle that cannot be detected by black box testing techniques. It should not be lead by a person who wrote the code, or at least one member of the review has to be a somebody not associated with the code.

This is a very good and very easy form of troubleshooting and detecting bugs early in the production, and it should be used as soon as possible after the implementation of the code .

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Projects, projects, projects…

Working on the Final Project for the Software Architecture class has been fun so far. During this initial week we had to figure out what are we going to do. I have paired with one of my classmates named Zac to work together. All we knew that the project was supposed to be done with the TypeScript and Angular framework. Well then what to do? We had no idea, at least at first, until we got the Databases class where again I have paired with Zac and we were supposed to do a project with databases and some SQL. That is where it hit us: “how about we combine both projects?”, what we meant is using Angular we can create a website that will connect and interact with a database through a REST API we learned about before. Genius I say, only problem was to figure out if that will be allowed, killing two birds with one stone, and guess what, it was ok.

So, with that in mind we went to work. First step was to figure
out what database do we want to use, since that will decide on what shape rest
of the project will take. That is where Zac came in, he is a very talented
musician and he quickly found a free database online that relates to music, it
had quite a few entries, but not too many so it will be fine working with it.

Great, a third the setup is done, step two create a
Wireframe and write a proposal for both classes. Huh, a what? Well apparently,
wireframe is a visual/conceptual design for a web app. Here is some
explanation. That helped us so we went to work. I tell you what trying to
design how a website will look is not that easy, me and Zac had to discuss few
things before we settled on something. Version one is not very impressive and
will most likely change but good enough for now. With it we had the conceptual
work done.

Now all that is left is to make it a reality. Well easier
said than done but that is why we are in school, to learn those kinds of things.
We have started with the basics; can we use Java to talk to a Database? Luckily
in that regard professor from Databases class helped. (here is the
article about it) Ok so we can talk, let’s see if me and my teammate can do
some simple queries with the REST API. YES, WE CAN! Ok we are in business. More
fun will come next, use what we receive from the database and make it work with
Angular, but I will talk about that later…….

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Testing with MOCKING

Having learned about mocking it was finally time to put it to test. We were given some code and exercises to work with and learn by practice, I love that by the way, POGIL is awesome. We were given a Mocking Framework called Mockito to use and it seems like it is a very useful tool for testing.
I am still a little bit confused about Mockito and its use (practical side) but that is fine, there is plenty of knowledge base right on their own website here. Yes their logo is a Mojito…. I have read few things and it helped me to better understand the framework, the website also has links to FAQ and blogs by the creators. I believe anybody will be able to work with Mockito after doing some reading and maybe some practice.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

First STUBS now others…

Last time I have learned abut Stubs in programming, this time I came to find out that there is more to it then I thought. For the Testing class we had to read this article by Martin Fowler and learn about apparently different kinds of Stubs, but Mocks are not Stubs…..

The article is a little bit lengthy but it is a good source of information if you want to, or have to learn more about testing, it also had a plenty of examples and explanations how the differences between stubs and mocks and dummies and fakes look like. When it comes down to it remembering these definitions from Fowler is the minimum of work:

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test.
  • Spies are stubs that also record some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
  • Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Stubs

When it comes to testing software I am definitely all for it but at the same time I am for it by doing it the “old school” way. Even at work this mentality stands, but recently the more I learn about testing the more I understand the need for it.

Having learned more about the subject of testing I feel like I can talk a little bit about it. Stubs is the part I been educated on recently and it is a bit confusing but that will probably go away with time and practice. Anyway Stubs. Those in programming are (according to Wikipedia): a piece of code used to stand in for some other programming functionality. A stub may be a temporary substitute for yet-to-be-developed code. I do know how to use those but until now I didn’t know what they are called and that is cool in its own way. Everybody knows how to use some fake code that is there just to run something for a time or to fool rest of the code into working. Now you know what to call it to. A STUB!!!

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Testing, Testing and some more Testing

In my Testing class we are constantly learning some new techniques and ways to test software, although there is some hands on testing on actual code a lot of it is more theoretical or to be more specific it is describing how we can test. It is all useful I know it but as a CS major I do want to write code if possible, less theory please, more practice. End of rant? Maybe for now.

This week was about Define-Use Testing. It is somewhat simple concept and I am glad that I can learn about it. It showed us some of the ways that today’s compilers work and make comparisons to display errors in the code. The whole concept of Define-Use testing is all about visual inspection and checking of the code. This will be some useful information for certain aspects of Computer Science field.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

TypeScript, a better version of JavaScript

TypeScript, is it really a better
version of JavaScript? If you are like me and you never used JavaScript before
and then were told that TypeScript is better you will probably have the same
reaction, “OK, so what?”. Well it turns out it is a very useful thing, it is a wrapped
version of JavaScript that will pay attention to the types of variables used
and so on, hence the name. In my search for some answers I have stumbled upon THIS blog by Valentino
Gagliardi named TypeScript Tutorial For Beginners: The Missing Guide (2019).
Like it says it is a whole tutorial, but it also explains in some simpler words
what TypeScript is and why it is useful with a lot of examples. I will go through
it and then look for some more. What helped me right away was Valentino’s explanation
of what is TypeScript: “The definition from the official website says: “a typed
superset of JavaScript” but it assumes you know what a “superset” is and what
“typed” means. Instead to keep things simple you can think of TypeScript as of
“a layer on top” of JavaScript.”

Most of the blog is what it is
supposed to be, a Tutorial, and in my opinion it does it in a very good way, he
starts in an easy way to show certain things, even when somethings is not right
away understandable Valentino comes back to it later and explains in more
detail, what is a plus for me as well is that he does in somewhat humorous way
and that makes the whole learning a more easy going process. Having those kinds
of Tutorials is very helpful for me because knowledge can be learned but what
needs to happen is also the understanding of when and where to apply said knowledge
and with this blog post I’m starting to understand that about TypeScript.

Learning in school about best tools to perform today’s jobs and being able to see it in action before I am thrown into the deep end is a huge plus for me and it should be for everybody else as well. I am always very grateful for the opportunities like this one. I have found out that the TypeScript is used at my work in other departments which tells me it is a good thing to learn and maybe use to further my career. I cannot wait to start writing some more advanced programs in this format, but everything needs to be done slowly, you must learn to walk before you can run and I do intend to be able to run eventually.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Singleton…

This week was all about design
patterns and ways to implement them. We have only just begun and to start with
we talked about Singleton. It is a design pattern that creates a single
instance of a class to be used from a well-known access point. I had some previous
interaction with this particular design pattern at my work, when we were using
the C++ language this was one of the ways we got around some of the problems we
had, since moving to C# it went away but still I knew about singleton before
this weeks class at school. I was a little bit curious and wanted to read about
it more, so I looked up blog post by Ted Neward called, surprise, surprise: “Singleton”.
Link to it is here.

                In this
blog Ted talks about it extensively in my opinion, from the context of it, the
problem that it solves and the consequences of the Singleton implementation. I definitely
like the information provided and it help me expand my knowledge of the design
pattern, which is a good extension on my current knowledge both from work and
school. One of the parts in the blog really helped me understand it better and
that is: “Reduced name space. “Singleton” is just “global” hiding behind
another name. One of the explicit goals (in 1995) was to be able to have the
necessary scope-wide state, but without accidentally clashing over names in
that global namespace. Languages which support explicit namespacing (Java, C#,
C++, Swift, yeah pretty much all of them) mean that we can have this benefit
even without doing anything more than moving the global variable into one of
those namespacing mechanisms.” This describes Singleton as global and I like
this description because it really drove home what Singleton is and how to use
it, I think….

                Overall,
I know I will be learning about many other design patterns and implementations
but for now having this is good enough, who knows maybe others will be a better
solution than Singleton, but I think it is the simplest one to learn. Neward
mention couple of time the debate of Singleton vs statics and that is something
interesting on its own. Something that I will research a little bit more when
time allows. Until then I remember one thing my boss said about singletons back
in the day: “Singletons were used everywhere, and somehow it worked, we didn’t
know why, but it did.”

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.

Digital Code apparently can smell.

How can code smell? This was my
question last class in my Software Architecture class, and I was surprised to
learn that it can. Not literally of course, but because code can be written in
a manner that somebody may say that there is something going bad in here, as
food would. According to Wikipedia
Code Smell is
: “any characteristic in the source code of a program that
possibly indicates a deeper problem” and “Code smells are usually not bugs;
they are not technically incorrect and do not prevent the program from
functioning. Instead, they indicate weaknesses in design that may slow down
development or increase the risk of bugs or failures in the future.” This is a
very interesting topic in my opinion because it can make me and other alike to
be a better coder and help us avoid common mistakes.

While searching for some more
information about the topic I have stumbled upon blog by Jeff Atwood that gives
and describes different kinds of smells that code can have. This directly related
to my class and helped me to specify different problems that can arise when I create
some software. In the class we have described smell in a little bit broader
scope then in the blog, which describes more detailed cases. For example,
Atwood gives us this: “Long Method – All other things being equal, a shorter
method is easier to read, easier to understand, and easier to troubleshoot.
Refactor long methods into smaller methods if you can.”, and in my opinion
anyone writing code nowadays can agree with that assessment. I know it can be
hard sometimes to write a short method because it would be more functional, and
that is a one of the subjects of one of my classes I took before about writing
clean code.

In my opinion this blog is a great reference
for everybody who wants to keep in mind problems that can arise, or to say avoid
you code from smelling a certain way. I know it will be helping me a lot both
in my school and professional life. Eventually anybody can learn this by heart
and know it  at the drop of a hat, but
for me until it will become almost a reflex I know I will be probably using
this post and other like it as a reference. Anybody who has plans to have a career
in a Computer Science field should learn this.

From the blog #CS@Worcester – Pawel’s CS Experience by Pawel Stypulkowski and used with permission of the author. All other rights reserved by the author.