Blog 9: Decorator Design Pattern Response

In today’s blog I’m going to talk about a blog that was written by Brian Ambielli who is a Senior Software Engineer and he wrote a blog talking about a topic that I have to do a project for called the Decorator Design Pattern. There are many design patterns for programmers, some that I learned this year were strategy, singleton and factory patterns which we used for our first two projects in the class. Anyways, Brian goes in depth about what the Decorator pattern is about and how it is used.

The Decorator Pattern allows you to give your objects new responsibilities at run time without making any code changes to their underlying classes. This pattern allows the user to extend objects with added functionality at run time and also gives the developers the power to compose objects that are purpose driven for current demands of their users. Brian says that Decorators can be thought of as wrappers around the object they are decorating, the object being decorated in these cases is the SuperType, then the decorated object can be passed and used in a program in place of the original wrapped object. Then he shows a diagram exampling what the Decorator pattern looks like and after explains what each of the parts of the diagram do to make it a Decorator Pattern which is really nice if you don’t understand it by looking at it. Then Brian provides a example with a Pizza shop talking about its toppings and different crusts and all the variables that are considered with a pizza, he then puts another diagram up showing how the decorator pattern would look with this example. Lastly, Brian provides some negatives of the Decorator Pattern and why it can be a pain to use sometimes.

This blog by Brian was very helpful, not only helpful because I didn’t know what the Decorator class was before this blog but that it is also the same topic I’m doing my project on for my college class, so now I have something to look at and use for my tutorial that I have to write for this class. Brian providing examples will also help me with this project as it helps me understand it better and makes it easier for me to make my own so I can get a good grade on the project. Besides this being helpful for my school work, Brian provided a lot of detail in his blog that could be helpful to anyone trying to learn about the Decorator patterns, him providing examples and telling people how the Decorator class exactly works and may help people decide to use this for their programs in the future. Brian didn’t just do the decorator patterns, Brian has blogs on all different types of patterns. The blog also providing what the negatives of this patterns are helpful for people like me who want to see what could go wrong with using this design pattern in future cases. Thank you for reading my blog post on the blog by Brian for the Decorator pattern, if you want to check out any of Brian’s blogs on any other patterns, I’ll leave a link at the bottom.

Source: http://www.bambielli.com/posts/2017-04-02-decorator/

Advertisements

Blog 8: Angular 2 Response

Hello readers, today I’m doing my response blog on a post from AshuTomar who wrote a very nice blog related to computer science and something that is actually being talked about in my computer science class right now.

The blog starts by talking about typescript, the writer says it is type safe which means it can generate errors at compile time only. It is also purely object oriented an extends object oriented javascript. Typescript also allows to write class, interface and module-statements just like in Java and lastly typescript can transpile to any version of javascript code.

Next the writer talks about the speed and performance of Angular 2 and that it supports lazy loading which means you don’t need to load the complete app at once but modules can be loaded dynamically whenever there is a requirement. Angular 2 also supports AOT compilation which allows you to compile your code ahead of time.

Skipping the uses of the valid HTML, DOM section, the writer talks about the modular design of Angular 2 and how it is easier for Java based programmers to learn a new Javascript framework. Lastly though in the blog the writer shows code how to use the bootstrapping application and talks about and shows dependency injection enhanced.

The reason I chose this blog was because it is very familiar to what we are talking about in my software class in college right now. We are trying to do typescript in webstorm for our duck simulator program that we had to write in different strategy patterns. Getting back to Angular 2 and typescript, this blog explained a little about typescript and what the writer learned from Angular 2 and how it works and what it can do. I’m not an expert on Angular yet, just learned it was a thing so getting any information from anywhere right now is always good to improve my skills. The writer says Angular 2 allows people the ability to make a single page application in a perfect viable way. Reading that makes me really want to get into Angular and learn it because going to a work place and applying to a job, if you can make them a webpage or do any computer science things that involve creating applications, it makes you more wanted than if you didn’t. That is given that if you have more impressive details on your application then you will be more wanted by a job, well with this skill in angular you could also do some freelance work, make webpages or applications for different companies for a side job, a lot of people could make a lot of money just by doing that, so I’m not shying away from learning angular and type script. In conclusion, Angular and typescript are very important for a computer scientist future, also this blog is a good read, gives some details about angular 2 and how it works. Thank you for reading my blog this week, come back next week for some more programming talk with me.

Source: https://blog.knoldus.com/2017/06/14/when-i-took-angular-2-to-build-my-application/

Blog 7: Error reserving enough space for object heap in Java response

In today’s blog, I read the blog by Java2Blog which is a blog about java problems and other java frameworks and techniques. This post by them talks about how you could get an error for not reserving enough space for an object heap in Java.

First they go over a cause of this error, obviously though the first cause is that you ran your Java program without specifying a heap size which will cause you to get an error. The error would say something along the lines of “Could not reserve enough space for object heap”. The blog also tells you that you will encounter this error more in 32 bit JVM (meaning Java Virtual Machine) than in 64 bit JVM. The blog goes over the reason of this error which is 32-bit Java needs contiguous free space in memory to run the program. Then the fix for this problem is by running Java with a lower heap size and then it gives you a line of code you could use.

The next cause of error is specifying too large memory with -Xmx option on 32-bit VM. The fix for this issue is just lowering the heap size with a single line of code said in the blog. Lastly, the last cause of this error is if you specify a large heap size more than physical memory available on either 64-bit or 32-bit. The way you fix this problem is by again running a single line of code provided in the blog post which I will leave a link to at the bottom for you to check out. The last part of the blog covers certain fixes for Linux and Windows and just a conclusion of the whole thing.

The reason I choose this blog is not only because it relates to Java programming but that it also may come up in my future while I’m working in computer science, who knows that if I’m in IT somewhere in the future or some other computer job that has this problem and I’m one of the only people to know how to fix it. That would probably get me a lot of brownie points at my job which is really nice. Also this blog was well written and straight to its point. Gives you three causes for a problem and gives you the solution to each of them which is really helpful to understand. Java is a very vast programming language and remembering everything about it is hard so getting little reminders of how everything works is always nice. They aren’t joking when they say “Java programming language” because it really is like a whole other language and so is the other programming languages, you got to know every little thing about them or you screw up and everything is wrong. That is my little sidetrack on programming languages but back to the blog, I remember hearing about heaps in my intro. to programming class freshman year and I think we did a little thing with them but not much but hey, the more you know can’t hurt when it comes to programming. Thank you for reading this weeks programming talk with me, come back next week for more.

Source: https://www.java2blog.com/could-not-reserve-enough-space-for-object-heap/

Blog 6: OOPs concept forms response

Today I read a blog by infocampuspvt which is blog site that has people post about what they want anonymously. Anyways, today the blog I read was about OOPs (Object Oriented Programming) concept forms in Java.

OOPs, or object oriented programming, has mainly six concepts being: object, class, inheritance, polymorphism, abstration and encapsulation. First with the object, the blog gives a scenario and describes objects that way which was a nice way of bringing real life objects for describing a part of programming. The blog ended objects by saying always remember that they consist of state and behavior. Next was class which the blog said was a logical collection of the objects and went on with the example the person created in the object paragraph. Next was inheritance where it states that it is a special type of relationship where a class acquires the inherent properties of its parent class and it contains its own exclusive properties. After inheritance, it was polymorphism which is having multiple forms and goes on to talk about a whole other scenario with a cricket. Polymorphism is implemented in two ways which is method overriding and method overloading. Abstraction is hiding the complexity and showing the easier form of the system. After a whole other real world example, the person says there are also two ways to implement abstraction being using interfaces and an abstract class. Last but not least is encapsulation which is data-hiding in order to make it safe for any modification and the example the person uses is a pill capsule.

I honestly think this is the best blog that I have chosen yet for these blog entries and I’ll tell you why. One, the person who wrote this blog entry gives you a clear and concise definition of each of the six OOPs helping a person who barely knows anything in computer science understand what is actually going on when these things occur in a program. Second and actually most importantly, the examples were really good, when I was learning these concepts in my first years of programming, I wish someone explain it to me like the person did in this blog as it was extremely helpful to understand what is going on using real life objects that people use in their daily lives to describe the events. With polymorphism, when I first learned that, I really had no clue what I was supposed to be doing or what these overrides/overloading did with my program, after reading the paragraph on polymorphism and the example the person provided with the cricket and the fast blowers, and such, I understand it way better. Lastly what made the blog really good, was that it was short and straight to the point. The blog didn’t create very long descriptions that would make the reader bored after reading the first two paragraphs, the writer made them concise and easy to read and understand. This blog will help me write future programs definitely, I know my teachers and future employers are going to ask me to do certain OOPs like polymorphism or abstraction and before maybe I wouldn’t have been that confident but after reading the blog, I’m a little more confident in my ability to do it. Thank you for reading my blog today, come back next week for some more programming talk.

Source: https://infocamblog.wordpress.com/2017/10/13/oops-concept-forms-the-basis-of-java-programming-language/

Blog 5: Control Statements Response

Hello fellow readers, today I read a blog post by the infocampusblog which is a software training institute. This blog focuses on control statements in Java and how they work in some cases.

The blog first touches on if statements and where you can go from there, mostly things that I learned in my CS-140 class but it was good to brush up on them again. Further into the blog, the writer touches upon For loops and how they are utilized in Java. Now For loops were another concept that I touched on in CS-140 but he goes in a little more depth explaining them than I remember learning back in the day. Then he talks about other loops like the do-while loop which is a very helpful one to use in Java to have your code continuously looped. Lastly the article touches upon remarks in Java such as Single Line comments, Multi Line comments and Documentation comments. I’ve done Single and Multi comments but I don’t think I have ever done Documentation comments.

The reason I choose this blog is because it is always nice to refresh your Java skills. I know I should always be coding even through the Summer just so I don’t forget certain coding techniques but I’m pretty lazy over the summer and sometimes over the school year I just come back to coding and I remember the concept but I don’t remember exactly how to do it. This blog post was great for that exact problem, I got to refresh myself on three different types of code. Now if-else statements and such, I remember those very well, those statements were stapled into my brain Freshman year in my CS-140 class and how they work. For loops, do-while loops and while loops are concepts like I was talking about where I remember them and kind of how to set them up but I need a little refresher to actually get it down and right so my code is the best it can be. Going to documentation, in my two years of coding, I don’t really use comments/remarks, I know I should because they help you not get lost in your code but I’m just lazy sometimes and don’t want to do it as it does take time. I will try to utilize all these methods in later Java programs as they are very helpful and can make my code better and regarding comments it can make my code easier to follow for people trying to read it and understand it. Thank you for reading my blog today, come back next week for some mode programming talk.

Source: https://infocamblog.wordpress.com/2017/10/10/java-programming-control-statements/

 

Blog 4: Final, Finally and Finalize Response

Hello readers, today I read a short blog about the terms in Java known as final, finally and finalize and how they are all different. It is written by guldencirakblog who wrote for the blog known as the java diary.

The first word he talks about out of the three is Finalize. He talks about how finalize is a method shown as Finalize(), and the method is found in the java.lang.Object and it works as a Garbage Collector system only when an object or variable is still not being used anymore. The method with finalize is protected as well but can also be overwritten when you want to dispose a resource in a program.

The second word he talks about is Finally which is a block that is used with try/catch blocks. Finally is usually found at the end of these blocks because it is the final condition for the try/catch block so it passes the test. Finally is very important for exceptions and is key for Java.

The final word(ha see what I did there) is final. Final is used so things such as variables, methods and classes are not changeable. For example, if a variable is like Final String next, then that string cannot be changed after it is declared. For a class if it has Final before it, it doesn’t allow it to be derived.

Now to the reason I choose this blog entry, not only does it apply to Java but it is concepts that my class are familiar with but I don’t know if everyone fully grasps what each one of them does besides maybe final. This blog has helped me understand each of these terms better and may help me apply them later in future programs. The one I was not very familiar with was finalize, I don’t remember if I have ever used it in a program before but it doesn’t seem like the most difficult method to put into a program. Could be helpful to have just to put certain parts of my programs in there. Finally and Final were terms that I definitely remember using before and I definitely can use again after reading this blog and understanding them more. In our classes though, we don’t really ever use final since it really isn’t never needed in our programs and honestly, I haven’t had that much practice with finally but I remember how to use it. I know some of my friends in my class that may benefit from a little refresher with this blog post. Hopefully, sometime this semester I come across a time where knowing these concepts could be very helpful and I would have to thank this blog post for refreshing my memory. Thank you for reading my blog post, tune in next week for another entry.

Source: https://javadiaryalt.wordpress.com/2017/09/25/final-finally-and-finalize-keywords-in-java/

Blog 3: Tabs vs. Spaces Response

The blog that I’m going to be talking about today is Tabs vs. Spaces by Scott Hanselman’s blog. Tabs vs. Spaces is basically decided on by someone’s preference over the other, in a TV show I watch called Silicon Valley, a coder is so picky that he dumps is girlfriend who programs and uses Tabs because he thinks Spaces are more accurate and the way to go. I hear people sometimes in my classes casually talk about it, my personal opinion is that tabs are the way to go but I was surprised to hear how many people thought spaces were better.

Anyways I read a blog post and this guy talked about this thing called EditorConfig. What you got to do is make a new .editorconfig file and some code in it that he has in a picture so if you’re curious I will link it. What this code does is it visualizes the tabs or spaces and makes it easier and more clean for your code. He then goes on to talk about “EditorConfig Extensions” but all in all he talks about different systems and ways of making your tabs vs spaces controversy less of an issue when working in groups of people that differences on the subject. This relates to our class besides programming is that formatting is kind of key in this class and it will be nice for people to know their options.

I learned that there is many different ways to format your code with different sub-programs such as EditorConfig. It actually makes your code look a lot cleaner and will help professors, group members or anyone that is trying to read your code understand what is going on because it is consistently formatted. This has affected me because I actually vary on the subject of Tabs vs Spaces, like sometimes I use both in the same program but I realize now that is probably a bad idea and that I shouldn’t do that in the future since it will be confusing at times for a reader of my code. I may even share EditorConfig with some of my classmates knowing that some of them try really hard to keep their code as clean as possible and also not vary with spaces or tabs throughout a program. It is always interesting to find new ways to help you, making coding easier to do, trust me when I found out Eclipse created the getters and setters for you, I was thrilled. Lastly, I will try to apply this in future practices by maybe even using EditorConfig to help me stay consistent throughout my code but I’ll definitely try to not use both spaces and tabs in one program not to just help me but anyone trying to read it. Thank you for reading my blog post, reflecting on Tabs vs Spaces by Scott Hanselman’s blog.

Source: https://www.hanselman.com/blog/TabsVsSpacesAPeacefulResolutionWithEditorConfigInVisualStudioPlusNETExtensions.aspx