Saturday, January 24, 2015

Documentation and Comments

Many people starting out in programming thinks that documentation and commenting is a waste of time and it does make them better programmers.  It might be that documentation does not make a better program, but the quality of code can also be measured by its comments.  Just like science is not a science without documented measurements, code is not part of computer science if it is not documented.  

As more programming languages support docstrings, that feature of the language actually makes better programmers right from the start.  Java is one of those languages that is easy to learn, but its ability to support docstrings is not focused on in the early stage of learning.  

Java is also a great language to help those new to programming learn documentation of existing libraries of classes.  The main difference between a novice and an expert is that an expert know how to get help when needed in a fast and efficient way.  Thus, education could focus on not just the syntax, but focusing on how to find answers when questions arise.  That would help novice graduates overcome confusions faster and focus on real problem solving issues instead.  

Computer Science is also evolved to many languages and can not rely on a single language that is considered the latest "fad".  It is the combination of languages in order to solve problems by picking the right "tool".

Thus, you need to learn about many languages and collect your notes in a way that you can use regardless of the language you will use, but helps you with the required syntax.

This flowchart can be one of the ways you can map simple concepts and document each language.


  

Eclipse Shortcuts

Eclipse IDE is an amazing environment to help you learn many languages in one simple to install and use environment.  You can use it to learn Java, C++, and Python without learning IDE for each of those languages.  That way, you can focus on the actual language instead of wasting time learning another IDE.

Eclipse has man shortcuts that can help you make your programming experience much more fun by providing shortcuts for repeated tasks.

Auto-generate constructor
Auto generate setters and getters
Project->Generate javadoc
sysout + Ctrl + Space


Ctrl + i - indent selection
Ctrl+Shift+o - import required libraries
Ctrl+D - delete line
Alt+Shift+R - rename all occurrence of an identifier
Ctrl+F11 - run the code


Others

Alt+up or down  - Move a line of code up or down
main + Ctrl + Space  - Create main method signature
Ctrl+D  - Show hierarchy of a class
Ctrl+/ - comment the source code line
Ctrl+L - jump to line number
Ctrl+q  - last edit location
Ctrl+ o - outline of class

Short video summarizing most of the features mentioned in this post.
https://www.youtube.com/watch?v=7ESqUgkzke4

Wednesday, January 14, 2015

ReadyNAS 104 and iSCSI

There are many talks about cloud storage and storing files remotely as a way to protect data from loss.  While it is a great way to use free services for this purpose, you might also need to think about learning about this technology as a learning environment.  It does not matter if you are an information technology, information assurance, digital forensics, cybersecurity, or computer science student, you will need an infrastructure where you can experiment and learn on your own.  Hardware prices and open source operating systems make the setup of this environment easy and cheap.

If you are in computer science and try to learn about programming, you might find it easier to learn about network based programming by setting up a web server and experimenting with HTML and JavaScript as a start.

It seems like every application that is written these days are based on web services or use web services as its interface.  Thus, it is in your interest to learn about network based programs and program execution.  You will also need to think about safeguarding the code you write and ensuring its availability as you are progressing with your studies. So, you might need to learn about server management and file sharing.

One of the lesser known file sharing technologies is iSCSI ( Internet Small Computer System Interface, an Internet Protocol (IP)-based storage networking standard ).  It typically use TCP ports 860 and 3260 and provides authentication for secure sessions.  It is based on the Target ( server ) and the iSCSI Initiator ( client ) model that is built into Microsoft Windows 7 and above or can be freely installed on XP machines for iSCSI support.

There is not much "talk" about this technology, so I wanted to bring this technology to light for those of you interested setting up a home based network environment.

Watch video on how to setup and use a ReadyNAS based system.
http://youtu.be/Ag3tfc2VSUA

 

Getting started with Java

Java syntax and API is a simple to learn and use.
Java is object-oriented where each object can perform one or more discrete tasks and contains all the data needed to perform the task.
Java is distributed, you can send data across the net easily.
Java is robust, so programs run correctly and do not break when the unexpected happens.
Java is secure by limiting access of programs to your resources and files on your computer.
Java is architecture-neutral and portable by writing the code in one computer and running the code on another machine with another hardware configuration.
Java byte code is interpreted by a virtual machine not directly by the operating system.
Java is multithreaded as the programs share data and instructions.
Java is dynamic by calling upon resources as needed.

In order to learn this language, I recommend this path of action:


  1. Know how computers work 
    1.  - CPU, ALU, RAM, Thread, Process, Memory Address, and Interrupts
  2. Know how CPU instructions carried out
    1. - Assembly language instructions ( mov, jmp, cmp, add, ... )
  3. Know how file systems store data and how to manage your files in folders
  4. Know basic command line utilities ( dir, mkdir, rmdir, copy, set, echo, ... )
  5. Know how to get help from the local system or utilities and how to read the help documentation
  6. Know about path and other environmental variables
  7. Understand basic automation commands in the terminal
    1.  - i.e. for %i in ( 1 2 3 4 ) do echo Hello World %i
  8. Understand basic script execution and syntax
    1. - i.e. hello.bat -> for %%i in ( 1 2 3 4 ) do echo Hello World %%i
  9. Understand difference between JRE and JDK 
  10. Install and run ( javac, java ) simple Java program written in notepad.exe  ( see below )
  11. Learn C++ function and structure concepts 
  12. Understand the importance of documentation ( javadoc )
  13. Understand the importance of flowcharts, pseudo code, UML
  14. Create simple algorithms based on what you know 
    1. i.e. Calculate the are of a circle 
      1. create a table with columns radius, diameter, PI, area
      2. enter values into radius column
      3. calculate diameter and keep in mind the function ( d= 2 * r )
      4. write PI for each row ( this will need to be accessed by each row, so it is static )
      5. calculate the are ( a = r * r * PI )
      6. analyze the results
        1. each column with changing values without formula will be variable 
        2. each formula columns will be function/method 
        3. each entry that does not change will be final and static for all to access 
        4. value on the left side of the equation will be the return value for the method
        5. think about the documentation hat would help another person learn about your code
      7. write the code and look for syntax errors
        1. determine proper data types for identifiers
      8. identify unneeded code 
        1. diameter should be removed or changed to hold r*r as a sub-calculation since it can help with troubleshooting, but you can ignore 
      9. think about input validation to ensure positive radius values
        1. you can create another method to return an absolute value of radius before calculation of area
      10. enter the values from your table and test if you get the same results from your code
  15. Use Raptor to create code from flowchart
  16. Always generate javadoc of your own code and understand how to read it
  17. Use BlueJ to visualize objects and inheritance
  18. Use Greenfoot to understand GUI concepts and create simple games
  19. Move to a full featured Integrated Development Environment ( IDE ) like Eclipse
  20. Understand how to use the debugger to monitor values in your code at different stages of processing
  21. Make mistakes and learn from the error messages
  22. Add features to code you wrote and understand as you learn more about a language 
  23. Don't be afraid to experiment 


 /** Student Class establishes the student id, name and grade
  *  @author Richland Teacher
  *  @version 2015
 */
 public class hello
 {
     private final String studentName;
     int value;
     public static int year;
     /**
      * This is a method that will take two parameters and will set a single field in the object
      * @param parameterOne imaginary first name as a String
      * @param parameterTwo imaginary last name as a String
      */
//Constructor for the hello class
public hello( String parameterOne, String parameterTwo ){
          studentName=parameterOne+parameterTwo;
          value=100;
          year=1900;
}
    // Main method
     public static void main(String[] args)
     {
         String name="My name is: ";
         System.out.println("Hello, "+name + args[0]);
         hello testing = new hello("firstname","lastname");
         System.out.println("Hello "+testing.value+"  "+year);
     }
  }// End of  class

Wednesday, January 7, 2015

Problem to Execution Methodology

Computer Science does not start with coding, but preparation and analysis in order to solve a problem at hand. That process requires many years of preparation and logical approach to solve problems. Thus, computer science is not as dependent on the programming language as most people think it is. Your first question about computer science should not be, "What language I should learn?", but how do I learn to solve mathematical problems. Problem solution starts with simplification, pattern recognition, and strong math background to create an algorithm that can solve the problem at hand in a finite amount of time and in a reliable way. Lately, we might also add the consideration of "securely" in order to solve problems in a way that is securely controlled.




In many cases, you will need to learn how to compile your code, but the Graphical User Interface ( GUI ) based IDE environments can divert your attention from how the process actually works.  I have created a video to help you understand the process of compiling code.  The video will also show you how to create libraries and DLLs and compile these static and dynamic libraries into your code.

http://youtu.be/7Gt5FJpEQvA