Search This Blog

Friday, May 31, 2013

The Art in Programming (TAP)

Programming is an art, even though this discipline falls under sciences and in some places engineering there are many attributes of art that is needed in programming in order to be successful, and this are:

  1. Creativity 
  2. Imagination
  3. Design and,
  4. Expression
These are not all what it takes to be a programmer but part of a bigger list, some others are, critical thinking, problem solving, programming languages skills, analysis and algorithms.
      A lot coders when given a specification to write a software according to that specification, they directly jump into coding as if it is their personal projects, which still if it is its not an excuse.
The good practice of programming is to actually know what you want to achieve at the end of the project, then try to design or sketch your problem or specification in a structural manner, identifying each object or components functionality, its properties, behaviors and relationship with other components and also with its environment. Establishing this grounds will move you a step further to solving your problem and also whatever you do afterwards will not be blind coding. Now after establishing the structure next you need to start coding, but also you need to use a particular development model according to what you are planing to develop, this helps to make a standard which makes the probability of your project failing less.
During development process (Coding) it is important to take note of some very important features:

  • Commenting - This is a very big issue amongst developers, sometimes because of laziness but it is very important in times when you need help from someone in your development or after a long period you decide to go back to an old project i.e i have friends that after 6 months whatever code they have written becomes very difficult for them to read or modify.
  • Use of Patterns - A pattern is an idea that has been developed to help solve a particular reoccurring problems in programming, for instance if you have a collection and you by means want to manipulate its contents, instead of writing complicated and cumbersome for loops and going form index to index, you can instead use an Iterator pattern that makes it very easy and efficient to iterate through a collection.
  • Refactoring - A lot of developers write spagetti code, and unstructured some times making it impossible to know what method goes where, what variable belongs to what or the relationship between two components or objects. Refactoring is just a process of changing the internal structure of a code and still the code behaves the same way, if one makes a habit to refactoring, then you will find it very easy to modify, change, read, debug a particular segment or body of code. Indentation is another very useful aspect of refactoring because it makes your code readable.
  • Testing - this is a very important phenomenon that helps in developing less buggy codes or softwares. Testing should be done in units, components, and system at large and some times good to also invite people to test your work. Test-Driven development is a very efficient way of developing softwares, because at every stage completed you need to test and see if the code segment actually does what it suppose to, in this manner, we reduce the stress of complex debugging, and also develop the right product.
When one takes all this points together and makes it a habit, you will realize that you have become more effective, productive and also make maintenance an easy process.
     I myself have improved my coding skills over the years and have become a better programmer, i can feel it and i have also come to realize that programming its not about just writing a sleek of code that works, but also beautifying the code b well indentation, refactoring and commenting e.t.c

When you take all this into a consideration, you will share your experience with me.
Happy hacking and keep coding!        

Tuesday, April 2, 2013

Programming Language Selection

When you search for the best programming languages on Google you get approximately 81 million results, this is because every programmer want's the best tools to use, but the ironical part is that every tool is the best for a certain job.
There have been ratings a lot on the most used programming languages, even though there are variations from site to site; C, Java, C++, Objective C, C#, PHP, Python, Javascript, Ruby, Visual Basic are on top of the list. One might ask C/C++ have been around for decades and are regarded as old fashion programming languages, why are they still in use in this modern day technologies? This answer is simple but a bit long, all the modern day programming languages revolve around this languages, from the chart below you can see that Java is a derivative from C++ hence from C, Python is a derivative from Perl, Tcl and Smalltalk hence origin can be traced back to C and Fortran, C# is a derivative of Java, delphi and visual basic, hence can be traced back to C, Fortran and Pascal. This shows us that all this languages are derived from ancient languages, but why? why are languages reinvented; because we need specifics, we need to adapt to modern technology we need more solutions to our problem, if a new language is written, there was a need for it and it doesn't come to replace other languages but to serve its own purpose this brings me to a conclusion, every language is most important for someone because he is working on problems that require that specific language, or makes it easier to implement in that language.
Image from www.authenticsociety.com 

    This brings me back to my original purpose of this blog, what language should you use, which is the best. My answer to you is think of the area you are most interested in, for example simple interactive web pages you need HTML, CSS (of course) then you can include Javascript to make it interactive. If is a dynamic web site, PHP, Ruby or Python with SQL good choice, Java EE has proven to be very useful and reliable. Coming down to Mobile apps, depending on the platform native Android app development is done in Java but now we have special ways to write applications on android without the use of Java for Example. SL4A project has provided a way for us to write applications in Javascript, python, lua etc and run them on android even though on the background this languages call Java methods through RPC. Kivy is another framework that is good for Rapid application development, that can be compiled to run on multiple platforms such as android, ios, mac, windows e.t.c , kivy is a python library.

Personally i use multiple languages C, Java, Python, PL/SQL, PHP, Shell etc and i use each when its needed. We all in our careers will use multiple languages but it is good to have a main language and the rest are supplements.

Sunday, March 10, 2013

Real Hackers Hacking.... Called Hacks.

Who is a hacker, what does a real hacker means when he says "i am working on a hack" or "i am hacking" the correct answer to that is; He is solving a problem without using a design pattern or any specific method and in many cases the end point of such program or project is not obvious, this person is creative and have good critical thinking abilities, programming skills and mathematical skills. In this blog i will be talking about hacking in terms of "Programming" which is the traditional usage, but a lot of engineering fields use this term.

According to Eric Raymond the compiler of The New Hackers Dictionary defines a "good hack" as a clever solution to a programming problem and "hacking" is the act of doing it. But this days people refer hackers to be those bad guys who break into bank accounts or send a malicious warm that will sabotage an entire system, but actually what they are referring to is a bunch of "Social Engineers" or "Crackers" as the case may be. 
If we consider the digital world, hackers are the revolutionists, those who take the time, in creating something so beautiful that others enjoy using without even knowing how it came about, and also hackers find pleasure in developing such a world without asking for a price or compensation, but the joy of seeing it work alone is satisfying. History have recorded such hackers who revolutionize the way we live today, people such as John McCarthy, Denise Ritchie, Steve Wozniak, Tim Berners-lee, Richard Stallman, Linus Torvalds e.t.c. This men have work endlessly with or without pay to develop a digital world that we all totally rely on today for our daily activities, and the least we can do in their honor is to preserve the righteous name to only those who follow the ethics and continue where they left off. I am proud to be a hacker, if you are one you should be proud too but don't act in an unworthy manner. 

Wednesday, February 20, 2013

Tools of the trade

One will be surprised on the types of tools that are out there, since the invention of open source community of hackers, the IT world have been transforming at a very fast rate. Some times i may encounter a problem, and one click will deliver tons of result, why reinventing the wheel only takes precious time and resources, whereas the same goal will be achieved at the end, so why not take it and modify to your taste.
I was faced with a little problem today, i needed some materials on a course i am taking from a professor's web page, and there are tons of documents that if i am to go over each, i will waste valuable time that might be useful writing a block of code. So i remembered wget magic, i used once to download files with the same extension from a page, but this time, i need a whole directory and its content. I went through the man page of wget and found some parameters i can include in my bash command to cleanly get me the whole directory and contents without the index.html files. After few minutes i came up with a clean command;

 wget -r -nH --cut-dirs=2 --no-parent --reject="index.html*" http://PATH_TO_DIRECTORY

and holla:

wget magic at work
This is the point when you sit back and watch your creation at work, feeling like Chuck Norris after defeating the antagonist. 

This kinds of tools are enormous, some times i feel they are infinite, all you need is to look for and you will get, some of us are lazy to research, we feel as if reading through man pages   is a kind of boring process, but actually its fun, i agree when things don't work as perceived, one feels like the blue screen of death itself, but that is the different between normal developers and hackers, "we never quit, ever". Someone i look up to once quoted to me "When solving a problem, there are failures only ways in which the problem cannot be solvled" and believe me anytime you hit a dead end, you gained a lot because next time you will never go that path again.    


Friday, February 15, 2013

The need to write your Software tools


We translate problems from real life into mathematical expressions, following mathematical theorems that cannot be altered for no reason, if one is then everything those. Those mathematical expressions are then translated into a source code that can be compiled as a software useable by humans or computers. But the rules are slightly different between mathematical problem solving and software based problem solving, the difference is gravity and other physical laws can be modified or even altered in terms of software development, making your own tools is something you always do, even though there are a lot of tools out there, sometimes as a hacker you have no choice than to write your's. The need always arise to develop a tool, after day of going through the net searching and nothing turns up, this days it is bit difficult to not find tools suitable for your problem, also there might be a tool out there that is close but small modifications need to be done in order to make them compatible with your platform or language.