Welcome Guest, Not a member yet? Register   Sign In
Naming & overthinking
#1

(This post was last modified: 12-24-2023, 10:19 AM by HarmW94.)

Hi, I'm curious how you name classes, functions, variables, etc. Sometimes I notice that this can get in the way of my speed because then I start to think too hard, even though hardly anyone sees the code. But I like an overview and a standard naming for a project. This is normally how I should do it, for example:


Database (users):
  • userId
  • userEmail
  • userFirstName
  • userLastName
  • userLastSeen
  • userCreatedAt
  • userUpdatedAt
AuthController:
  • logoutHandler
  • loginHandler
  • forgotPasswordForm / (or) authForgotPasswordForm
Arrays/variables etc.:
  • $user = new User();
  • $userInfo = $user->where('userEmail', $this->request->getVar('userEmail'))->first();
  • return redirect()->route('forgotPasswordForm')
  • $routes->get('forgot-password','AuthController::forgotPasswordForm',['as'=>'forgotPasswordForm']);
So I actually use the same namings in both the Controllers/Models and in views/HTML etc..

Is that useful or could I run into problems? This is clear for me because I know exactly where to go if a problem arises somewhere. I'm curious how you guys do this!
<?php echo "Programming and perfectionism sucks sometimes..."; ?>
Reply
#2

(This post was last modified: 12-24-2023, 10:40 PM by InsiteFX. Edit Reason: Spelling Error )

Models - UserModel

Classes - Users

Variables - userID - userName - etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB