I would like to learn more about Java or Kotlin but haven’t had the time to sit down and learn things lately with my family’s problems. I did however make about 40 simple apps using a rapid prototyping system called rfo-basic. Some of those I would like to redo in a faster language someday. I don’t think I would like to program professionally for a company anymore. It would be really hard on my body and back to sit for a long time at a desk for hours at a time.
I confess that I do tend to write some spaghetti code right now mainly because I write most of my code on my phone and often focus on speed optimizations. I think the best thing is to plan out mock ups of the user interface and some flowcharts and objects before you even start coding otherwise things can start getting very messy as you add more features later on. Feature creep seems to be a problem for a lot of companies today and it can make software too overwhelming to learn for an average user.
I find rfo-basic syntax to be highly readable and usually don’t have too much trouble fixing my old programs. Here is a simple multitouch piano I wrote using oliBasic which is a fork of RFO:
REM Start of oliBASIC! Program
REM color piano
REM Multitouch piano
REM oliPiano by mookiebearapps@2018
samp$="c.mp3"
FN.DEF hsv2rgb(hue,saturation,value,r,g,b)
LET r=0:g=0:b=0
LET chroma=value*saturation
LET hue1=hue/60
LET x=chroma*(1-ABS(MOD(hue1, 2)-1))
IF (hue1 >= 0 & hue1 <= 1)
r1=chroma:g1=x:b1=0
ELSE if (hue1 >= 1 & hue1 <=2)
r1=x: g1=chroma:b1=0
ELSE if (hue1 >= 2 & hue1 <=3)
r1=0:g1=chroma:b1=x
ELSE if (hue1 >= 3 & hue1 <=4)
r1=0: g1=x:b1=chroma
ELSE if (hue1 >= 4 & hue1 <=5)
r1=x:g1=0:b1=chroma
ELSE if (hue1 >= 5 & hue1 <=6)
r1=chroma:g1=0:b1=x
ENDIF
LET m=value-chroma
r=r1+m:g=g1+m:b=b1+m
r=255*r
g=255*g
b=255*b
FN.END
FN.DEF rndcolor()
hsv2rgb(360.*RND(),1.0,0.5+rnd()*0.4,&r,&g,&b)
GR.COLOR 200,r,g,b
FN.END
FN.DEF DrawStrings(Strings[],StringsGR[],n$[])
! draw strings/keys
! pre:n$[] is key label
! post:
! strings[] is lower y coordinate
! stringsgr[] is graphics object
!
GR.SCREEN w,h
ARRAY.LENGTH n,n$[]
GR.TEXT.SIZE h/30
GR.TEXT.ALIGN 2
FOR i=1 TO n
IF !IS_IN("#",n$[i]) THEN n2++
NEXT
FOR i=1 TO n
IF IS_IN("#",n$[i])
sharp=1
ELSE
sharp=0
cc++
ENDIF
rndcolor()
IF !sharp
GR.RECT StringsGR[i],(cc-1)*w/n2,0,cc*w/n2,h
Strings[i]=(cc-1)*w/n2
GR.SHOW StringsGR[i]
ENDIF
NEXT
FOR i=1 TO n
IF IS_IN("#",n$[i])
sharp=1
ELSE
sharp=0
cc++
ENDIF
rndcolor()
s=0.97
IF sharp
GR.RECT StringsGR[i],s*(i-1)*w/n,0,s*(i)*w/n,h/2
Strings[i]=s*(i-1)*w/n
GR.SHOW StringsGR[i]
ENDIF
NEXT
FN.END
! main
TTS.INIT
SOUNDPOOL.OPEN 15
maxt=6
GR.OPEN 255,0,0,0,0,2
GR.SCREEN w,h
ARRAY.LOAD stringf[],261,277,293,311,330,349,370,392,415,440,466,494,261*2,277*2,293*2,311*2,330*2,349*2
ARRAY.LOAD strings$[], "C","C#","D","D#","E","F","F#","G","G#","A","A#","B","C","C#","D","D#","E","F"
SOUNDPOOL.LOAD cnote,samp$
ARRAY.LENGTH nstrings,stringf[]
DIM Strings[nstrings],StringsGR[nstrings]
DrawStrings(&Strings[],&StringsGR[],strings$[])
GR.RENDER
nbtns=nstrings
DIM btnList[nbtns],f[nbtns]
FOR i=1 TO nstrings
btnList[i]=Stringsgr[i]:f[i]=stringf[i]/261
NEXT
DIM stream[nBtns],tt[12],state[nBtns],oldstate[nBtns]
GR.COLOR 0,0,0,0
GR.CIRCLE p,0,0,2
GR.SHOW p
GR.SET.STROKE 5
w2=w/2
soff=0
sspan=w
bye=CLOCK()
hold=CLOCK()
TTS.SPEAK "piano loaded"
! main loop
DO
LET nt=0:GR.ARRAY.TOUCH tt[],nt:LET nt=nt*2-1
IF nt=-1 & CLOCK()-bye>30000
D_U.BREAK
ENDIF
ARRAY.FILL state[],0
FOR i=1 TO nt STEP 2
LET x=tt[i]:LET y=tt[i+1]
GR.MODIFY p,"x",x,"y",y:GR.RENDER
FOR j=1 TO nBtns
IF GR_COLLISION(p,btnlist[j])
LET state[j]=1
LET oldkey=key:LET key=j
F_N.BREAK
ENDIF
NEXT
LET bye=CLOCK()
NEXT
IF nt=1 & oldnt=1 & key=oldkey
IF CLOCK()-hold>3000
TTS.SPEAK REPLACE$(strings$[key],"#","sharp")
hold=CLOCK()
ENDIF
ENDIF
IF nt<>1 THEN LET hold=CLOCK()
FOR j=1 TO nBtns
IF state[j]&!oldstate[j]
SOUNDPOOL.STOP stream[j]
LET l=j/nStrings:LET r=1-l
SOUNDPOOL.PLAY stream[j], cnote,0.9*l,0.9*r,1.0,0,f[j]
GR.MODIFY btnlist[j],"alpha",255
ENDIF
IF !state[j]
! SOUNDPOOL.STOP stream[j]
GR.MODIFY btnlist[j],"alpha",200
LET oldstate[j]=0
ENDIF
NEXT
ARRAY.COPY state[],oldstate[]
IF ++cy=4 THEN GR.RENDER:LET cy=0
LET oldnt=nt
UNTIL 0
TTS.SPEAK "exiting"
EXIT
ONBACKKEY:
EXIT
ONBACKGROUND:
IF BACKGROUND() THEN GR.CLOSE:EXIT
BACKGROUND.RESUME