Posts

Javascript Prototype Gets in the Way!

Image
I have been re-reading  eloquent javascript  because I am taking up a class this summer that greatly deals with javascript. This book really helped me a lot transitioning from programming solely in Java to understanding some of the practical details of using javascript. The Prototype One of the sections in the book that i found really helpful was the explanation of how prototypes work. Prototype Interference in this section of the book ( Secret life of Objects ). If you are beginning javascript, how the prototype works in javascript is one of the fundamental concepts that you must grasp. There are probably several prototypes in javascript but the three prototypes that you might want to know about are Object.prototype Array.prototype Function.prototype There are a lot of things in each prototype above and I will not discuss each in detail. Ultimately, prototypes are the object that is used as a fallback if the property or method is not on the current object you are refe

Private final - some things you can't change!

Image
Access ! Access ! For as long as I can remember writing programs in Java. I have used the access modifiers to control access to members of my classes. It is one of the topics in the Certification test in java (SCJP, OCJP). The table below taken from the Oracle Java Tutorials summarizes how each access modifier can restrict or expose a member of your class. Java Access Control Access Levels Modifier Class Package Subclass World public Y Y Y Y protected Y Y Y N no modifier Y Y N N private Y N N N Don't worry it is a private final variable! I can't change its value because it is private final member of the class. Well that is not really true. There is an API for that  Java Reflection . The Java Reflection API will allow you to examine and modify runtime behavior of applications in the JVM. "Reflection is powerful, but should not be used indiscriminately". In relation to the access modifiers mentioned above you can disregard it all and do as you please.

Big Ball of Mud - Revisited!

Big Ball of Mud (more likely Great Balls of Fire that will burn you down!) I am being mentored by Arun Batchu  this semester looking into the exciting world of software architecture and as a self study we should look into this  Big ball of Mud . I have read the page before and was also mentioned to me recently by my peer as we were discussing software architecture, Conway's Law , microservices architecture . The Big ball of mud page (1999) existed before the Agile Manifesto (2001) was conceived. This means that the observation that the authors wrote were noted before most of the agile processes ever existed but I somehow still observe the same kind of things (now more prevalent) in an agile world. Well I guess the forces that they have observed still applies to the software projects of the agile world. How would we consciously prevent ourselves from creating Big balls of mud ? I think that there is no clear answer to that because any software project will be constrained by

Agile Software Development - The Wonder (Teen) years!

What stage is Agile Process of Software Development in its life?  The Agile Manifesto was created around 2001, so Agile development processes is now entering its teen years. During this year there is probably a lot of dilemma that software developers encounter with this method of software development. Like a teenager that succumb to peer pressure, Agile software methodologies becomes popular based on the most influential advocates of that process. But by now most software developers ,who tried most of the agile software methodologies, already know what works based on the successes it brought to our practice. Knowing what works means that we also know what doesn't work. Here is the dilemma, there is no one size fits all solution for agility because that is the whole point of agility. You need to react to factors of the current situation to best decide what is going to work.  If I understand Agile development, we start building before the outcome is fully understood. Adjust o

Magic Number and the file system mystery - Who is the original CAFEBABE ?

Image
File Types and Magic Numbers Most operating systems has a way of recognizing file types. An operating system needs to recognize a file type so that it will know what to do with it. Since all files are just bits and bytes in the disk it will need to know how to interpret does bits and bytes in a manner consistent to what type of file it is. One of the most common ways to designate a type to a file is through using file extensions. The part of the file name after the dot (.) . Like .exe, .doc, .java, .jpg An operating system will be able to recognize a file using this extension. This is most commonly used in Windows. In Unix it is a little bit more flexible. Unix defers how an application can recognize files it can act on. One method is using Magic Numbers ( What are magic Numbers ? ). But not all files have magic numbers. Unix also allows file extensions - but this is not enforced or dictated by Unix (not like windows) like .sh .c .gcc .o [1]  So, Now what is CAFEBABE

Single Thread Mystery - Node

Image
A Single Thread that handles multiple request ? I have been reading about threads and all the performance gain that you will have if you use multiple threads but there is Node which runs on a single thread. So i tried to investigate how node handles multiple request using a single thread. Event loop Architecture Node uses an event loop architecture. It specifically uses a non-blocking I/O event model. This means the thread of execution will not block if it is an I/O event. But what is an I/O event for Node ? Well all http requests, database queries, file manipulation [ 1 ] In my mind i picture node like these (The diagram is based on a typical process structure)  Code - program code Data - variables of the program Files - file pointers (I am not sure about if node keeps file pointers at the process level) After trying to picture this out, several questions pop in to my mind.  How will node be able to utilize a multiprocessor hardware ? Node has &qu

Threads - start using it!

Why should you use a lot of threads ? Threads can help you take advantage of multi core CPU systems. It enables your application to run parallel and concurrent tasks. It will help your application be responsive, your application processes can share hardware resources, it will be less costly ( in terms of hardware resources) than starting a new process.[1] BUT using threads brings up new programming challenges. An application is harder to test and debug when it is multi threaded. Even if applications are harder to test, we should embrace it because those core are going to multiply really fast and applications should take advantage of it. If you are a programmer you should really learn and teach yourself how to write applications using multiple threads because it is going to be required sooner or later. So what do you need to know about Threads ? In order to effectively use the underlying hardware (processor), a developer should know the underlying threading model where yo