Showing posts with label IDE. Show all posts
Showing posts with label IDE. Show all posts

Wednesday, July 18, 2012

Comparison of C++ IDEs

C++ is the second language that I ever learned overall, with Java being my first. Java is a very IDE-centric language, so I was accustomed to that coming into C++. My journey took me through almost all of the IDEs available on Linux that can write, highlight, and compile C++ code all in one place. Here is my comparison.

Eclipse
 Although Eclipse is one of my favorite integrated development environments for Java and the industry standard for Android application development, I was definitely not a fan of it for use in C++. By default, it does not work with cout or endl (and presumably other objects that are located in separate header files). Even with the scope operator "::" (that a beginner may not even think to use) it will not accept the usage of these objects as statements. Until these issues are figured out, Eclipse is not a good C++ solution.

Netbeans
Although I no longer have Netbeans installed  to provide a picture or recall exactly how it handles C++, I can vouch for it. Netbeans, once it is set up with gcc, is one of the better C++ IDEs. It has code completion, documentation lookups for certain functions, and a built-in run display like Geany. The performance of Netbeans, however, is not worth downloading and installing Java and Netbeans itself if you don't already use it for something else.

Geany
IDE window
This is Geany, a cute lightweight IDE coming in at only 4MB in size. It has a lot of nice features, like a symbols browser (outline of a program), document browser (for active files), good settings dialog complete with re-mappable keybindings and some unexpected stuff (like a jump-to-line feature). For being such a small IDE it has a lot packed into here. I have never used Geany much, but it's just about as good as it gets with C++ IDE's, despite its small size and simplistic feel. I've even seen its argument-completion be more accurate than code::blocks. 

Qt Creator
 Qt Creator is an enormous beast using the Qt graphical framework. It is cross-compatible, which is a plus, and is centered on Qt development. I cannot express what a great IDE this is to use. Code completion, documentation lookups, formatting, a GUI to create user interfaces, a settings manager that covers every detail, and a symbol browser are just a few of the good things about this IDE. This is the smartest of the IDE's I have ever used. It often corrects my mistakes (changing "." to "->" when talking about pointers) for me without me even realizing it. Another added bonus is that the IDE uses a .pro file to map out all of the files in a particular project, so it can categorize and remember what files belong to which project.

Qt creator is good for editing console-only code, too. It uses qmake, which may cause some minor complications, but that minor inconvenience aside it is a full-featured IDE.

Code::Blocks
 Code::Blocks is the IDE that I personally prefer, even though it has less features than Qt creator. It is light for an IDE (only about 7 MB) and has a lot of pre-installed templates for C programs on embedded systems. Code::Blocks is very useful for console application development, and possibly GTK, but not much else. Its settings manager is similar to Geany's, but with a few more features. Two bonuses to using codeblocks are a formatting plugin called "Astyle" with a bunch of pre-installed themes and optional speed optimization (at the cost of compile time). Codeblocks has a symbol browser in one of the toolbars which are fully customizable. You can have as many or as few toolbars as you wish. You can even detach them. Another feature, although it does not matter to a C++ developer much, is the scripting console that Codeblocks comes with.

Conclusion
Those are all of the major IDE's for C++ development. Some prefer to use a text-editor and a compiler, and if you do, see Comparison of Text Editors. Otherwise, follow these trees:

Trees (Best to worst)

Features
Qt Creator
Codeblocks
Netbeans
Geany
Eclipse

 Size (smallest to biggest)
Geany
Codeblocks
Netbeans
Eclipse
Qt creator

Ease-of-use
Netbeans
Geany
Qt creator
Codeblocks
Eclipse   

Customization
Qt creator
Codeblocks
Geany
Netbeans
Eclipse

Compiler Integration
Codeblocks
Geany
Netbeans
Qt Creator
Eclipse

FINAL
Codeblocks: 14
Geany: 13
QtCreator: 13
Eclipse: 1 

This, of course, is based on Console applications and does not include code extra features like code completion. The bottom line is, beginners should use Codeblocks and "Intermediates" should probably use Qt creator.

Sunday, July 1, 2012

Access UI in Android Application Development

This summer I took a class in Android application development with Java. Coming into the experience I had an extensive knowledge with C++ and the Qt framework as well as Swing and Awt which are Java-specific. Qtcreator, a popular Qt IDE, used to make it very simple to access and change the ui using (ui->objname). With Android no such object was generated with the Eclipse IDE, which is the most popular tool for Android application development. I will assume that you are using Eclipse and ADT since that is the most popular choice for developing apps.

The Example
We have a grid layout with a Button called "Button1" in the middle of it. We are going to change the text from the Activity from which it is made.

The Implementation
Down to the business. We need to first access the button object using something called "findViewById()".

In Eclipse there is a variable named "R" that relates to the generated Dalvik Java. To alter the UI, we need to go through this "R" variable to get the ID of a object. The ID is the name given to the object in the layout xml file.

First off, make a Button that will be assigned to the button in the application. (Button b = new Button()). You need to import android.widget.Button to do this. Then, assign it to the button in the layout like this (inside onCreate is a good place to do this. After setContentView) (b= (Button)findViewById(R.id.Button1). This assigns b to the button with that ID from the XML. It is neandroid.wiget.buttoncessary to cast it to a Button since it is just finding the view by ID. Now you have access to all of the methods for that button. To change the text just use the "setText()" method. (b.setText("Button Text")).

Here is the condensed version of all of this as a note:

Sunday, April 29, 2012

Programming in Qt 1 - Absolute Basics

INDEX:
Purpose
Prerequisites
First program in depth

Purpose 
             As a somewhat new programmer (less than a year) I have run into some irritating tutorials in my experiences. When I began to learn the Qt framework and the Qt creator Integrated Development Environment (IDE) these experiences were ubiquitous. This is in part due to the self-explanatory documentation of the library, since the documentation is enough for some people to learn their way around. Through the few good online tutorials and documentation I have taught myself the basics of Qt and am now ready to share my learning process with the internet so that upcoming programmers can learn from my breakthroughs and mistakes.

Prerequisites
               During the next posts pertaining to this I will cover Qt, Qt creator and all of its parts, and .deb packaging later on. Qt is absolutely required, and Qt creator is required for this tutorial since I will use information specific to that IDE, but Qt development can be done without it. The main reason I choose to write about and use Qt creator is for its GUI designer. You can download Qt creator and Qt at http://qt.nokia.com/downloads. Qt is a huge library, so be patient.

First program in depth
            There really is nothing more that you need to do once you have a working version of Qt creator. Launch it and we can begin writing the first program. Launch Qt creator and do the following: Create project > Qt Widget project (Qt GUI Application) > (name it and put it in the folder) > use default settings > Default settings > Finish.

             You should now be placed in mainwindow.cpp, where the constructor and deconstructor are defined. There should be a folder on the left side of the application called "Forms" with an arrow. Click on it and click on mainwindow.ui. This is a blank canvas of a user interface. Next, take a push button from the left and drag it onto the canvas. The button will read "PushButton". The code you write now will show you how to change this to demonstrate control over the UI. You do not have to do this since you can edit the text right from the Gui designer, but this will be an introduction to external UI control.

         Hit edit on the left hand side and you will be brought to the QML (Q markup langauge) for the user interface. Ignore this and move back go mainwindow.cpp under sources.

        The user interface is accessed with "ui->" from mainwindow.cpp, So, after the code ui->setupUi(this); we can change the text of the push button. After it, write ui and hit ".". The . will convert itself into -> and you will have a list of UI items. The entries with a blue block are Qt classes, including pushButton, which is what we want. Type p and enter to select the push button. Now, use "." again to see a list of variables and functions relating to pushButton. Use setText("text here"); to change the button to whatever you wish.

The final code should look like this: ui->setupUi(this); ui->pushButton->setText("text here");
      
       This code is executed right after the program sets itself up, so the user never sees "PushButton" on the button.

In the next tutorial I will show you how to use Signals and Slots, which are the Qt equivalent of Swing's events. You will make it so the button toggles its name on every click.

Thursday, August 25, 2011

Integrated Development Environments

I am sure that about 90% of programmers and probably around 45% of web developers have used or are currently using an Integrated Desktop Environment (IDE) to do their work. IDEs make it possible to write the code, compile it, and distribute it all from one program. Some of the more advanced IDEs offer code completion and method descriptions.

Let's say you started a new Java project in the Netbeans IDE, my personal favorite. The most commonly used way to output something in java is "System.out.println("Something here");
When you type the "." after "System" it will come up with 31 methods and give the javadoc description for each upon click. After you type or select "out." 41 more methods complete with descriptions come up. This happens for all the classes / methods in the given language. Even ones that you create.

To download netbeans go to netbeans.org
It has support for many language included but not limited to C/C++, java, Most forms of Web, and Ruby.
Another popular IDE is Eclipse, but I downloaded the amd64 version like a fool and cannot run it.