Pragmatic Choices – Web Application Development with WordPress and CMB2 #2

When you choose to use some kind of component you are accepting that even though this component may not be perfect, considering all the pros and cons, it’s still a better solution (in time, cost, etc.) than developing your own solution from scratch. This also means that sometimes you end up doing things that feel kind of strange, when you compare to what you would do if you were starting with a “blank sheet” of code.

How far you can stretch that strangeness usually depends on how pragmatic your programmer can be. Is he the type of guy that really just wants to get things done, even if it means you end up with some kind of technical debt or is he the kind guy that would rather work extra-time to make that code really clean, beautiful and also effective?

In our time tracking application we have, for now, 2 main dependencies, WordPress and CMB2, and we’re trying to make the most of them. This means that we’re trying to use all the functionalities they give us and also implement some requirements in a way that makes the most sense for those components.

In our 2nd week of development we’ve ran into a situation that, I think, represents this kind of choice and that has to do with Roles and Capabilities.

Reuselogo

One of the goals of our time entry application is to register on what projects / subjects our consultants worked during the day. So we have something like consultant, subject, client, date, worktime, and so on. Relevant to this issue we also have the concept of teams and team lead. A simple consultant can only register something that he did but team leaders can register entries on behalf of their team members. On our roadmap is also the idea of logging changes in records, that is register who made some change to a specific record.

There were some options to solve this. One would be to simply use post_author to record who was registering the time entry. This solution would have the added benefit of allowing the use of the WordPress capabilities and reduce the number of tables we would have to include to filter tasks by consultants, we could simply use wp_quer. But since team leaders can also register on behalf of their team members and also because we wanted to keep track of who made the changes this wasn’t possible.

The other solution would be to simply ignore post_author and create 2 post metas, one to save the user that was recording the time entry and the other to register the consultant associated with the time entry. This would be a totally viable option, and since we’re building an application to track tasks and times and we’re not really doing anything with posts there was no reason to consider fields like post_author. This option would however make some queries a bit more complex and probably more cpu intensive since we would have to include not only the posts table but also post_meta with its “infinite” number of records.

Since, after data entry, data selection and filtering is a huge part of our application, and having to reimplement all of this requirements didn’t seemed to make sense to us, we chose to use an hybrid solution and so we ended up using post_author to record the consultant associated with this time entry and we’ve created a post_meta to save the user that registered this entry. Best of both worlds? We will see, but in the meantime if you think we could have done differently feel free to tell us.

 

 

The Plugin Boilerplate Decision – Web Application Development with WordPress and CMB2 #1

It’s been some years now that I’ve played the developer role in what I can call a proper Web Application Project. In the last couple of years I’ve dealt more with project management and team organization than coding and it’s something that I’ve missed.
Not only because I like to create stuff but also because I feel that to really understand what your team is telling you, project-wise (scope, metrics, coding specificities….), you need to have a good understanding of all the process, and that includes code.
You certainly don’t have to be the greatest coder in the world but in my opinion it’s really great if can both talk your clients’ language and your team language.

So we’re developing yet another time tracking application. You have some clients, some stuff you do for them and you want get reports that tell you things like how many hours you’ve worked for them or what kind of stuff you spend most time in. Nothing pretty special, at least for now.

Since we’ve been doing website development exclusively with WordPress for the last 3,5 years and already developed some things that might be called web applications and also having tried CMB2 in a couple of projects we decided that this would be a cool project to start from scratch with this stack.

Although having developed several solutions for WordPress we still haven’t found what works for us when we’re talking about plugin development. On the last couple of projects we’ve used Devin Vinson WordPress Plugin Boilerplate but it felt a bit overwhelming for us. Consider that in this project we have what I would call a true WordPress developer, a relatively new developer which already participated in some projects but with far less engagement than our main guy, and me who haven’t been coding for some time now. We’re also developing this plugin to be used only inside the admin.

So we’ve decided to go on a bit more simpler route… but who knows, maybe when the project starts getting more complex and the team skills gets more homogeneous we’ll go to a similar structure. For now our structure is really flat with the, I think, expected css, includes and languages folders. We chose to include CMB2 in our plugin to avoid version problems and we’ve added it to the includes folder. Inside includes we also have the admin folder with all the classes we’re using right now: time-entry, client, etc.

It feels very comfortable to work with this structure but lets see what the next weeks will bring us. Do you use other plugin boilerplates? I’d love to hear from your experience.

rookie mistake of the week: forgetting to activate the plugin we’re developing and loosing some 15 minutes trying to figure out why I wouldn’t see what we’ve already developed.

(image credits: https://www.flickr.com/photos/noodle93/4652373324)

Build your web business, WP e Philip Glass Taxi Driver

DotNetRocks

Hanselminutes

Boagworld – série sobre diferentes vertentes do negócio webdesign

NPR Environment

Philosophy bites

BBC Radio 4

  • Philip Glass: Taxi Driver – Anos 70, filme de Martin Scorcese a retratar um taxista pelo submundo de nova iorque e ao mesmo tempo Philip Glass a trabalhar como taxista para pagar as contas…

NPR Planet Money

The Why Factor

LSE

Poststatus Draft Podcast

99% Invisible

(imagem retirada de It Took A Musician’s Ear To Decode The Complex Song In Whale Calls)

Digital Project Management e os anos noventa outra vez

NPR Environment

Planet Money

  • #635 Trade Deal Confidential – o que se passa nas negociações dos tratados como o TTIP e porque são sempre secretos, a minha conclusão é que é um resultado de soma zero

99% Invisible

  • Children of the Magenta – não ouvir antes de viajar de avião, ou como a automação pode ter efeitos negativos imprevisiveis

Scrum Master Toolbox

LSE

  • Inequality: what can be done? – sim é possível combater as desigualdades, mas ninguém disse que ia ser fácil
  • Is the American Century Over? – interessantes algumas comparações com a China, perspectiva interessante no que diz respeito ao crescimento da população e juventude da mesma

Matt Reports

Philosphy Bites

Boagworld Podcast

All Songs

10web

Música, Filosofia, Música, Ambiente, Música

Gilles Petterson Worldwide

Philosophy Bites

Ultima Thule

NPR Environment

LSE

All Songs +1

  • The art of streaming – discussão sobre como o streaming muda a experiência de consumo de música

Guest DJ

Boagworld

  • Handling your finances – afinal não é só em portugal que se paga tarde (embora talvez mais tarde) ou que se quer pagar o mínimo possível

Hanselminutes

10web

oPortoEmConversa

O resgate que vai acabar com todos os resgates

Ai mas os gregos derreteram mais de 200 mil milhões de euros em sabe-se lá o quê

Escolha: Vamos dar dinheiro às instituições gregas para eles pagarem aos bancos alemães e franceses que financiaram esses investimentos. Ou seja quem faz empréstimos não tem nenhum tipo de responsabilidade.

 

Agora que os nossos bancos já retiraram o que precisavam vamos mandar aquela cambada de preguiçosos à fava.

Horta na Varanda 2015 (semana #11)

11ª semana de horta na varanda, algures no Porto. Bicheza nas beterrabas enquanto os tomates estão mesmo mesmo a chegar, morangos é que nem por isso.