When reading SQL script where there is a large amount of non-formatted SQL code, the problem becomes even bigger. Nobody likes to read a large amount of text, even when it’s just a plain one. Some time ago there was a more detailed guide (you can still see in the current one if you develop the spoiler) and no one read it as too long.This article will provide a review of SQL code formatting using the SQL formatter options in SSMS If you follow the guidelines I gave with the examples to make understand then the code would be OK, there no need of more detailed and definitive rules.Īnd, for your last sentence, very few read this topic (Hox to use code tags.) and the forum rules so we kept them very short. There can't be strict guidelines as, as I said, some prefer comma at the beginning of the line and others at the end some prefer keywords in upper case and others prefer it is for not keywords but for custom names and so on. My teachers always said a procedure should not be greater than one page (and at this time the programming languages didn't accept a line larger than 80 characters, too bad there is no more such limit in the current ones). Maybe you do not program for long enough to feel that for code.Īs I said, code should be read at a glance. we can see if it is "nice" or not but we can't defined by rules what is "nice". It is the same thing than for a painting, a landscape, a chess game. "Nice" is indeed not a scientific measure but I think we can see if a code is nice or not in the sentence "have you some pleasure to see and read it or do you want to skip it?", I don't know for how long you program but I immediately see if a code is "nice" or not before reading it. With this latter I can see at a glance what it does, with your line it is not possible for me, I have to split it (but as I am too lazy, as many other readers, I didn't even read it when you posted it). Just see the difference between your long line and the expression I then posted. Split long lines are not nice and are hard to understand. Quote: I do not think my formatting is "not easy to read" and "not nice" And we all do it as developers in our daily work. But still the question is how? Perhaps the answer is, there is no online tool to automate it, but the OP is responsible to take care of it manually as and when required. But for specific cases as quoted above, I have no clue, and I don't deny too with your points where you disagreed, not at all. So bottomline, for most of the posts, online formatter does its job. And even if we had it now, I am not sure, but it might too had to implement some logic. But, is it feasible here? We have already seen the OraFAQ's own formatter getting disabled due to impact on site's performance. That's what we did sometime ago when we had to implement a common code formatting guideline and integrate it with a client tool for code development. If you guys agree, I can provide a file which could integrate with the formatter code in OraFAQ. At least, the online sql formatter provides the basic formatting for most of the posts. I find it a daunting task and not possible to implement in general posting guidelines. OP's suggestion is about levying specific formatting rules and make it general in the forum. Perhaps, that's the reason we have the online sql formatter to take care of the "how" part. If we want, we can go beyond the points that we have mentioned till now. If you take care of the way you post your messages, other forum members will have less problems in reading them and, hopefully, helping you solve your problem. Furthermore, simple code snippet that contains 2-3 lines can be read without formatting it is proportional font (used in every message you post by default) that makes "problems" non-proportional fonts (like Courier) are easier to read when it is about code - that's why we prefer formatted code and use of tags. I don't see any difference if you post "select. To make things worse, Forms' formatter uses character which indents code well when you are in Forms, but the same code pasted here is malformed and indentation is lost. Manually formatted code is perfectly OK online formatters have their own rules, TOAD's formatter it own, SQL Developer's another ones and so on. I don't care about different formatting styles as they depend on a tool someone uses. As far as I'm concerned, any formatting is better than no formatting.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |