Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8420501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:53:52+00:00 2026-06-10T02:53:52+00:00

In MVC, some controller functions require accessing the model before rendering a view, whereas

  • 0

In MVC, some controller functions require accessing the model before rendering a view, whereas others simply load the view.

In a blogging app, I have two functions:

public function add_post()
{
    // loads the view for adding a new post
}

public function add_new_post()
{
    // queries database and inserts post
}

I’m used to using Java, where all methods have a highly suggestive verb that describes what the method is supposed to do. So, instead of add_post(), I would use add_post_view(), and instead of add_new_post(), I would be able to use add_post().

But I’m afraid that adding “view” at the end seem redundant – but aside from that, I’d like to know what the convention is for those who like to have highly readable code. How would you go about rewriting the names of these two functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:53:53+00:00Added an answer on June 10, 2026 at 2:53 am

    For php, in general, there is no specialized naming convention or should I rather say standardized. Working for several companies over the years I have seen it all from thisismyfunction to thisIsMyFunction to this_is_my_function..

    My personal choice though, is if its internal functionality (models or controllers alike) that aren’t AJAX ready I tend to use the underscore method with a couple comments under or above each function to give me an idea. But for functions I intend to use with AJAX such as in a controller I will usually go the camel-case route. Generally speaking its all about preference on your side of it. If your more comfortable with underscore use that, if not then use camel case, or whatever suits ya.

    If this is going to be a team project, or potentially a project where either a team will come aboard, or where you expect to be bought out. I’d say go for what ever is easiest learning curve wise, last thing you want to do is bring others in or sell a product that your going to have to spend long times training people how to read through your code. Rather than collect and go, or just have them start building away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing my first application with Zendframework. My question is about the Model–View–Controller (MVC)
Introduction The Model-View-Controller approach has been in my head since before the holidays and
I'm returning some Json via a C# MVC Controller. Other browsers work fine, but
I'm trying to implement my first Spring MVC controller, following Spring documentation, some tutorials
I am trying to send a model to ASP.NET MVC controller action, but for
I'm trying to do some unit testing in MVC, however some of my functions
In ExtJS 4 the new feature is Model-View-Controller architecture. Yet ExtJs4 examples are made
I need some help with asp.net mvc Controller: <HandleError()> _ Public Class HomeController Inherits
I write JUnit tests for some Spring MVC Controllers. The initialization of the JUnit
Looking at examples and tutorials for some MVC libraries for web development on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.