think tank forum

ttf development » mvc needed

lucas's avatar
11 years ago
link
lucas
i ❤ demo
this forum's code base is getting large enough that the whole procedural thing is really annoying.

mvc needed! trying to get my privacy feature online first, though ( see r434 - r437 ).

+1 for bsdlite. :)
asemisldkfj's avatar
11 years ago
link
asemisldkfj
the law is no protection
django? rails? or are we talking php mvc?
lucas's avatar
11 years ago
link
lucas
i ❤ demo
php mvc, most likely. naturally, this would take me years or would never happen.

if i did mvc, i'd want to do it correctly, which would take me a lot of time and some learning. procedural has no rules, so i can be fairly ghetto and feel kinda alright about it.
bsdlite's avatar
11 years ago
r1, link
bsdlite
thinks darkness is his ally
one step at a time. just make sure you're taking the right ones!

1. run all of your tests and make sure they still pass
2. add a test for an existing feature that isn't covered
3. refactor the code related to that feature
4. run all of your tests and make sure they still pass

start with tests at as high a level as you can manage--in the case of ttf, go for selenium-based tests that'll run against the DOM. that way you can hack around at the underlying code and improved it while keeping the output the same.

once you get all of your spaghetti out of the markup, then write tests of your underlying functions. once you factor your functions into types, write tests of your types. suddenly--months later--you have a well-tested, well-designed piece of software.
lucas's avatar
11 years ago
link
lucas
i ❤ demo
correction: "suddenly--years later--you have a well-tested, well-designed piece of software."
Carpetsmoker's avatar
11 years ago
link
Carpetsmoker
Martin
I think you should rewrite ttf in lisp.
bsdlite's avatar
11 years ago
link
bsdlite
thinks darkness is his ally
do it! better yet, use clojure with noir
bsdlite's avatar
11 years ago
link
bsdlite
thinks darkness is his ally
anyway... are you on a deadline or something?
lucas's avatar
11 years ago
link
lucas
i ❤ demo
haha, no. we'll see what this summer brings.
lucas's avatar
10 years ago
link
lucas
i ❤ demo
man, this is intimidating. looking over some frameworks, i feel like they're either minimal and restrictive (so i'd have to try to figure out how to neatly deal with issues), or they're extensive and complex (so i'd have to spend a lot of time learning framework-specific details).

hrmph.
Carpetsmoker's avatar
10 years ago
link
Carpetsmoker
Martin
You don't really need a framwork. Use a template engine (I like Twig) and some DB abstraction (redbean looks interesting. Doctrine is also used a lot).
All you need to do yourself is make some basic routing code (never found any decent PHP lib for that, it really simple and often complicated way too much IMO).
lucas's avatar
10 years ago
link
lucas
i ❤ demo
well i don't really need that, either! procedural code works perfectly fine.

my point is that to adopt a framework, template engine, db abstraction, or anything else, i'd need to do a lot of research to decide on the optimal choice for ttf. probably something light and flexible.

i would never abstract my db. ttf should only ever use a a hundred or two queries max, and i like to optimize them. plus, some of my queries are a bit complex at times.
andre's avatar
10 years ago
link
andre
I think http://laravel.com/ is the most trendy PHP MVC framework these days.
lucas's avatar
10 years ago
link
lucas
i ❤ demo
haha, the laravel documentation prompted me to say "or they're extensive and complex"

codeigniter prompted the "minimal and restrictive"

i think my problem is that i'm so damn particular about everything. i should probably just give one of them a shot and try to code up a basic, well-architected ttf implementation.

with that said, i'd really need someone to critique my code, because it will need a lot of criticism before it approaches "well-architected!"
asemisldkfj's avatar
10 years ago
link
asemisldkfj
the law is no protection
help me make a card-/caldav client with luasocket instead.
Carpetsmoker's avatar
10 years ago
link
Carpetsmoker
Martin
Also, I think we need a better web browser. Maybe you could do that in between?
lucas's avatar
10 years ago
r2, link
lucas
i ❤ demo
asemi: why lua?

i'm hoping that you want to build a nightstand internet appliance!

features
(1) prints the day's agenda when you press the button
(2) sounds an alarm and prints your agenda when "wake up" is scheduled in your calendar
(3) displays the local internet time on a large lcd

hardware
raspberri pi ($30)
lcd with keypad ($25)
thermal printer ($60)

software
caldav client using luasocket accesses your calendar. it polls your calendar for events called "alarm." at the time of the alarm event, it prints your agenda for the day and it sounds an alarm. your agenda may be printed by pressing a button. the alarm may be postponed or turned off by independent buttons. time is kept using ntp and displayed on the lcd screen.

costs as much as a twemco clock, though. :(

i don't know why else you'd want a caldav client with luasocket. i'm eager to hear why, though!
asemisldkfj's avatar
10 years ago
link
asemisldkfj
the law is no protection
I don't know why I said client; I meant server. I was bumming on radicale because it doesn't support SQL auth but I think it's probably a better idea just to implement it than start a server from scratch.
asemisldkfj's avatar
10 years ago
link
asemisldkfj
the law is no protection
oh and that xmpp server prosody that I love is written in lua, so it was on my mind.
Carpetsmoker's avatar
10 years ago
link
Carpetsmoker
Martin
> I think http://laravel.com/ is the most trendy PHP MVC framework these days.

I used this yesterday & today to create an app, it's interesting and definitely has some good parts, but also has some not-so-good parts & silly quirks (like commandline tools giving me JSON output).
lucas's avatar
10 years ago
link
lucas
i ❤ demo
bsdlite, what php frameworks would you recommend that i look into?

i'm thinking about implementing a basic personal site using three different frameworks, just to feel them out.
bsdlite's avatar
10 years ago
link
bsdlite
thinks darkness is his ally
just to start with a definition: "framework" is basically inverse of "library." libraries give you utilities and tools that you use in your own code; you call them. frameworks provide almost-working features and then allow you to fill in the blanks; they call you.

here's a "framework" i wrote like a year ago to support a recipe/ingredients-tracking site i was making for personal use:

https://github.com/rgantt/pandora-mvc

it's a "framework" because it dispatches requests for pages like "index.php?page=PAGE&action=ACTION" to "Controller" methods like PAGE::ACTION() while also providing a PDO to the controller instance. you set up pages like "views/ACTION.html" and "views/ACTION.json" that are returned based on the value of the accept-type header in the request.

it's "M/V-C" in the most basic sense since there is one data source (the PDO) that can be represented multiple ways (html, json).

i don't recommend using it for anything serious, but it's pretty small and i think you would appreciate seeing a self-contained solution instead of grinding through the documentation on some community-owned thing anyway.

shout out and i can show you the actual framework consumer, too (it's a private repo)

(sorry, not sure about the more broadly-used shit)
lucas's avatar
10 years ago
link
lucas
i ❤ demo
yeah, i'll check it out.
Carpetsmoker's avatar
10 years ago
link
Carpetsmoker
Martin
> recipe/ingredients-tracking site i was making for personal use:

Did you finish this? I've been considering making something like this for a few months.
bsdlite's avatar
10 years ago
link
bsdlite
thinks darkness is his ally
i finished it enough that my girlfriend and i use it to keep track of the recipes we like (it's basically a chrome addon + website for aggregating recipes from other sites), generate menus based on them, and track their ingredients! we've been using it weekly for just over a year now. i haven't put much work into it since the first deployment :(

like always, i found myself endlessly redesigning the backend code and, being a terrible frontend designer, lost interest in the overall UX stuff. oh well!
lucas's avatar
10 years ago
r1, link
lucas
i ❤ demo
is it on github? i've been wanting something similar that i can use. i also want it to use my barcode scanner so that it can conveniently track my ingredient inventory.
bsdlite's avatar
10 years ago
link
bsdlite
thinks darkness is his ally
nope, it's in a private bitbucket repo. lemme know and i can give you read perms
lucas's avatar
10 years ago
link
lucas
i ❤ demo
don't want to make it public?
bsdlite's avatar
10 years ago
link
bsdlite
thinks darkness is his ally
my current employer frowns on things like that
Carpetsmoker's avatar
10 years ago
link
Carpetsmoker
Martin
http://vitavalka.cz/img/open-source.jpg

Also, I had a dream about ttf last night; I don't remember exactly, but the forums were all different...
Carpetsmoker's avatar
9 years ago
link
Carpetsmoker
Martin
Development of ttf would be *much* faster if you would wear a shirt from http://mytailor.com
asemisldkfj's avatar
9 years ago
link
asemisldkfj
the law is no protection
hahahaha
bluet's avatar
6 years ago
link
bluet
> i'm hoping that you want to build a nightstand internet appliance!

https://www.hmazter.com/2013/05/raspberry-pi- … abelwriter

:>