OOP programming

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

ROBROS
Posts: 164
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 50 times
Been thanked: 13 times

OOP programming

Post by ROBROS » 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.

Thank you
Robert

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Mon Apr 22, 2019 1:02 am

Who said Habour is not having OOP?

Clipper is Result Oriented or Purpose Oriented.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
gfilatov
Posts: 642
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 24 times
Been thanked: 216 times
Contact:

Post by gfilatov » Mon Apr 22, 2019 8:42 am

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
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

ROBROS
Posts: 164
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 50 times
Been thanked: 13 times

Post by ROBROS » Mon Apr 22, 2019 9:20 am

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

User avatar
Anand
Posts: 387
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 105 times
Been thanked: 56 times

Post by Anand » Mon Apr 22, 2019 9:54 am

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
Image

User avatar
esgici
Posts: 4508
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 385 times
Been thanked: 111 times
Contact:

Post by esgici » Mon Apr 22, 2019 11:25 am

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 :)
Last edited by esgici on Mon Apr 22, 2019 3:44 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D

User avatar
serge_girard
Posts: 2310
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 553 times
Been thanked: 116 times
Contact:

Post by serge_girard » Mon Apr 22, 2019 2:13 pm

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

franco
Posts: 335
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 10 times

Post by franco » Mon Apr 22, 2019 3:42 pm

+1
Franco
Franco Bushie
Canada

ROBROS
Posts: 164
Joined: Thu May 25, 2017 6:30 pm
DBs Used: DBF
Has thanked: 50 times
Been thanked: 13 times

Post by ROBROS » Mon Apr 22, 2019 7:47 pm

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.

User avatar
apais
Posts: 305
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 49 times
Been thanked: 28 times
Contact:

Post by apais » Mon Apr 22, 2019 8:23 pm

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

Post Reply