Coding Style

1.  Am I weird?

2.  Spacing

3.  Examples

4.  Final Thoughts

Weird

I always wonder if I’m just an awkward programmer. I totally understand that everyone has their own style and “mark” with programming, however, I’ve never really met someone who likes as much spacing as I do.  Every default/built-in formatter must be replaced or altered so that it works how I like it.  It’s not that their format is bad or not correct, you could really put everything on one line.  But it’s just not like a book.  Like a book, everything is structured, and such is code.  I’ve always loved books that offer chapters.  Eragon, Harry Potter, Game of Thrones, etc.  All three of these titles use chapters often.  I love it.  I can’t stand reading books that are more or less, compact with tons of information, hence why many academic books, I can’t stand.  I think my coding style relates to this.

Spacing

By spacing, I mean new lines, tons and tons of new lines.  My methods will knowingly be on this one tab mark.  I will not have else’s hanging near a curly brace, and their will be new lines between different types of packages, and different purposed variables.  And please, please please please, do not have a whole if statement, condition and execution, on one line.  But at the same time, I like long lines.  No 80 character limit, we aren’t in the 90’s anymore.  We have monitors that support three times that many characters now, so please don’t have your method arguments containing multiple lines.  It’s not comfortable to skip down like this, even with the spacing.  To bring back the book idea, one thought, per a line.  If I’m running a condition, that’s a line.  Then I pre-prompt the execution (Curly brace), on another line, then I give the execution, and to end that off, my closing (Another curly brace).

As My Math Professor Says, “I’ll start off with some examples” **Spoken with an English accent**

The simple statement:

 while(true) { System.out.println("Infinite"); } 

No!  Should be something like:

while(true)
{
     System.out.println("Infinite");
}

I understand this adds a lot of lines for something not needed.  But read it.  What is easier to comprehend?  If I was to add a comment explaining it, I just add it.  I don’t worry about to reference in the comment, I just put it above or on the side (Depending on size).

Another least favorite of mine:

 if(i==0) i+=10; 

Really?  I mean, I understand usually with a line like this, it’s hard to not understand what’s going on.  But it’s just awkward to me.  I’m sure you can guess what I’d rather see:

if(i==0)
{
    i+=10;
}

Finally

Enough of the ramble.  I’ll just leave off with, I like tabs. I don’t like spaces.  Not all editors handle erasing whitespace similarly.  Where-as, I delete a tab, guess what? It deletes that whole block, not that block, including a line or two above it  But alas, I can adapt.  I can also use Astyle (Really love this program) to switch between what a class/company wants, to what I want.  Painlessly simple too.

Distributed File System (CEPH), SSHFS, and More

What all has been happening in the past two to three weeks?

1. Change of plan

2. Learning new things

3. Other projects

Plan Changer

So, previously the main goal was to make a service that would track what all happens on your device, data traffic wise. However, a change has been made, temporarily. While this is still the main goal, I’ll be switching gears towards something else (Look at number two). First though, what’s taken me so long. This extends to point three, but also something to address here. Obviously, I’ll be using other machines to work on everything. Because of this, and it being an university ran system, everything isn’t set up how I normally operate, and I’ve been customizing things to fit how I work. So the past week or two has been me getting used to the changes, not only on the system, but also what I’ll be doing in the future. Rather than jump in to the project, I’m trying to plan out how to go about it and have everything worked out before hand, as this (In my opinion), will make the end shorter.

New Things

The new project is distributed file system, which I’m very interested in, and hopefully can sit-in on our distributed system class here at Wright State. The lab I’m working in contains ~30 machines, each machine with 350 gigs of space, not being used, in its own partition. My professor, Dr. Mateti, has requested that I set up these machines to all collaborate together. He’s recommended the program CEPH, which from what I’ve read thus far, seems to be nice, and simple enough to set up. More about that later.

Also, something I found extremely interesting as I’ve wanted to do this, connect a file system to my local machine that handles files on external servers. I knew it was possible, but never looked in to it, nor have I actually done it. Dr. Mateti has this set up from his home and to multiple machines in the building, and we went over SSHFS. Obviously, SSH is secure shell, and FS is file system. This was the most painless configuration I’ve done for a while.

To set up SSHFS, you first want to make a directory on your local system. Then you run a command similiar to such:

sshfs -o idmap=user remoteUserName@remoteIPOrServer:/your/remote/directory $HOME/YourLocalDirectory

You want to change anything bolded. Once done, go in to the directory, type mount, then enter information requested, and you’re set. Honestly, one of the easiest and most useful things I’ve done for a bit of time.

My Projects

I’m currently working on two personal projects. One of which is a simple app that I do in spare time in my room, probably two or three hours a week. Another is working on Fennec, Firefox’s mobile client. I’ll write more about each of these, but a summary for now.

Fennec, I’m doing general bug fixes. This project is very helpful to me for several reasons. First, I’m learning how to effectively use a large code base. While not wasting anyone’s time but my own, I can go through the files, do what I can to make sense of them, and Log.d every couple of lines and see what’s happening. Secondly, I’m seeing how people who program for a living, program. This is surprisingly not common in academics, even though I believe it should be enforced (This, and revision control, whether it be git or Mercurial, etc.). It’s extremely important, in my opinion, to be able to read and understand others code, be able to implement it effectively, and come up with ways to do this. Lastly, I’m working on something that sees the light of day, using technologies that exist and are used everywhere, collaborating (I’m on their IRC 24/7) with others, helping out a public and open-source project, etc. etc. Their really is no “lastly”.

Pic2Griddler is an app that I’m developing. Yet Another Puzzle App, in other words. This is more for my personal use, as I’ve been in to Griddlers for several months now, but I’m not a fan of paying for an app that I’d get a couple weeks out of, then be done. So my solution, make an app that gives me unlimited amount of time to work on. I’ll be posting more in-depth about this later, you can read the README on the GitHub page on the side bar.