Translate To Preferred Language

Search Obioku's Thoughts

Please Read Today's Featured Post

Things I Would Like To Happen Soon

For all those who believe in speaking ideas into existence and prayer in the universe will return to a person.  I simply want to write a lis...

Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Wednesday, December 21, 2016

Report on Scala

                Scala is a program language created by Mr. Martin Odersky and others.  It is intended to be an elegant blend between object-oriented design and functional programming.  There is a belief within its ranks that every function is a value and every value is an object.  Development began on the language in 2001 followed by the initial release in 2003.  After an attempt to improve Java, the project spun off into its own formulated specifically for component style software engineering.  The data types of the language are common.  Numbers can be in the form of doubles, floats, longs, ints, shorts and bytes.  Strings, long form sequence of alphanumeric or Unicode characters, are from the Java library.  There are also individual characters as chars and true/false values as Booleans.  There is some uniqueness as units, iterables, maps, options, sets and lists are added to the mix of instantiable data types.  Even “empty” sets are possible with nothing and null objects.  Scala has five primary keywords for creation as class, object, def, val and var are needed to identify user definitions.  Classes are the design for what an object can be while objects are just a single instance.  Another keyword new is used to convert the class to a created object.  The main method to run an application is customarily contained in a user defined object.  The def keyword is used to create functions.  The keyword is followed by the name, the parameters in parentheses, a colon, the return type, an assignment operator and the set of instructions contained in brackets.  Val signifies a place holder where the assigned value will not be changed while var can be modified later in usage.  The syntax calls for either the val or var keyword followed by the name then colon, datatype and finally with what is being assigned to it.  Scala also has user defined types.  The keyword type is placed before the name and then you assign a predefined type with the assignment operator.  As file organization goes, Scala is very similar to Java in the matter of naming convention.  Also like Java, Scala uses the keywords package and import to define project scope and add external files respectively.  Scala features two forms of generics.  One is the traditional abstract class where you provide a simple framework to be used later.  Very analogous to abstract classes is the concept of traits.  Traits also allow variables and methods that are inheritable to another class.  The inheritance occurs with the keyword extends.  The capability of concurrent processing is very heavily associated with the ‘java.util.concurrent’ package.  There are two points to this topic.  The first is having two library methods of callable which returns a value and runnable that does not.  Then you will have to look at various of threading possible with synchronous and asynchronous tasks.  Where Scala shows promise is in how vast and dynamic it can be.  The possibility to implement nested functions is another positive addition.  For me, a drawback is how closely relatable it is to Java and running on a Java virtual machine. 
                The difference between Scala and C would be akin to comparing Java and C.  Start with the time period to get a better understanding.  C was created in 1972 and Scala in 2001.  C is the basis for many programming language concepts since its inception.  Scala is a fairly newer language and is heavily dependent on Java.  Much of the grunt work that developer had to do in C has been made much easier within built-in libraries for Scala.  The major difference you could point to would be the same in comparing other languages.  All languages will have a particular syntax for committing common tasks.   The level of complexity is dependent upon the features included into the language but again they maybe more time dependent as concepts were created by pioneers and deciphered to be made simpler for users to come later down the line.  To complete project one in Scala would be helped by the automatic sorting array feature but much of the rest would be similar.
References
[1] http://www.scala-lang.org/index.html
[2] Odersky, M. et al. An Overview of the Scala Programming Language.  EPFL Technical Report. 2nd Edition. 2004.
[3] Odersky, M. Scala By Example. 2014.
[4] Odersky, M. A Brief History of Scala. http://www.artima.com/weblogs/viewpost.jsp?thread=163733. 2006.
[5] Venners, B. and Sommers, F.  The Origins of Scala. http://www.artima.com/scalazine/articles/origins_of_scala.html. 2009.
[6] https://www.tutorialspoint.com/scala/index.htm
[7] Concurrency in Scala. https://twitter.github.io/scala_school/concurrency.html

Friday, May 20, 2016

Object-Oriented Programming and Design


Abstract
Object-oriented programming was created with coders and designers in mind.  It has expanded to many different languages as it has proven to be efficient and sustainable among the options that are available today.  The main concepts of encapsulation, abstraction, inheritance and polymorphism are the core principles this idea.  Building large structures into small manageable objects with multiple capabilities is the valued philosophy of object-oriented programming.  Since its early days at the Massachusetts Institute of Technology, it has become an industry standard and will remain relevant for years to come [1].
Introduction
Object-oriented programming and design is a topic that covers many of the modern languages we use today.  The focus of object-oriented design, in my opinion, is to create forms of data to be reused.  Java has the slogan “write once, run anywhere” which helps my definition.  Java is a class-based language, introduced in 1995, that is one of the better examples of being able to perform all the ideas of object oriented programming [1].  To define a class with variables and methods means you can then create an object of that class to use in your programming.  It can be used in the current program and if you need to reuse the concept, it can be reincorporated into another program without having to be rewritten.  That is the beauty of object-objected programming and design.  It places emphasis on the coder to feature the abilities of encapsulation, abstraction, inheritance and polymorphism for optimization of the language [2].  These are coding principles specifically for this type of programming that I will discuss more later on in detail.  The term object-oriented began in the early 1960’s in MIT with the development of the LISP language.  I would prefer the languages of COBOL, Visual Basic and Java as examples of implementation since I have more experience with them personally.  I had a course devoted to each while enrolled at Frostburg State University as an undergraduate student.  COBOL stands for common business oriented language actually.  After appearing in 1959 after being generated with government assistance, COBOL is thought of as a procedural language by many [3].  It can be used to generate forms and report on data related to business interactions.  However with the ability to create variables and invoke classes, I will use it as an early example of an object-oriented one.  Visual Basic is considered an event-driven language.  Primarily user create a graphical user interface and then decides what can happen once certain events are triggered.  Events can be defined as the user interaction with the form such as once the mouse is clicked or a button is selected.  Whenever something happens the application should have a response.  Again, I will use it to show some of the OO capabilities that can be found in that as well.  Also let me introduce some terms that I will use throughout my writing.  Variables are individual allocations of memory of a certain data type which can have value assign to them.  Data type are the form of the information.  Some of the common examples are integers for numbers, chars for individual alphanumeric characters, string for multiple alphanumeric characters and Boolean for true or false value also known as either the one or zero bit.  Methods or procedures are a series of commands or instructions that will take place once it is called or activated.  Classes are container elements of some combination of the previous two programming concepts that can then be treated as an object.  It is important to know these definitions before we go much further on the nature of this topic.  From an expert’s point of view this may be fundamental but I will try to write from the perspective of a novice so it may be appreciated by a wider audience.
Encapsulation
One of the first components I will discuss is encapsulation.  Some may call encapsulation the process of concealing parts of your program.  I prefer the slightly lighter view of building capabilities into your objects.  It can be as simple as assigning a value to a variable.  Instead of consistently working with a constant value, you can define a place holder to use throughout your program.  As I said, that is the simpler view that can be performed in COBOL, Visual Basic and Java but each does it in a different way.  COBOL uses the pic keyword to assign value to variables in its data division [4].  In visual basic coders use the dim keyword to name the variable and then what type it is.  Java you have to give the type then its name.  For VB and java you can use the ‘=’ operator to place a value upon it.  The more complex side is to create class with its own methods to use.  In java it is common to use encapsulation.  Using class objects to perform specific tasks is a major component to the language.  Creating the objects of your own volition is the more hands on approach.  Within the class you can identify variables and methods which it will use.  There is another aspect of the constructor to deal with as well.  A constructor is called when the object is first instantiated using the new keyword.  Constructors can accept a value or not but what happens in either instance will have to be defined by the coder.  Once the object of the class is usable, you can then interact with its variables and methods as you wish.   Therefore is the main coding section, you can use the object and refer to its contents instead of add that section of code to the main portion.  Depending on the object this can be easier for you and would be the same without encapsulation.  For instance, you can code a method to perform a loop.  This loop could have been created in the main source code.  However, if you were to call it multiple times, it would be relatively simpler by calling the method several times and writing the steps and iterations of the loop once. 
Abstraction
Abstraction, in my opinion, is the middle step between encapsulation and inheritance.  Not the middle in terms of the creation process but it can use encapsulation to lead to inheritance though it is its own concept.  The word abstraction is the quality of dealing with ideas rather than events.   The translation is near perfect because for programmers it is creating the skeleton of a class.  The initial abstract object only incorporates the fundamental framework of what will be used.  Reduce the object to the bare minimum that is required for it to exist.  The class can be absorbed by another class that can then define what its variable contents would mean and its procedures would do.  You can create the class by telling what the types of variables are and the names of the methods only.  Just the frame work is necessary for initial processing which makes abstraction unique.  The ‘hello world’ example is shapes.  You can model an abstract class or interface of shape with variables for height and length and then methods of draw, perimeter and area.  The idea is that all shapes have these properties but they will be defined differently.  The coder can design classes like circle, square, rectangle and triangle that share these same attributes though they are not handled identically.  Each can assign height and length but how they are formed using draw and how the area of the shape is calculated will have to be defined in each class while they use the same name or ‘area’.  Area for circle is half length multiplied by pi, square can be length to the power of two, rectangle can be length multiplied by height and triangle can be half the length multiplied by height.  This is an example of abstraction only because the theoretical parent class has nothing defined in it.  If we were to define any of the parameters in the parent class, it would have to be redefined by the child class which is not optimal to the concept.  For shape there are no universal properties accept the names of its contents not the values. 
Inheritance
Abstraction leads to the topic of inheritance.  Inheritance has parent and child classes.  The parent class will be defined and then the child can inherit those capabilities and add to them if it needs to.  Inheritance lends itself more to the idea of a hierarchal structure than that of abstraction.  Though the two are very similar, the idea behind inheritance is opening the door to use some of the predefined attributes of the parent class.  Usually in inheritance that entire object will not have to be redefine.  Users can do this in two ways.  One is to inherit the parent class and not redefine a specific detail.  This would confirm that you wanted to use the parent definition for the child because some of its traits can be carried over.  Another in java is to call the parent in the child using the super constructor option.  In contrast to the shape example, I will try to discuss vehicle.  Now vehicle in these terms will refer to an automobile.  The vehicle will have four wheels, take gas, have glass windows and require one driver.  Those traits can all be passed to children coded as sedan, truck, van and sports car.  Within the children will holds information like top speed, number of passengers, number of doors and off-road capability to name just a few attributes.  Now those can be variables of the parent that are not defined or only belong to each child.  That would be the choice of the coder.  Either will suffice.  Those are examples of variables.  Some methods would be to drive forward, reverse, turn and park.  If the designer wanted to be specific I supposed the size of the vehicle could be incorporated into park so each child would define it by the type of car it is.  Moving the vehicle can be defined in the parent and still called by the child. 
Polymorphism
Sharing certain properties transitions to the subject of polymorphism.  Polymorphism describes similar things existing at the same time.  That can mean variables, methods or even class objects.  Variable and methods can be determined by scope.  Scope entails range in a program where something can be used and is identifiable.  For a variable to be out of range says that it is no longer in the range of which it was instantiated.  You can either recreate the variable for the current context or see if there was another error in the coding.  An example of this is to create a variable to use within a looping algorithm.  If a variable is created in the loop itself, it can be used in the loop.  Once the loop ends, the value that the variable held will no longer be in memory.  Then the variable can be recreated with the same name and used with a different value.  Methods can show polymorphism using the abstraction example.  Calling the draw method for each shape a similar concept.  You can theoretically line up each shape using the draw method in succession.  Rectangle draw, circle draw, triangle draw and square draw will each respond with what it is designed to do.  Though they have the same name and can be contained in the shape class, each shape’s draw will only respond to the class that requested it.  This can be confusing but if the class object is used to identify the method then it makes it easier.  Classes can have more than one object as well.  Using the inheritance example, if I wanted to name vehicle as specific makes or models that can be done using the same class.  Instead of naming my sedans one and two, I could name them honda_accord and toyota_corolla.  In most programming languages the underscore will have to be used connecting the two words to avoid errors.  Both can be sedan and both can have some differentiation used when assigning some values to the variables. 
Conclusion
Object oriented programming has really assisted designers advance coding with its definitive properties.  How encapsulation, abstraction, inheritance and polymorphism are used brings a new significance to programming.  Building new objects with classes that can be defined and processed as data types is remarkable.  It can provide a first-hand level of control with incomprehensible depth of the ability to create whatever you feel possible in your imagination.  Speaking as of today, it may not be the revolutionary concept it was when it was first introduced.  The concept of its intention has remained at the forefront of how programming is performed by professionals and taught by professors.  Since I am not as advanced as others of this genre, I cannot expound on areas of weakness or where improvements can be implemented.  Learning about these forms of subjects can allow the ability to compile all the informational resources within your own comprehension but execution requires a different level of mastery to be fully functional and operational.  
References
[1] https://en.wikipedia.org/wiki/Java_(programming_language)
[2] https://en.wikipedia.org/wiki/Object-oriented_programming
[3] https://en.wikipedia.org/wiki/COBOL
[4] http://cobol.404i.com/content/defining-data
[5] https://en.wikipedia.org/wiki/Visual_Basic

Sunday, December 20, 2015

Why Computer Science


When I was first deciding to attend college I was not certain my major would be computer science.  During a meeting with my guidance counselor, we spoke about my grades, interests and which schools I favored.  I had fairly good grades in math and science courses at that time so she felt that should be my focus as I went forward.  Then I went home to start researching careers and what I thought I would like to be doing years in the future from that point.  Though I had grades in those courses, computer science and programming were completely new concepts to me.  Having that fresh, creative and innovative aspect to it really made me feel positive about college and being a full-time student for another four years.  It eventually took me much longer than that to get my first degree but I can tell parts of that story another time.  Honestly I just seen it as a really intriguing challenge to go to college for something I did not have any prior experience with.  Though I was up to the highest level of math courses available to us as calculus and took nearly every entry level version of science offered to me, I was not sure I wanted to make a commitment wholeheartedly to that path moving forward.  And I hope I am not offending everyone reading this with that last statement.  Computer science and programming was seen as college to me because I did not try it at any other point.  I was happy with computer science and still find it fun to some degree today.

              One of the main obstacles I had to overcome was the learning curve.  I have been taught C, C++, Java, HTML, PHP, XML, SQL, MASM, Visual Basic and COBOL as coding languages.  There was also the concepts of numbering systems, digital logic, pseudo coding, search and sort algorithms, network architectures, operating systems, multimedia applications and internet suites.  All of that was during the pursuit of my Bachelor’s degree and there may be some things I forgot to include.  Each course was different and presented a new form of coding to learn.  I leaned on sites like w3schools.com for tutoring away from the classroom.  The speed of the courses was my main obstacle in addition to the balancing of all my credits each semester was another core issue overall.  It is quite difficult to explain but I knew what I was attempting to do however the completion and execution remained problematic.  The theories were in my mind but convincing the computer did not always go so well.  Programming took the bulk of my time for adjusting to the major and it negatively affected other assignments like tests.  Being a graduate student now, I look back on those times with wisdom about what it took to get to this point.  To gain a Master’s degree would simply mean I was better than I thought I was as a student.  It would always confirm that this discipline is within the range of programs I am capable of.  

Friday, October 16, 2015

From Information Technology to the Boardroom

    When thinking of how I can apply what I have learned in my quest of an information technology degree to the business world, I would consider strategy, structure and efficiency the main concepts that would translate effectively.  Coming from a world of coding, planning and creation are fundamental to any assignment one is to work on.  My view of business is to provide a good or service for others to earn revenue while minimizing cost.  I am sure that it is somewhat more complicated than that but bear with me for a second.  We have already seen companies celebrated for providing products developed from technology becoming mammoth conglomerates and making their executives billionaires along the way.  We have also seen how these resources are introduced to the world and turn into staples in our culture for a lengthy period of time.  That success may be able to be duplicated using the aforementioned principles in my opinion.  Now let me try to expound on how they can be used to reach those outcomes.
    Designing the proper strategy is the key to any attempt at triumph in business.  In determining the correct course of action and approach, one must first analyze the situation and decide what the goal you are trying to achieve is.  Corporations define themselves with mission statements and illustrating the focus and direction of their integrated drive.  In programming we refer to this process as pseudo coding.  Before I begin to program, I may think about and write what I want to do in plain English.  Without worrying about the precision and syntax necessary, the motivation behind the effort is primarily predetermined.  So when we begin to work on other aspects of the business, we can refer to the foundation that was established since each step has been encoded.  One could then describe the product and how they want to present it to the people by way of marketing in accordance with previous planning.  Another example would be constructing a plan for pricing and expected rates of return from purchasing based on the cost of production.  Create a sequential pattern where one phase would always lead to the next making it easier to prepare for impending maneuvers.  
    Structure would be slightly different depending on the point of view.  This would help towards shaping the organization and how it would interact with outer bodies.  Negotiating how many people are needed for the winning tactics as labor payroll and the amount of inventory that can be produced and displayed for customers are additional aspects.  This would be derived from the creation of functions during coding.  One can write a segment of coding within the main body or simply make a call to it and define what that would mean at a later point.  To me, this is similar to assembling a variety of departments to do more than coexist but flourish simultaneously so that there is no distinguishable weak link in the chain.  The point would be to fashion an outfit that has the ability to grow at a pace that is contingent on the other parts.  All divisions of the business can shine as bright as possible and no luster is lost for one with the glory of another.  See when a section of code has an error the entire program may not run or at least part of it will not proceed as it was supposed to.  The programmer would have to acknowledge the mistake and make the modification for everything to run smoothly again.  The lesson taught is that if a weakness can be identified, it maybe the revealing juncture at which your empire starts to crumble.  Paying attention during the process and speedy rectification when something occurs are essential talents to possess.  
    Efficiency is the last component that I will include to optimize the transition from working with technology to sustaining a profitable business.  To be efficient in this circumstance would be to receive the full potential of your capabilities while reducing the stages traversed as much as possible.  When programming, there are many ways to do the same thing.  You can find this behavior in many arenas including business.  One must choose to operate using the best procedures for the desired conclusion.  You can have long drawn out processes but that may not be conducive to time constraints and quarterly revenue numbers.  To experience quick gains without cheapen the product or dissatisfying your consumers is a noteworthy accomplishment.  And this would not just concern the product and presentation.  Making your strategy and organization structure very efficient is a very strong indicator of effective leadership.  And a better sign that you are on the right path as a corporation.
    As we have seen, this has not been a difficult transition for everyone.  To make a positive impact, I feel one should be able to stay within themselves and be natural in any course of life.  There are things that are taught in information technology that can translate to business quite well.  Meeting deadlines, planning your design, creating your concepts and personalizing the program are all sophisticated and important qualities to being a good coder.  The best of us can decipher those ideas and transform them into business conquests like few have ever seen.  The rest of us can take the time to learn from and enjoy the rewards of those that cross the imagined line.  There is a place for some of technology’s brightest stars to earn recognition in the world of commerce.  And to accept that fact should not hurt one bit.