Page 1 of 2
OOP programming
Posted: Sun Apr 21, 2019 9:57 pm
by ROBROS
Dear friends,
as you know I'm not a professional coder, but with your help, now I am able to write hmg programs (gui), and I am very proud of that. But, when asked if hmg was OOP programming, I had to admit, that to my knowledge, hmg is not. So I had to learn that hmg is obsolete, not worth spending time to develop apps with hmg.
Up to now I had to accept these point of views.
But I stumbled across this link and that made me calm:
https://www.youtube.com/watch?v=QM1iUe6IofM
For the kind of apps I am creating, OOP gives me no advantage. I can keep my procedural programming.
Maybe it's worth to view.
Thank you
Robert
Re: OOP programming
Posted: Mon Apr 22, 2019 1:02 am
by Rathinagiri
Who said Habour is not having OOP?
Clipper is Result Oriented or Purpose Oriented.
Re: OOP programming
Posted: Mon Apr 22, 2019 8:42 am
by gfilatov
ROBROS wrote: ↑Sun Apr 21, 2019 9:57 pm
Dear friends,
as you know I'm not a professional coder, but with your help, now I am able to write hmg programs (gui), and I am very proud of that. But, when asked if hmg was OOP programming, I had to admit, that to my knowledge, hmg is not. So I had to learn that hmg is obsolete, not worth spending time to develop apps with hmg.
Up to now I had to accept these point of views.
But I stumbled across this link and that made me calm:
https://www.youtube.com/watch?v=QM1iUe6IofM
For the kind of apps I am creating, OOP gives me no advantage. I can keep my procedural programming.
Maybe it's worth to view.
Hello Robert,
If you interested in OOP programming (I'm not sure), then Minigui Extended Edition offers the OOP programming with the command
SET OOP ON
Please take a look for a small sample below:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
*/
#include "minigui.ch"
MEMVAR oMain, oWnd
Function Main
LOCAL hSplitHandle, nY, nH
**********
SET OOP ON
**********
SET CENTURY ON
SET DATE AMERICAN
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 HEIGHT 600 ;
TITLE 'MiniGUI SplitBox Demo' ;
MAIN ;
FONT 'Arial' SIZE 10
*********************************
PUBLIC oMain := ThisWindow.Object
*********************************
DEFINE MAIN MENU
POPUP '&File'
ITEM 'Exit' ACTION Form_1.Release
END POPUP
POPUP '&Help'
ITEM 'About' ACTION MsgInfo (MiniGUIVersion(), "MiniGUI SplitBox Demo")
END POPUP
END MENU
DEFINE SPLITBOX HANDLE hSplitHandle
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 85,85 FLAT
BUTTON Button_1 CAPTION '&More ToolBars...' PICTURE 'res\button1.bmp' ACTION MsgInfo('Click! 1') TOOLTIP 'ONE'
BUTTON Button_2 CAPTION '&Button 2' PICTURE 'res\button2.bmp' ACTION MsgInfo('Click! 2') TOOLTIP 'TWO'
BUTTON Button_3 CAPTION 'Button &3' PICTURE 'res\button3.bmp' ACTION MsgInfo('Click! 3') TOOLTIP 'THREE'
END TOOLBAR
END SPLITBOX
DEFINE STATUSBAR
STATUSITEM 'HMG Power Ready'
STATUSITEM ''
DATE
IF "/" $ Set( 4 )
CLOCK AMPM
ELSE
CLOCK
ENDIF
END STATUSBAR
**********************************************************
PRIVATE oWnd := oMain
IF oWnd:HasStatusBar
SetStatusbarProperties()
ENDIF
nY := GetWindowHeight( hSplitHandle )
nH := oWnd:ClientHeight - iif( oWnd:HasStatusBar, oWnd:StatusBar:Height, 0 ) - nY
@nY + 5, 10 LABEL lblClientH VALUE "Client Area Height = " + hb_ntos( nH ) + " pixels" AUTOSIZE
@nY + 25, 10 LABEL lblClientW VALUE "Client Area Width = " + hb_ntos( oWnd:ClientWidth ) + " pixels" AUTOSIZE
**********************************************************
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Procedure SetStatusbarProperties
LOCAL nItem := 2
WITH OBJECT oWnd:StatusBar
:Icon("res\smile.ico")
:Icon("res\smile.ico", nItem)
:Say(MiniGUIVersion(), nItem)
:Width(nItem, 300)
:Action(nItem, {|| MsgInfo('Status Item Click!')})
END WITH
Return
Re: OOP programming
Posted: Mon Apr 22, 2019 9:20 am
by ROBROS
Thank you for your replies, but indeed, I am not interested in OOP. As for me, I can't see any advantages to use OOP.
Regards
Robert
Re: OOP programming
Posted: Mon Apr 22, 2019 9:54 am
by Anand
ROBROS wrote: ↑Sun Apr 21, 2019 9:57 pm
Dear friends,
as you know I'm not a professional coder, but with your help, now I am able to write hmg programs (gui), and I am very proud of that. But, when asked if hmg was OOP programming, I had to admit, that to my knowledge, hmg is not. So I had to learn that hmg is obsolete, not worth spending time to develop apps with hmg.
My main development is in XBase++ ( OOP oriented) along with procedural language. The linked video gives advantage and disadvantage of both. We have to use advantage ones as per project in hand. We can not use gun to kill a mosquito.
HMG and HMG MiniGUI both allows you to code in OOP and procedural manner. It should depend on your job requirement.
And HMG is NOT obsolete. It allows you to develop for 64 bit OS in simple codes.
Regards,
Anand
Re: OOP programming
Posted: Mon Apr 22, 2019 11:25 am
by esgici
ROBROS wrote: ↑Sun Apr 21, 2019 9:57 pm
...
I had to admit, that to my knowledge, hmg is not. So I had to learn that hmg is obsolete, not worth spending time to develop apps with hmg.
...
Hi Robert
First: OOP not a programming way, simply a "style"; so we can't talk any programming language if it is OOP or not. A language may or may not
support OOP. And in programming using or not OOP never mains it is modern or obsolete.
Second: HMG isn't a compiler; a Graphical User Interface library for Harbour compiler. So we can't talk about "HMG programming" but Harbour Programming with HMG Library.
Third: If you inspect carefully Harbour documentation you will see OOP statements and functions, such as METHOD, CLASS, HBClass etc. So, Harbour fully supplying OOP,
In result everybody who using HMG for programming purpose should use Harbour compiler; and everybody who use Harbour freely use or not OOP.
Some OOP addicts claim OOP is good, so it is an advanced ( even last ) gradation in programming. This is personal and group point of view; and OOP is old than HMG, Harbour even Clipper.
Happy programming

Re: OOP programming
Posted: Mon Apr 22, 2019 2:13 pm
by serge_girard
As for me, I can't see any advantages to use OOP.
For the time being everything I programmed this far was based on the old fashioned way, which works fine, for me!
Serge
Re: OOP programming
Posted: Mon Apr 22, 2019 3:42 pm
by franco
+1
Franco
Re: OOP programming
Posted: Mon Apr 22, 2019 7:47 pm
by ROBROS
Dear friends,
many thanks for all replies, and of course I didn't have in mind hmg is not a compiler but a user interface (harbour mini graphical user interface). Though I don't know the difference oop vs procedural really, as Serge said, when the old fashioned way works, why leave it.
Another last question: a professional programmer, who knows how to program oop, would he be able to to find out (not having the source code) whether it was coded the oop-way or the "old way"? I suppose he will not be able to find out.
Kind regards
Robert
hmg is great and so is this forum.
Re: OOP programming
Posted: Mon Apr 22, 2019 8:23 pm
by apais
See this:
Procedural way:
procedure Main
step(1)
Step(2)
Steo(3)
return
OOP way
procedure Main // this pattern is usually seen in object javascript libs like ANGULAR,VUE, etc and Java
local app := AppNew()
app:var1 := whatever
app:step1 := {||step1()}
app:step1 := {||step2()}
app:step1 := {||step3()}
app:exec()
return