Jump to content
TNG Community
rcpettit

TNG php framework

Recommended Posts

rcpettit

Are there any plans to update TNG to a more modern coding style such as a MVC layout?  Don't get me wrong, I love TNG, It's my only genealogy program on my Linux computer.  But I get confused by the code jumping all over the place as I want to add a better citation system to my code.  What I'm wanting to do is have you pick a source and then it bring up the citations under that source and allow you to select it for a shared citation similar to how its done on Family Historian 6.

Share this post


Link to post
Share on other sites
fluffy82

The way TNG handles sources and citations is also one of my big frustrations. But that has got nothing to do with the programming language, but with personal choices of the programmer.

Citations and sources are already linked, so it is perfectly possible to visualise that. The developer of TNG chooses not to, for some reason.

Also making a new citation for every person is a choice. It is technically possible to link one citation to more than one person. But they chose not to.

Share this post


Link to post
Share on other sites
rcpettit

I'm learning PHP right now to be able to modify the code to allow me to do a one to many citation.  It's just most of the courses i'm taking are teaching the MVC method which seems like it's a cleaner programming style.

Share this post


Link to post
Share on other sites
fluffy82
1 hour ago, rcpettit said:

I'm learning PHP right now to be able to modify the code to allow me to do a one to many citation.  It's just most of the courses i'm taking are teaching the MVC method which seems like it's a cleaner programming style.

I must admit that before today, I had never even heard of MVC... After googling a bit, it is my understanding that PHP is preferred because

  • over 90% of all websites in the world use it
  • PHP is more complicated, but has more possibilities than MVC
  • MVC is expensive, while PHP is free

 

Share this post


Link to post
Share on other sites
Newfloridian

It's also not surprising that many a TNG user has had issues with PHP over the last few years with its incessant upgrading - each seemingly needing yet another upgrade to TNG itself. (Not that I'm looking to upgrade or move to something else thank you very much. I'm quite happy with TNG10.1.3 and PHP 7.2 - PHP 7.3 on Wampserver).

However, this seemingly well informed article I saw a few months ago might give anyone pause for thought:

The future of PHP 8 unclear

Cheers Alan

  

Share this post


Link to post
Share on other sites
rcpettit

I've read articles from the past several years saying that php was a dead language, that it was going to be replaced by other languages. But the funny things is some of those languages are dead or dying and php is still around.  I would try to learn python but I'm a hands on person when it comes to learning something new.  Almost all the tutorials for python just teach the fundamentals of the language where I learn better by building a project from scratch.  So far no luck on a tutorial for a python based website with a front and back end from scratch.  I'll keep looking though.  

Share this post


Link to post
Share on other sites
tngrlkrz
1 hour ago, rcpettit said:

I've read articles from the past several years saying that php was a dead language, that it was going to be replaced by other languages. But the funny things is some of those languages are dead or dying and php is still around.  I would try to learn python but I'm a hands on person when it comes to learning something new.  Almost all the tutorials for python just teach the fundamentals of the language where I learn better by building a project from scratch.  So far no luck on a tutorial for a python based website with a front and back end from scratch.  I'll keep looking though.  

My provider, ICDSoft, in a newsletter today, mentioned that PHP still powers 30% of all websites today.  So certainly any rumor of its death are premature, LOL.

Share this post


Link to post
Share on other sites
Robin Richmond
On 12/5/2019 at 6:39 AM, rcpettit said:

I'm learning PHP right now to be able to modify the code to allow me to do a one to many citation.

That's great.  Implementing one-to-many citations has been on my radar for over 3 years, but it scares the heck out of me.  I've written dozens of mods in the meantime; I just haven't been willing to take on that task.  That said,  I'd love to have a partner in that effort, and would be happy to work with you when you get to that task. But I have to think that it is essential that you implement other mods before trying such a complex one.  One of the tng.community forums is all about suggested improvements, and I have a long list of my own.

I've noted for years, and TNG is no exception, that it is much easier to learn the programming technology used for an application than it is to learn the details of the application itself.  In fact, I think that this is especially true of TNG, given the simplicity of PHP, and the age of TNG.  It still has a lot of old code.  One could argue for more aggressive upgrading of that old code, but that old, solid code is one reason that TNG is remarkably reliable as it is. The phrase "If it ain't broke, don't fix it" applies.  

(BTW, a number of TNG programmers and admins would laugh at that statement coming from me, since I have a deserved reputation as a practitioner of the the theme "If it ain't broke, I'll fix it". But that's a whole other story.)

I hope that you are working your way through the TNG Wiki to learn details about it.  There is also a somewhat hidden TNG Entity-Relationship diagram (it's just a documented graphic that is not tied to the actual database.) See  https://tng.lythgoes.net/wiki/index.php?title=TNG_Entity_Relationship_Diagram

 

It is going to be very hard, and may be impractical, to change something that is so deeply integrated into TNG.  For example, a significant problem with implementing one-to-many citations is that Gedcom also does not support them. In Gedcom files, which have a hierarchical structure, the entire citation is placed within an event.  Thus, when desktop applications that do support one-to-many citations create Gedcom files (and that's the only way to get outside data into TNG), they have to generate numerous identical citations; one for each event that uses the citation.

On the other hand, the Person Profile already does do a good job of consolidating source citations into what I'll call a virtual one-to-many source citation.  That is, if a person's name, birth, and residence "events" all have identical citations, then the Person Profile lists the virtual source citation once, and links the name, birth, and residence "events" to that virtual source citation.

It should be possible for the Gedcom Import process to something similar to what the Person Profile does, and create consolidated citations.  But the TNG data entry programs are a whole other kettle of fish.  And the existing model is built into Media search-and-list programs (where citation medialinks are closely related to one-to-many citations), Sources search-and-list programs, and others.

I'm not sure whether it helps or hurts that citations don't exist as objects in TNG.  Yes, there is a citations table, but it is really a linking table that connects sources to events.  You cannot look up a citation in the TNG application, nor can you find them starting with sources. All you can do is go to the person or family editor,  select an event, and look at the citations attached to that event.

Another complication is that some events reside in the People and Family tables, while other events reside in the Events table.  (Another ambition I have is to create a single list of events, but without removing events from the People and Families tables.  I think that the single list of event should come first.  That effort wouldn't be nearly as complex, and wouldn't have to integrate as deeply into TNG, since it could be very useful for analysis and reporting.) 

When it comes to integrating these two new structures into TNG, I've pretty much come to the conclusion that, to avoid large-scale restructuring of TNG, they will have to exist in parallel with the existing structures.  But I haven't figured out how deeply the new structures will need to be carried.

As I said, it's a daunting task, but yeah, I think that it would be useful, and I look forward to either helping with or watching :-) your efforts. 

- Robin

Share this post


Link to post
Share on other sites
PapaTango
On 12/5/2019 at 8:02 AM, Newfloridian said:

It's also not surprising that many a TNG user has had issues with PHP over the last few years with its incessant upgrading - each seemingly needing yet another upgrade to TNG itself. (Not that I'm looking to upgrade or move to something else thank you very much. I'm quite happy with TNG10.1.3 and PHP 7.2 - PHP 7.3 on Wampserver).

However, this seemingly well informed article I saw a few months ago might give anyone pause for thought:

The future of PHP 8 unclear

Cheers Alan

  

Incessant upgrading?  Surely you jest!  😂

If anything, I feel that Darrin errs on the side of caution rather than incessant version appeasement.  PHP is not going anywhere in the foreseeable future--regardless of the various blogging doomsayers.  If anything, the silly crush concerns extension providers (especially in the WordPress world) who introduce updates on a several times a year basis.

MVC (Model View Controller) is little more than a money-grab targeted at those who look to simplifying programming tasks in certain development milieus.  At one level, it can be seen as as an easier object development framework akin to Visual Basic--but can be spread across multiple programming languages such as Python, PHP, Ruby, C#, Java, and others.  At the end of the day, it's something that lends itself to group/team development initiatives--but ultimately still uses the aforementioned programming languages as the core of the process.  

MVC does not replace PHP--rather it is a framework to develop PHP.  Perhaps you would prefer Python--another 'doomed' but resurgent programming platform?

I would much rather prefer changes in how the SQL is engaged.  The sky is not falling on PHP, either on the platform side or the server side...  😎

Share this post


Link to post
Share on other sites
Robin Richmond

Despite his incessant misuse of "it's" the author of The future of PHP 8 unclear is accurate when he says

Quote

... for PHP to be able to be a competitive option among TypeScript, Python and other popular options for server side web development - the enhancements and backwards compatibility breaks due in PHP 8.0 will be essential.

But that's been true for quite a while, and isn't relevant to TNG.  With apologies to John Huston, Mel Brooks, and Rick Bisbee, we don't need no stinkin' object programming enhancements. 

I'm very happy that PHP is doing a better job of checking for undefined variable and subscript references, but I don't think of that as a dread backwards compatibility break. Its just a good excuse to take care of some coding problems, and improve our ability to detect coding typos!  I'm trying remove sloppy undefined variable references from my code, and I'm very grateful that Ken Roy and the aforementioned Mr. Bisbee (and whoever might be helping them) are actively addressing undefined variable references in the TNG core code.

As I think that Papa Tango was suggesting, it is also important that we use prepared statements in database queries (said the pot to the kettle).

- Robin

 

 

Share this post


Link to post
Share on other sites
fdejaigher

To be more precise

MVC is not a language nor a framework, it's a "design pattern" (a "method", a "way") for development and PHP an "Object-oriented" language (But was first written as a procedural language and can still be used like this, for further information).

To my own opinion, MVC is not the best design pattern for PHP as a client/server development, SAM (State-Action-Model) is a better way (A good article : in english  or in french)

About TNG (and also other PHP applications)

No matter how an application is developed (MVC or not, PHP or Python, Procedural or Oriented Object), as long as code is well documented (Inside with comments, Outside with a wiki etc.) you always be able to modify it the way you want. The first hard step is to understand how the main developer think and adapt yourself.

As TNG looks to developed in procedural , if you plan to convert it to use MVC design pattern and in Oriented Object, it would be easier to rewrite all !

You should also use some PHP Framework like Symfony, Laravel, CakePHP. But what looks easier using this kind of frameworks at the beginning should became more and more complex (as a major security upgrade with no backward compatibility that requires rewriting more than 60% of your code...). And you also loose the joy of pure codding as for some Frameworks, you spend more time on "configuration" (yaml)... Ok, that's my own opinion as I still prefer to use my own "framework" ;)

 

Edited by fdejaigher
More about TNG

Share this post


Link to post
Share on other sites
Ken Roy

Let us not forget that TNG is licensed software

3 hours ago, fdejaigher said:

No matter how an application is developed (MVC or not, PHP or Python, Procedural or Oriented Object), as long as code is well documented (Inside with comments, Outside with a wiki etc.) you always be able to modify it the way you want. The first hard step is to understand how the main developer think and adapt yourself.

and that Darrin has graciously allowed us to modify and that the TNG Community Forum is a user to user help forum

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×