All the answer so far are great - here is a (hopefully) comprehensive answer. My argument leans towards the more modern thinking that hitting should ideally be avoided and I have highlighted modern thought along with some older sources to bring out the idea - I apologise if some sources above are repeated:
By way of introduction, Shlomo Hamelech in (משלי יג:כד) writes:
“חושך שבטו שונא בנו ואהבו שחרו מוסר”
“One who spares his stick hates his child, but he who loves him disciplines him in his youth.”
This source provides the foundation for the ongoing discussion of whether it is correct to hit a child. רבינו יונה interprets the פסוק to mean that one who truly loves his child chastises him without delay. If one lets the child’s misdeed go without telling them swiftly about their wrongdoing it makes the child believe that they are free to act in an unbecoming manner. For this reason, שלמה המלך advises to take action as soon as possible. If this comes through administering a 'potsch' then it is praiseworthy because without acting in this way it will only serve to spoil the child, allowing further room for misbehaviour. Certainly, Rav Dessler זצ״ל is a firm proponent of this view, seeing hitting as an important educational tool (See מכתב מאליהו, חלק ג, 'חנוך הבנים – בענין הכאת הבנים', עמ' 360).
However, Rav Dessler’s opinion is based on the need to increase הכנעה – humility and submission in a child. He states that if a child is raised with this vital מדה of humility, hitting him will not teach him to be violent to others. It is only when children are brought up to be independent that smacking them will cause them to hit. One could argue that nowadays it is very rare to find the submissive culture that was once inherent within child-rearing. Therefore, perhaps in today’s independence-giving society even Rav Dessler would have condemned hitting. Indeed, Rav Avrohom Pam זצ״ל believed that hitting children was something that a person should distance oneself from, equating the people of older generations to metal vessels. When a vessel of this material becomes unclean, one pours boiling water over it, (akin to severe castigation), and in so doing the vessel emerges glistening and unsoiled. Yet these days, we are more like earthenware vessels. If one pours boiling water on such a vessel, the result will be a mere mud-spattered residue. (עטרה למלך, 'לימים נוראים: הרהורים בענין התשובה', עמוד קעה. Also note HaRav Gamliel Rabinowitz שליט״א, renowned Rosh Yeshiva of Shaar HaShemayim, in his sefer – טיב התורה, פרשת וירא (כב:ז), 'גם האב צריך להקפיד על כבוד בנו', עמוד רפד. Rav Rabinowitz says that in earlier generation אמונה was passed on to children via ‘the stick’, but nowadays to really succeed in חינוך, teaching must be conferred in completely the opposite manner, imbued with constant love and honour.) The implication is clear. In previous generations, rebuke was more effective when it came through the medium of a timely smack, but today, such action is likely to be harmful.
Thus the notion of hitting children has been seen as being increasingly more detrimental than positive, and various gedolim have understood the פסוק of "חושך שבטו שונא בנו" to have more symbolic undertones. Rabbi Yaakov Weinberg זצ״ל explains the word “שבטו” – “his stick” not to mean a cane with which to beat the child, but rather a promptly-timed rebuke. When a child does something wrong, a parent must be quick to provide a clear-cut admonition – this is using his שבט. If however a parent lets the moment pass, viewing it with an almost blasé interest, then he is being "שונא בנו" – “hating his son”. The key therefore, is to be cognisant of a child’s actions and to be ready to educate them should the occasion arise when reproach is necessary. If one takes care to act in this way, the child will learn the lesson quickly. Hence, R’ Weinberg concludes;
“The purpose of ‘shivto’ is not to make it painful, but to make it clear that what was done is unbearable.” (See Rabbi Doniel Frank, Rav Yaakov Weinberg Talks about Chinuch, (Targum Press – 2006) pp. 43-45 as well as מצודת דוד on this פסוק).
In much the same way, the מסילת ישרים tells us offenders should always be reprimanded, but it should be done without anger and channelled with the sole intention to set them on the right path. In cases when anger is unavoidable, it should be:
“כעס הפנים לא כעס הלב” – “Anger of the face and not anger of the heart” (מסילת ישרים – פרטי הנקיות).
רמב״ם echoes this sentiment by advising that a person should make himself,
“כאדם שהוא מדמה כועס בשעת כעסו והוא אינו כעס”
“Like a person who appears angry but is not actually angry”
(משנה תורה הלכות דעות פרק ב משנה ג).
This means to say that any anger that is vented must be done externally, accompanied with sound mind and clear educational connotations. Therefore, when addressing the above חז"ל to “strike the child immediately”, the stress is less on the striking itself, but more on the timing. It has to be quick, so that the child is not constantly fearful of a forthcoming punishment as well learning the lesson instantly. (קצור שלחן ערוך סימן קסה סעיף ז)
Hitting children is something that has a further issue that one must be weary of. The גמרא warns parents to be cautious not to hit their children for fear that they might encourage their child to hit back. The גמרא reads:
"דאמתא דבי רבי חזיתיה לההוא גברא דהוה מחי לבנו גדול אמרה ליהוי ההוא גברא בשמתא דקעבר משום ולפני עור לא תתן מכשול דתניא ולפני עור לא תתן מכשול במכה לבנו גדול"
“The maidservant of Rebbi Yehuda HaNasi saw a man beating his mature son. She said: This man should be banned because he transgresses the prohibition of placing a stumbling block before the blind. For indeed we are taught in a Beraisa: You shall not place a stumbling block before the blind, this verse refers to a man who hits his mature son.” (מסכת מועד קטן יז)
It would seem from the גמרא that if a parent hits their child they are creating the potential for the child to strike back, which will result in that child violating an אסור דאורייתא. Rashi notes that although the child may rebel and sin, the responsibility lies with the parent. Ultimately, if the parent were to exercise more control, the child will not learn the art of retaliation and will gain greater respect for their parent. However, it is important to note, how old we deem a “בנו גדול” – “mature son”? The שלחן ערוך brings this scenario down in הלכה (see שלחן ערוך יורה דעה רמ:כ) and the רמ״א says that this refers to a son aged 22 or 24 years old (The רמ״א bases his psak on the גמרא in .קידושין ל. The מהרש״ל in the first פרק of קדושין – סימן ס״ח writes that this ban can only be passed from age 24 years, but even still, is אסור from 22 years.). The ריטב״א goes one stage further. He notes that when the גמרא refers to a בנו גדול it is not necessarily a גדול, if a young child is of the disposition to respond in a similar fashion then the איסור extends to him as well. (The ריטב״א concludes, “ומשום דאורחא דמילתא דבגדול שכיח כי הוא נקט גדול” – Since such a scenario is more likely to happen with a גדול that is why the גמרא uses the term “גדול”) Rav Shlomo Wolbe adds that in this present day, if one even hits a three year old, the likelihood is that they too will hit you back! (ספר זריעה ובנין בחינוך, 'ענישה', עמוד כה) It would seem therefore, that hitting children definitely has its pitfalls. The last thing you want to do is something that will encourage your child to be violent.