Tuesday, July 29, 2008

Programming: A Social Activity

I have been listening to a weekly podcast, Stackoverflow with Joel Spolsky and Jeff Atwood. Podcast 15 features a question that asks what the most effective code review methods are. On the podcast site, the show notes state,
Joel and I both agree: one of the most effective coding practices you can adopt on your team is interactive, sit-down-with-your-coworker code review. 90% of the things you will learn have nothing to do with the code. I believe programming is a far more social activity than most realize. If you write code, and nobody but you ever sees that code — did you really extract all the benefit from writing that code?

Friday, July 25, 2008

Notepad2: A light-weight ABAP external editor

(a.k.a. Look Dr. Raghavan, no SAP environment!)

OK. It has been awhile since I have posted anything. Reason: I am heavily involved in church and family, working full-time, and going to school part-time. Enough said. Anyway, I have been taking a few SAP classes this summer as part of the Business Informatics graduate program I am in at NKU. One of the classes is an ABAP programming class.

I have to admit that after being skeptical at first, I like ABAP and its development environment. However, while still in the course, I want an external editor that I could use that color codes the syntax to make it easier to read and edit. Granted I will not be able to debug the code but it is nice to have an editor to drop code into, as I do not have to login to SAP, for a quick look.

My favorite light-weight editor is Notepad2 from Florian Balmer. Since it is open source, and I saw where others have added different language-syntax highlighting capabilities, I thought I would give it a go.

First, I downloaded the Notepad2 source from Flo’s Freeware Page and opened the C++ project in Visual Studio 2005. Then, after bombing on my first build, I read the readme file which stated to include the source from the editor that inspired notepad2, Scintilla and tweak one of the source files. After another bomb on the rebuild I set the project property to NOT embed the manifest. Then, it built.

Next, I wanted to get an ABAP lexer working for Notepad2. A quick look on Google and I found another build of Scintilla, SciTE Ru-Board Edition. Now is when the fun begins. What I essentially did was to dig into the SciTE Ru-Board source code, grab what I thought was the needed to implement the Notepad2 ABAP lexer, and then attempt a rebuild. With each attempted build I find various sections that I needed to modify within the Scintilla source code. Finally after about a dozen attempts, I had the Notepad2 project building.

Then, I wanted to update the Notepad2 Styles header and program files (Styles.h and Styles.c ) so that the color coding will work for ABAP files in Notepad2. Once this was completed, I had a light-weight ABAP editor that provided syntax highlighting for files with an ".abap" or ."abp" extension.

Finally, if you pull down the Notepad2 source from Flo’s Freeware Page, do a "diff" on the /src/Styles.c and /src/Styles.h files to see the updates. Also, to see where the Scintilla source was modified diffs should be done comparing the following files: /include/PropSet.h, /include/SciLexer.h, /src/KeyWords.cxx, /src/PropSet.cxx, and /src/StyleContext.h. I also added the /src/LexABAP.cxx file to the Scintilla source (thanks to VladVro [one of the SciTE Ru-Board Edition project owners]) as that is needed by Notepad2.

NOTE: The Visual Studio 2005 Notepad2 project and binary downloads were updated 9/18/2008 with more Object Oriented ABAP keywords.
Click here to get the Visual Studio 2005 Notepad2 project.
Click here to get the binary Notepad2 files.

NOTE: By the way, I added Scott Hanselman’s Ruby lexer to this project for Ruby file edits.