Friday, March 27, 2009

my first cakephp interview

It was around 5:30 pm on regular friday, i moved out of office and went to a big building, i was in front of two experts for an interview, they were fat not only physically but mentally as well.

Questionnaire started with some of the questions from core php like what all functions do you use in your development can you just list them ,tell us what was that you did special in php.

after that the cakephp questions were asked. It ranged from various perspective in cakephp, i am just putting them down as i remember, order of questions would be changed as i do not remember them.
hope you get some idea from this and this helps you in your next interview

Interviewer : what is cakephp
Me : Cakephp is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. it uses commonly known design patterns like MVC,ORM within the convention over configuration paradigm, It also reduces development costs and helps developers write less code.

Interviewer : why cakephp, and why not any other framework.
Me : it has been for years in the market with strong support in the form of communities and online documentation, it supports php 4/5 , sometimes it becomes mandatory to support php4 because of client's limitation in support php5, there cakephp helps.

3. can you remember what is the directory structure when you download cakephp
* app/
o config/
o controllers/
o models/
o plugins/
o tmp/
o vendors/
o views/
o webroot/
* cake/
o config/
o docs/
o libs/
* vendors/

Interviewer : what is the first file that gets loaded when you run a application using cakephp., Me : can you change that file.
bootstrap.php , yes it can be changed , either through index.php , or through htaccess

Interviewer : using cakephp, what all are drawbacks.
Me : The learning curve, and it loads full application before it starts your task. Its not recommended for small projects because of its resource heavy structure.

Interviewer : what is model,view,controller.
Me : Model–view–controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.

Interviewer : what is the naming convention in cakephp
Me : table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.php, associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’; , foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) → users (table) , many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural: tags_users , columns in many-to-many join tables should be named like other foreign keys: tag_id and user_id , columns named “created” and “modified” will automatically be populated correctly

Interviewer : what is a component,helper and why are they used, is there other way we can do same thing, what is better.
Me: A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.

Interviewer : how do you proceed when you have to use cakephp for any application.
Me : take the framework either from cake site or if you have changed according to your needs start from there. proceed with basic software engg. concepts as requirement gathering etc

Interviewer : what is the first function that gets loaded from a controller.
Me : index

Interviewer : what is habtm.
Me : has and belongs to many is a kind of associations that can be defined in models for retrieving associated data across different entities.

Interviewer : how can we use ajax in cakephp.
Me : by calling ajax helper and then using it in controller for rendering.

Interviewer : if you have to validate a registration module for a user, what all can be possible ways , which one is the best.
Me : can be done on submission in controller, or using javascript/ajax while user is still filling the data. second option is better.

Interviewer : can you list some database related functions in cakephp.
find, findAll , findAllBy , findBy , findNeighbours , query

Interviewer : how canInterviewer : how can you include a javascript menu throughout the site. give steps.
Me : By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related veiws.

Interviewer : how can you make urls search engine friendly while using cakephp
Me : it is an automatic task that is done by cakephp.

Interviewer : do you prefer to use cakephp,yes then why ? no then why not.
Me : Its a wide question and the answer would depend upon the kind of application for which it is to be decided, if its a basic cms i would prefer to have joomla. but yes cakephp is prefered for large systems, “simplicity” is the most important factor.
you include a javascript menu throughout the site. give steps.


these were some of the questions, let me know there answers if you know any/all.
enjoy baking. I am in process of sharing with you guys a new website focusing towards my experiences including all interviews in my 10 years career.

25 comments:

  1. You done a good job, It is very useful for those who are read this page thank's a lot
    by
    Thulasidharan

    ReplyDelete
  2. Thanks Adil it really helped me to know please let me know if there are any more or if you have any sample applications for cakephp

    ReplyDelete
  3. Swamy ats said
    well done yar!!useful for others

    ReplyDelete
  4. kuch khash nahi hai.It is just copy and past

    ReplyDelete
  5. its nothing new in this
    its regular question .......
    i need typical question......

    ReplyDelete
  6. Thanks for sharing your experience adil.

    ReplyDelete
  7. what is the first function that gets loaded from a controller.
    --> before_filter()

    ReplyDelete
  8. Thanks, The above Ques and ans very usefull for me.

    ReplyDelete
  9. This is really a great post for even a person who is starting to learn the cakephp.

    I got answer to a number of questions which were in my mind like cake direcory structure ,naming conventions in cake,how to use javascript and ajax , diff b/w helper and component.

    Thanks adil

    ReplyDelete
  10. Hi

    I like this post:

    You create good material for community.

    Please keep posting.

    Let me introduce other material that may be good for net community.

    Source: Project controller interview questions

    Best rgs
    Peter

    ReplyDelete
  11. Thanks your post is very useful for us and new developers. So keep posting

    Pawan
    Software Engineer

    ReplyDelete
  12. Nice post . . Very Useful information

    Dhung.com provide interview question and answer for all company.

    ReplyDelete
  13. Thanks your post is very useful for us and new developers. further for latest interview Questions please visit https://www.onlineinterviewquestions.com/cakephp-interview-questions/

    ReplyDelete
  14. Infycle Technologies, the No.1 software training institute in Chennai offers the No.1 Selenium course in Chennai for tech professionals, freshers, and students at the best offers. In addition to the Selenium, other in-demand courses such as Python, Big Data, Oracle, Java, Python, Power BI, Digital Marketing, Cyber Security also will be trained with hands-on practical classes. After the completion of training, the trainees will be sent for placement interviews in the top companies. Call 7504633633 to get more info and a free demo.

    ReplyDelete
  15. Infycle Technologies, the best software training institute in Chennai. Perfect place to learn Big Data Hadoop Training in Chennai for experienced, and Tech professionals. And we also put up other courses like Data Science, Manual and Automation Testing, DevOps, Medical Coding, Oracle, Java, Data Science, AWS, Python, etc., at the end of the course period the pupil will be able to crack jobs on top MNC’s. for more details call 7504633633.

    ReplyDelete