1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GUI Programming

Discussion in 'General Programming Chat' started by drey2k, Jun 19, 2009.

  1. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    Hi there,

    What is the best language for GUI Programming?

    For example:

    Creating browsers like Firefox, messenging programs, financial software (inventory tracking systems, trading platforms), etc?

    I know you can GUI Program in many languages, but which is the most efficient and easy to learn? Which is simply the best for this?

    Thanks.
     
  2. Rick4691

    Rick4691 Registered Member Premium Member

    Joined:
    Feb 19, 2008
    Messages:
    70
    Likes Received:
    30
    Occupation:
    Programmer
    Location:
    Oceania
    Well, Java finally got rid of their clunky AWT/Swing platform and created JavaFX. You could try that using Eclipse.

    I also know that there's a pretty good GUI library for Python (a couple of commercial games use it ...). For more info on that, I think "Python Programming for the Absolute Beginner" offers a pretty good introduction.

    I do think if you want pure performance, though, you need to stick with C++. But there you have issues like the inherent difficulty of the language to deal with and the fact that deployment on different platforms is a challenge.

    I'd do a GUI in Java, if I were pressed for time, because I know Java and I know AWT and Swing. JavaFX wouldn't be a stretch.

    If I had the luxury to learn something new, I would go for Python --- I know what it's capable of and I know the GUI library works. And I can learn it fast. The absolute beginner book on Python is understandable and moves quick.

    If I were concerned about performance, I'd have to go with C++ and decide what GUI library to use. I tried MFC a long time ago and didn't like it. I would probably go with something open-source like GTK+.
     
  3. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    Can you GUI program in PHP or does it totally suck? What about C#?

    I heard a big problem with Python is its code re-usability.
     
  4. Rick4691

    Rick4691 Registered Member Premium Member

    Joined:
    Feb 19, 2008
    Messages:
    70
    Likes Received:
    30
    Occupation:
    Programmer
    Location:
    Oceania
    PHP is more of a "insert code into HTML" language. That said, Drupal seems to do a pretty good job of doing a lot of GUI type stuff using PHP.

    C# --- Yes, there's a GUI library. It's probably similar to MFC, and it's Microsoft, so I don't know if it will work on Unix.

    Python's code re-usability --- In what sense? It's Object Oriented, so you should be able to write a class and, if you did it right (but that's the case with any OO) use it in several different contexts. Python also integrates well with Java, C, and C++. Like Java, it's supposed to be write once run anywhere. Where did you hear/read that about Python?
     
  5. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    I've read some stuff on the internet that said that Python is inferior to Java because it's harder to re-use code.
     
  6. Rick4691

    Rick4691 Registered Member Premium Member

    Joined:
    Feb 19, 2008
    Messages:
    70
    Likes Received:
    30
    Occupation:
    Programmer
    Location:
    Oceania
    Ah, you must be thinking of the way you can deploy multiple classes in a single source file in Python. I've had to deal with something similar in C, but it was about three hundred pages of functions one after another in the same file.

    Here's a dirty little secret: most code is NOT re-used. If it is re-used, it's either cut and pasted or re-used wrong.

    Quick story. Several years ago, I was assigned a project that was very similar to several projects that had preceded it. I looked at the previous applications and was surprised to find hard-coded values that defined individual input and output fields and a lot of code that had been cut-and-pasted by several previous programmers. I saw an opportunity to increase declarative control by removing the input and output field definitions from the code and placing them into separate properties files.

    Once this was done, I also saw that all the related projects shared a similar structure and could benefit from being refactored as implementations of the Template design pattern.

    I had essentially distilled the code and structure common to a whole class of projects that we continue to develop and put it in one place, an abstract template class. In addition, the parts that vary most between projects, the input and output field definitions, has been separated out into two standardized properties files for each individual project.

    These projects are all deployed in Java, but I've used similar approaches, templatizing and increasing declarative controls, to a lesser extent in C, C++, Kornshell, and Perl.

    The point is that the ability to re-use code is not a function of syntax.

    Being able to re-use code requires you to understand programming at a level separate from the language you're using.

    This is why elsewhere I have encouraged beginning programmers to learn LISP as a first language. LISP allows you to think beyond the language and just makes you a better programmer. In fact, if you look at the table of contents of "Practical Common Lisp" by Peter Seibel, you'll see that Lisp lends itself to a lot of BH-type projects.

    Unfortunately, I think there's a lot to learn in LISP before you can start using one of the GUI libraries, plus you're more on your own with LISP.

    Python has a lot in common with LISP, so it's a good compromise. Especially since the GUI toolkit is pretty easy to pick up.

    But, if you really want to learn Java and JavaFX, I won't stop you. A lot of people complain that Java is verbose, and that strict typing reduces coding efficiency. But I think verbosity lends itself to self-documenting code and strict typing helps to avoid certain errors. Java is still my programming lingua franca.
     
    • Thanks Thanks x 1
  7. clickbang

    clickbang Jr. VIP Jr. VIP Premium Member

    Joined:
    May 21, 2008
    Messages:
    199
    Likes Received:
    121
    If I am not mistaken, Firefox is programmed in primarily C++ and little JavaScript.

    I would second Java in this case though I have never done any GUI programming in Python. I only know how to code a console based application in python and it is indeed easier and fun.

    C and C++ are harder to learn and master compared to Java. On the other hand, developing a program in Java can be more efficient with such a large library. However C and C++ have more advantages when it comes to performance and speed.

    In fact, you should look into many other aspects and not just the programming language. You have to also evaluate the framework, platform and support available.

    Look at Limewire. It's completely programmed in Java!
    Code:
    http://wiki.limewire.org/index.php?title=Frequently_Asked_Questions#pro1
     
  8. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    Rick you sound like a real hardcore programmer. Do you have a CS degree or are you self-learned?
     
  9. Rick4691

    Rick4691 Registered Member Premium Member

    Joined:
    Feb 19, 2008
    Messages:
    70
    Likes Received:
    30
    Occupation:
    Programmer
    Location:
    Oceania
    I'm self taught. I tried getting a PhD in English, but stopped writing my dissertation after about thirty pages and started learning to program in VB3.

    It sort of snowballed from there. I took several courses along the way, even a grad-level course on relational databases, but I mostly just crack open a book, type in code, and experiment.

    It's more fun that way. :)
     
  10. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    Haha that is awesome man...

    So you basically make a living programming then? Do you work for a company, freelance? Or just do your own projects and sell stuff?
     
  11. Rick4691

    Rick4691 Registered Member Premium Member

    Joined:
    Feb 19, 2008
    Messages:
    70
    Likes Received:
    30
    Occupation:
    Programmer
    Location:
    Oceania
    Ah, the corporate types got to me with some golden handcuffs. Plus I think I'm too interested in too much stuff to ever work on just one project on my own to completion. And I'm not a very good salesman.

    ---------------------------------

    By the way, I did a bit more research on Python -

    Here's the guy who wrote the language, Guido van Rossum:

    http://www.python.org/~guido/

    Here's a PowerPoint he gave on Python:

    http://www.python.org/doc/essays/ppt/www8-py-www/sld001.htm

    (Read it, it's only thirteen PowerPoint pages and gives some perspective on Python's history and capabilities.)

    And here is the home page for Grail (not Grails), an early web browser written in Python (nice proof of concept, here):

    http://grail.sourceforge.net/

    ----

    Are you just getting your feet wet and trying to choose a direction, or do you have a specific project you're working on?
     
    • Thanks Thanks x 1
  12. drey2k

    drey2k Power Member

    Joined:
    Jan 4, 2009
    Messages:
    551
    Likes Received:
    169
    Occupation:
    Finance guy
    Location:
    USSR 1943
    The first thing :)

    I'm actually starting to get into Java a bit... been reading a book on it. It seems pretty interesting. You can basically do everything in Java right? Web, GUI, etc?

    How is the speed of development in Java? Is it better to get into something like C# or C++?

    Btw, Python is a scripting language right, what can you do in languages like C++ that you cannot do in Python?
     
    Last edited: Jun 25, 2009
  13. _Austin

    _Austin Junior Member

    Joined:
    Apr 9, 2009
    Messages:
    147
    Likes Received:
    39
    Like others have already said C++ is a lower level language and it's advantages are in dynamic memory management and even down to some hardware specific optimizations. This allows you to use as little memory as possible thus increasing your applications speed and effect on the users computer. Plus it is a bit more open with what you can do with it, they allow you a free reign to pretty much do what ever you like and if it breaks it's on you to find out what went wrong and how to fix it.

    Java, C# and Python alike are all very user friendly and a lot of the times are even more friendly when used with the appropriate IDE ( integrated developer environment ). If you are working with Windows I would suggest using Visual C# with the .NET framework. A function or class usually always already exists no matter how complicated the task and Microsoft's free IDE goes above and beyond helping you out with their Intellisense which pretty much tells you what you have done or are doing wrong and the appropriate corrections. On top of all that their GUI is surprisingly easy to use; pretty much just drag, drop and click then type in what ever code you need done.

    In the end though after a few years you will pick up many different languages and move on to bigger and greater things. Java, C#, VB, Python... anything is fine really when you are starting out as long as you are able to absorb the bigger concepts of programming.

    Microsoft offers a free IDE: http://www.microsoft.com/express/vcsharp/

    _Austin
     
    • Thanks Thanks x 1
    Last edited: Jun 25, 2009
  14. amphetamine

    amphetamine Newbie

    Joined:
    Mar 1, 2009
    Messages:
    9
    Likes Received:
    0
    The question is very broad. Here are some choices..

    Visual Basic / Delphi = very easy to use, quick development, not as limited as some zealots would like you to think, but they only work on Windows - though the .NET platform works on Linux and OS X.. but I'm not sure if VB .NET is supported on those OSes yet (C# is).

    C# = Excellent language, for most system tasks including GUI programming. I wouldn't say it's the easiest to learn, but if you know C or Java, you pretty much just need a crash course to get going.

    Ruby/Python/PHP/Perl = you can use these along with different libraries, like the win32 library, wxWidgets, GTK+2 etc.. those libs will let you create GUIs. They are relatively easy to use. I've used Python and wxPython with great results. They're portable too.

    You can build web interfaces. A good example of this is something like PHPMyAdmin or many Linux apps. There are special libraries designed just for building these types of interfaces, and they're completely portable. But they might be limited as to what you can and cannot do.

    C/C++ = You can use the Windows API (raw) or the MFC (this is just an object oriented encapsulation of the Windows API, which is C/procedural) to build GUIs. I used this for a long time, and it's neat for tiny apps like keygens and stuff, but a major pain in the ass for anything actually useful.

    Java = I grew up hating Java. I saw it as being slow and bulky, and it's generally not as cool to code in as C or Assembly. So I spent most of my youth coding GUIs in Assembly and C - I was retarded. but I've come to like it in the past few months, and it is now probably my favorite language behind Ruby.

    Java is fantastic, especially for big apps, and web apps (see mint.com - GREAT service, written in Java). And Java isn't really slow anymore, it never was slow on Linux to begin with. Azureus is written in Java. It's a language you should know, and if you're thinking of coding a system app you might as well just pick this up.
     
  15. amphetamine

    amphetamine Newbie

    Joined:
    Mar 1, 2009
    Messages:
    9
    Likes Received:
    0
    C/C++ have the slowest speed of development, and are generally reserved for instances where they're absolutely needed. The core components of games and mission critical stuff needs to be written in C because performance and control are essential, for example, and though you can code web apps in C, it's just impractical.

    Python/Ruby/Perl/PHP are interpreted languages, but that really doesn't mean they're limited, depending on what you're doing. You can make openGL apps in Ruby or Python (even PHP).. you just wouldn't be able to do very very low level stuff like communicate with hardware, meaning you can't write an operating system or device drivers in these languages. Though in practice, people have written interfaces in C, that let you communicate with hardware via another language like PHP or Python.
     
  16. justone

    justone Elite Member

    Joined:
    Oct 12, 2008
    Messages:
    1,516
    Likes Received:
    1,037
    Occupation:
    -
    Location:
    Europe

    Just wanted to add that wxwidgets is also available for C++. You can download codelite (a free IDE) together with minGW (windows gcc) and wxwidgets as a single installer.
     
  17. aiden_young

    aiden_young Newbie

    Joined:
    Apr 7, 2008
    Messages:
    9
    Likes Received:
    9
    Selecting a programming language is no different from selecting the "right screwdriver" for a job.

    Sure, you can use a flathead screwdriver on a philipshead screw but...

    Each programming language has it's own strength and weaknesses and although a particular language might be the best choice, technically, it may still not be the best for *you*.

    *All* programming languages are good for simple projects. The problem is, are they good at large projects?

    All the mainstream languages are reasonably good for large and GUI related projects, however, you will not know if they are right for *you* unless you try them yourself.

    Here is an example, Delphi is a very easy language to learn and it can do *all* the things that any modern application might require yet I prefer other languages.

    Why?

    Because I "grew up" with C/C++ and I find Delphi long winded and verbose also I thing it looks "ugly."

    I just get sick of typing begin/ends all the time whereas in C/C++ ( PHP ) I can just use { and }.

    You have to consider the "whole picture" of what you want to program and how much time you are willing to put into learning it.

    Java is an OK enough language, however, the runtime libraries are getting bigger and bigger and it *still* requires a lot of resources both for programming in it and running it.

    Python is easy to learn ( similar to Delphi in my opinion ), however, it is still big, specially after installing the GUI libraries and it is a "scripting language" which means that if you want to sell your software it might be more difficult to package than others.

    I think it is fair to say that all mainstream languages are getting bigger than they should be!

    I do about 80% of my work in PHP. It requires a reasonably small footprint to install ( and you can get away with throwing away about 50% of installed components as you won't need them most of the time )

    PHP has been designed for the web and does *not* have a GUI library for creating desktop apps.

    However, there is an easy way around it. You can get packages containing cut-down version of a web server, browser and PHP, all in one. So, basically, you can use the built in browser as you GUI.

    This has major benefits:

    1) You can now create rich, multi-media applications without having to learn API intricacies,
    2) By encoding your PHP source code, you can make it safe and packaging becomes a reality,
    3) You'll have a truely portable application, you can run the same source code on different OS's as well as desktop or web environments --- even Java can't do this, regardless of the propaganda,
    4) You learn a language that is the *main* tool for professional BH-ters,
    5) It has inbuilt support for databases, networking, filesystems,encryption etc etc etc
    6) With the latest versions of PHP, you can use modern programming methodologies ( if you choose to ) yet can still do "quick-and-dirty" one-to-ten liners.
    7) It can also be used as a replacement for batch/shell programming

    I could go on and on about it, however, I think this is enough for now.

    I would also like to mention two more alternatives which have not made it to mainstream and I have no idea why that is.

    One is Purebasic. It's obviously based on Basic, it's easy to learn, it creates native, very fast and compact code. Small and easy installation --- try it out whether you go with it or not.

    The other one, which is getting to be my second "workhorse" is a version of the Lua programming language, created and named after John Murga: murgaLua, google for it.

    It comes with inbuilt support for SQLite database ( though I would not recommend for large project as you can integrate MySQL into it very easily ), has the FLTK gui library bound with it, so you can create GUI programs easily.

    It is an easy language to learn and is also very, very portable.

    It is a capable language, though it looks a "toy" on first sight, it has a lot of advanced features that can make your life as a programmer very easy.

    Again, it can be used in place of batch/shell files, too, so you have a portable way to run maintenance and other system related tasks. It also has a socket library built in so you can do all the networking bit your little heart wants to...

    That's all for now,
    A.
     
    • Thanks Thanks x 1
    Last edited: Aug 26, 2009
  18. dave909

    dave909 Newbie

    Joined:
    Oct 4, 2008
    Messages:
    3
    Likes Received:
    0
    Hi Aiden,

    I am intrigued by this comment....re workaround for building GUI apps with PHP.... Do you have any more tips in this regard?

    Cheers
    Dave

     
  19. aiden_young

    aiden_young Newbie

    Joined:
    Apr 7, 2008
    Messages:
    9
    Likes Received:
    9
    Any more tips? - Yes, try it...:D

    But seriously, there are a number of alternatives:

    1)
    Code:
    http://www.indigostar.com/microweb.htm
    2)
    Code:
    http://www.inspired-archetypes.com/downloads.php
    The first one is a commercial package, the second one is a free package and is more than enough for not only proof-of-concept applications but also for production versions - check licensing though.

    Or you could slap up your own version in about an hour if you have any experience with Delphi/VC++.

    All you need is the sources for the Apache server, bind it with a web browser control, download a minimal PHP 5 from
    Code:
    http://winbinder.org/
    and you'll have all you need for writing/testing/packaging a truly portable application.

    Try any of the above, if you get stuck ask *specific* question, I'll help if I can.

    A.

    PS.
    Code:
    http://winbinder.org/
    also allows you to write "native" gui's for window using PHP. However, the idea here was that we use a browser so that we can use HTML/Javascript to write "potable GUI's" and multi-media applications without having to learn silly API's.

    Therefore, I do not recommend that you use Winbinder ( you can try it though if you want to, of course ). I've only shown that page as they have a minimal PHP 5 package which basically runs "out-of-the-box."

    You could get a full version of PHP and strip it down if you want to. However, if you just want to try the concepts above, then you'd probably want to get going asap. And the above links will do that for you.

    There are other alternatives, too, google for "web gui" or similar...
     
  20. dave909

    dave909 Newbie

    Joined:
    Oct 4, 2008
    Messages:
    3
    Likes Received:
    0
    Thanks..... I will check it out!