# H.O.O.P. (Hope) - Homey Object Oriented Programming

**URL:** <https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709>\
**Category:** Apps\
**Tags:** app, tools, flow\
**Created:** [March 4, 2021, 6:22pm UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709 "2021-03-04T18:22:00Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [March 29, 2021, 6:03am UTC](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709/15 "2021-03-29T06:03:31Z")

</div>

Hey Peter,

> I see you use two cards for If Then:  
> `IF (all cards until THEN are true); Operator = AndAlso &&`  
> and then this card:  
> `THEN`
> 
> But this card does the same and has the THEN operator included:  
> `IF the next X cards are true THEN execute the X cards after that; Operator = AndAlso &&`
> 
> To me the first way is somewhat clearer to read, because there is a THEN operator card visible, which isn’t the case with the 2nd case. I think in hindsight it’s a bit more difficult to ‘read’ the flow steps.  
> Is it matter of ‘taste’, what you like? Or an other idea behind it?

Well, it indeed is kind off a taste thing yeah.  
For complex statements, i would advise to use the “normal” IF, THEN, ELSE and END IF cards.

The thought after IF-THEN and IF-ELSE-THEN (and i am creating a ELSE-THEN) cards, is “single line” statements.

[IF-THEN statements | Homey](https://homey.app/nl-nl/flow/AivzYx/)

When you fill a string/text with a lott of **possible values** , it usually means a lott of single-line-statements, like this:  
IF vaccuumbin is Full THEN str = str + “Bin is full!”

If you program block-statements, you need 5 cards for this.

- IF
- condition
- THEN
- execution
- END IF

This just felt wrong to me, because i would be using this a lott (programming single-line IF-THEN statements.

With the IF-THEN, you just need 3 cards:

- IF the next 1 card is true, execute the next 1 card
- condition
- execution  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/4/94a95fee22ca0cd73a923e44da7087da98a6fe60.png)

And when i made it, i thought: why would i fix it to The next card and the Card after that?  
So i bould it so you can set the the amount If/Then cards yourself 🙂 Its just more flexable that way.

In big string-collection flows, these IF-THEN and IF-ELSE-THEN cards are a real space-saver and therefor performance-saver (on the Homey mobile App anyway).

But for any other use then simple IF-THEN (string) collection flows, i would advise to use the IF and THEN cards, as, indeed, this is more clearly readable and less error prone.

---

_[View the full topic](https://community.homey.app/t/h-o-o-p-hope-homey-object-oriented-programming/43709)._
