Coding conventions for SERVLETS

Where to find coding conventions for Java Servlets ?

Why would they be any different from the coding conventions for all of Java?
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

Similar Messages

  • Sun coding conventions for documentation are horribly outdated!

    Seriously I have seen 10 different formats on searching that look way better and the fact the conventions on display from sun date to 1999 is very confusing.
    Can I ask which is preferred (I am doing the SCJD and here is an example of format vs format)....
    For beginning class comments.
    * @(#)Contractor.java
    * Version 1.0.0
    * Date 27/03/2009
    */vs
    * @(#)Contractor.java    Version 1.0.0    Date 27/03/2009
    Methods
    * Sets the record number for the Contractor record.
    * @param recNo A <code>Integer</code> containing the record number to be
    * set.
    */vs
    * Sets the record number for the Contractor record.
    * @param recNo     A <code>Integer</code> containing the record number to be set.
    */Edited by: Yucca on Apr 5, 2009 7:12 PM
    Edited by: Yucca on Apr 5, 2009 7:14 PM
    Edited by: Yucca on Apr 5, 2009 7:17 PM

    * Returns an Image object that can then be painted on the screen.
    * The url argument must specify an absolute {@link URL}. The name
    * argument is a specifier that is relative to the url argument.
    * <p>
    * This method always returns immediately, whether or not the
    * image exists. When this applet attempts to draw the image on
    * the screen, the data will be loaded. The graphics primitives
    * that draw the image will incrementally paint on the screen.
    * @param  url  an absolute URL giving the base location of the image
    * @param  name the location of the image, relative to the url argument
    * @return      the image at the specified URL
    * @see         Image
    public Image getImage(URL url, String name) {
         try {
             return getImage(new URL(url, name));
         } catch (MalformedURLException e) {
             return null;
    }This was taken from... [http://java.sun.com/j2se/javadoc/writingdoccomments/#format]
    And this...
         * ...method doSomethingElse documentation comment...
         * @param someParam description
        public void doSomethingElse(Object someParam) {
            // ...implementation goes here...
        }from [http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html] Notice how the @param docs differ and both are from sun! So Jwentling Mr. know it all which one must I follow? And this is not THE ONLY ONE WHERE SUN contradict their own conventions, leaving people like me asking here! Go moan at them for not being precise.

  • Conventions for the whole project

    We have coding conventions for Java language. But is there any conventions (or best practices) defined for a whole Java project. Like store all your source files in "src" folder, store your jar files in "lib" folder, have your binary files named as "all-lower-case.sh" and store them in "project/bin", etc. These may not be the case with every Java project on the planet, but has anyone blogged about these "guidelines"? If you have a tip or two, or if you had come across a blog or a related post regarding this, please do share.
    Thanks!
    Srikanth

    georgemc wrote:
    If you're concerned, form a SIG (special interest group) of your most trusted developers (no management) to come up with an agreed-upon spec, and publish it on your intranetThis is a very good idea, what I don't want to do is to reinvent the wheel entirely. We had formed a SIG before and came up with our own standards. But it was totally different from what most of the industry does. So I am just looking for a basis on which we can tweak. I am looking forward for the standard set of guidelines that are already followed which I am not aware. For example, we were storing our documentation under a directory called "docs". But throughout the industry, the standard practice is to store under "doc" (singular form). Another example I can think of is the jar file naming convention. We were naming our jars as ourApplication.jar, whereas I realized over a period of time that the jar files are named as our-application-1.0.3.jar
    From where did the others learn about these guidelines? I would be happy to read them and follow.
    Thanks again,
    Srikanth

  • Flex 2.0 Naming an Coding Conventions

    Hello,
    I'm new with Flex 2.0 and Actionscript 3.0.
    They asked me to define naming and coding conventions for
    Flex 2.0 and Actionscript 3.0 for our company.
    I'm looking for documents for naming and coding conventions
    for Flex 2.0 and Actionscript 3.0 so I can make conventions for our
    company.
    Who can help me?
    Thanks in advance.
    Simson

    I think you could do one based on Sun's coding convention for
    Java, since the syntax is similar. Take a look at the Java
    convention and you'll get a pretty good idea

  • Java style and coding conventions

    Hello All,
    Most of my programming experience is in Java, and as such, I try to conform to the style and coding conventions that are used in all of the Sun tutorials, and to my understanding, the specification. I'm enrolled in my final semester of a bachelor's of computer science and engineering, and one of my courses is "Software Engineering". Our course assignment is to make a website, written in PHP. I don't really care for PHP, so I volunteered for the Code Quality Assurance team, thinking, I'm fairly consistent when it comes to adhering to the Java conventions, it should be reasonable to determine similar conventions for this project, and give my classmates pointers on how to improve the readability and layout of their source listings.
    The problem is, my professor, absolutely, whole-heartedly hates Java. He despises everything about it. For example, I sent him a source listing that I felt was well written, readable, and adequately documented. Some of the things that I was "doing wrong" were:
    1. Naming Conventions
    All of the Classes were first-letter capitalized, subsequent first-letter of each word capitalized. FormLayoutManager was one particular example. All instance or primitive identifiers were first-letter lowercase, subsequent first-letter capitalized, so an instance of FormLayoutManager could be formLayoutManager, or menuLayoutManager, etc. All constants were all capitals, with underscores separating each word. MAXIMUM_POWER. All methods were first-letter lowercase, subsequent first-letter capitalized, showLoginComponents().
    My Professor insists that the convention I (and most of the Java community as far as I can see) is terribly unreadable, and that all instances variables and method names be first-letter capitalized. I tried explaining that this sacrifices the ability to easily distinguish between a class type or interface, and an instance, and was ignored.
    2. Declaration and Initialization
    Also, supposedly declaring a local identifier and initializing it in the same line is some sort of abomination of everything sacred in programming. So I found myself constantly doing things like
    public String info() {
      StringBuilder info;
      info = new StringBuilder(512);
      // append a bunch of information to info
      return info.toString();
    }3. 80 Character line widths
    He wants me to break any statement that is over 80 characters in width into multiple lines. I know a long statement wrapping around in your editor is a irritating, but 80 characters, seriously, who doesn't have an editor that can't handle more than 80 characters on a line?
    4. this and argument names
    In most of my constructors that accept arguments, I would usually do something like
    public Student(String name, int age) {
       this.name = name;
       this.age = age;
    }Which he thinks is horribly confusing, and should be
    public Student(String n, int a) {
      name = n;
      age = a;
    }5. singular collections / arrays identifiers
    I had something like:
    String[] keywords= new String[] { "new", "delete", "save", "quit" };
    for (int i = 0; i < keywords.length; i++) {
       System.out.println(keywords);
    And he insisted that "keywords" be renamed "keyword", as in, the i-th keyword, which I think is kind of stupid because the array is an array of keywords, and having a singular identifier makes that less obvious.
    It's driving me crazy. It's driving everyone else in the class crazy because they're all mostly used to Java style conventions as well. I've tried pleading my case and I can't even get him to acknowledge the benefits of the "alternative" styles that I've used in my programs up to this point.
    Have any of you had to deal with either professors or bosses who have this type of attitude, whether it be towards Java or any other language? This guy has been involved with computer science for a while. I think he's used to Pascal (which I know nearly nothing about).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You will find people who will disagree about this stuff all the time. I had a similar course and we read "Code Complete" which offers some style suggestions. Fortunately, my professor was intelligent enough to allow a discussion of these styles and I had a chance to argue against the "bracket every if statement" idea and other little things I didn't agree with. It was insightful conversation, rather than a "I'm the professor, you're a student, so listen to me".
    Here's the important part: It doesn't matter what the standard is, only that there is one.
    Unless I misunderstand, he allowed you to take on the responsibility of QA, so it is ultimately your decision. If the project suffers because of poor quality of code, it will be on your head. If, on the other hand, you give in to him and use a style that makes no sense and the project suffers because of poor code, it will still be on your head.
    So he really has no position in this because he is not a stakeholder in this decision. Tell him that this is your responsibility and you need to make the choices that are right for your group, not right for him. If he's teaching you anything that can reasonably be called software engineering, he should understand that. Otherwise he's just teaching out of a book called "Software Engineering" and doesn't know anything (or so it seems from this small window you've given us).
    caveat: If he's reviewing the code and he's particularly snarky about his "styles", you might want to consider giving in to his demands for the sake of your grade. Sad reality.

  • What's up with the Sun Java coding convention

    I thought Sun leading the Java development should also be a better example on the Java coding convention.
    They do publish a coding convention guide, I believe. But looking at Java core library's source code, so long, coding convention! :(
    Just looked at ArrayList.java source for the version 1.4.2. There are method names like RangeCheck(). Shouldn't a method start with lowercase? Shouldn't a method be verb first like checkRange() instead?
    And there are statements like this all over the place:
    if (foo)
    bar();
    shouldn't that be:
    if (foo) {
    bar();
    man, I thought this golden version of the Java Foundation Library code should be almost perfect by this time now. :(
    --

    if (foo)
    bar();
    // I think the most important part of the if statement
    is the condition for executing the following
    statement(s).
    // Using this style the condition is separated from
    the code by white space which I find easier to read
    // It's also easier to maintain as you don't have to
    remember to add {} if you need to add additional
    statements.I follow camickr's example. I think it's more readable. Whitespace is a good thing, IMO, and not used enough. Putting the brace on the next line down not only makes it easier to associate opening and closing braces visually but it sets the block of code off visually from the rest. Personally, I get a gestalt effect from that.
    I don't worry about a byte here or there. It might sound like heresy, but Moore's Law makes memory and disk space cheaper and more plentiful all the time. I think maintainability and readability trumps being miserly about bytes in my thinking these days. ;)
    Spare me the "inefficiency" lectures. I know - performance matters. The 80/20 rule says that byte won't be killer.
    It's too bad that Sun doesn't follow their own conventions. Don't they do code review there?
    Joshua Bloch didn't follow the standard? Too bad - he did a great job on the collections design. Maybe he delegated it to a younger coder and missed that during the code review. Yeah, that's it! ;)

  • Suns standard classes use of constants - bad coding convention

    Wasn't sure where to post this, it didn't quite fit into Java Runtime Environment or Java Virtual Machine forums.
    I was browsing through The Java Standard classes and was amazed by their use of constants. Throughout the codes there is inserted direct constants in the code without any use of global constant declarations.
    Eg: java.lang.StringCoding:
    All over the code is inserted "ISO-8859-1" (used as default encoding) directly instead of using a declared constant DEFAULTENCODING. What if Sun want to change default encoding?
    Seems strange to me that such coding conventions are used by Sun. Any reason for this or just sloppy programing?
    Gil

    Looks like sloppy programming to me. I see no possible
    reason for it. You're not the first person to
    criticise Sun's source code. Maybe they outsourced it
    to http://www.newtechusa.com/PPI/main.asp (I can never
    remember how to format links, no matter how often
    people tell me!)
    RObinThere's logic in getting primates to program.
    Based on the popular theory that an infinite number of monkeys could
    randomly produce the works of Shakespeare, they could also produce the perfect software implementation of any given problem. The downside being that the printed documentation will be smeared liberally with faeces.
    regards,
    Owen

  • JSP coding conventions document?

    All,
    I'm teaching a spring 2004 courses on JSP at Park University and I'd like to have a coding conventions document. I have one for my Java, HTML, and C++ courses and they're very helpful. In doing a Google search, I found this Sun article:
    http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/
    It looks very promising, but it suddenly stops after only 2 pages. The article says:
    [We'll] address file names and organization, indentation, comments, directives, declarations, scriptlets, expressions, white space, naming conventions, and programming practices. As this is our first attempt at presenting a set of JSP coding conventions, we're quite interested in any feedback you may have on these recommendations. Please send all feedback to [email protected]
    But the article stops after covering opening comments. I've sent an e-mail to the authors, but no reply yet.
    Please help ASAP because I need to get squared away by the end of this coming week (1/9).
    Thanks,
    John

    This article used to be much longer. I read it not long ago.
    There was an original post about it here: http://forum.java.sun.com/thread.jsp?forum=45&thread=363196&tstart=540&trange=15
    Don't know what happened to it. And after a quick google haven't managed to find it mirrored anywhere.

  • Java Coding Conventions -  Debugging

    I am developing a Coding Convention document for a group of folks that are doing some remote development for me and while I have reviewed the Java coding conventions provided by Sun, I haven't seen anything that talks specifically about debugging. I have been asked to include some recommendation concerning where (and when) to put debuggin messages within the code (i.e. when you enter a method, etc.) Are there any conventions around this? I have my own practices but I am looking to find a commonly used industry approach. Thanks

    By debugging messages you mean comments? This is all I found in the doc:
    "Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken."
    I doubt that helps :P As far as an industry standard, not much out there that I could find.

  • Is there a Color-codi​ng Convention for ICONs in LabView?

    Some times I am puzzled with 16Million color to code my subvi's ICONs. I wonder if there is a Color-coding convention that I could use to specify the right color for my subvi's. If someone has figured out a way to do that please let me know.

    Somewhere along the line I ran across a standards document that did suggest different colors for different type of functions. I found this to suitable for very basic applications but in more complicated applications the color coding does not quite cut it. An example would be a system where you are integrating a half dozen type of devices. Using the same background color for all of the I/O icons will quickly render your hiarchy window rather useless!
    The next issue with the color schem to represent functionality you run into is the higher level VI that do a little of this and a little of that. The standard then suggests using border colors to represent functionality. This becomes a problem in one of two ways. On large screens (like those typically used by LV developers) the adjacent colors of a border are percieved as a mixute of the two border colors. The fix to this would be to use wider borders. This inevitably lead to all of the high level VI all looking like they were dveloped by someone on LSD who was into the time tunnel effect!
    I will generally encourage developers to take the time to put together a meaningful icon. LV will let you drop cut and pated BMP's into the icon editor. IF there is an logo or a picture of an instrument avaliable somewhere, I grab it and use it fot the icon. This approach makes it possilbe for other developers to take a quick look at teh hiarchy and be able to narrow things down quick to the sub-VI associated with that image.
    I also encorage tehm to get used to composing their own icons. The icon editor may not be slickest tool in the world but the icons on the diagram end up being small enough that you do not need to be an artist to get the idea across. Durring my last project I wanted to use a scroll icon for all log related functions. I was curious if I could put one together fast. Start to finish to took less than three minutes. Three minutes of effort is well worth it when your are looking at a hiarchy with 500+ VI's!
    Too illustrate let me relate an experience. My wife (a non-wireworker) looked at a icon I just dropped on my diagram that had a crude cartoon face with the word "NEW" above it. She said "New User?". I flet I had accomplished my task.
    Encouraging art in LV,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Standard (ABAP coding) delivery for SES in CRM 2007?

    Hello,
    I found the Netweaver functionality "Search Engine Service (SES)" on help.sap.com.
    This function sounds great. Documents on SDN (like "https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/21404ae5-0601-0010-0395-a6d917099f1a" and "https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261") tell that this functionality is part of Netweaver ABAP and that there're already ready-to-use implementations for business objects in SAP ERP.
    However, we're using CRM and want to extend the search functionalities using SES. I was able to create an index for business object BUS1006 (business partner) and insert some data, search for it, and so on. However, it was necessary to do all the data selection manually.
    I found enhancement spot COM_PRODUCT_SE which seems to deal with the product search using SES. I tried with business object BUS1006 where enhancement spot HRHAP00_SES seems to be used - however with no (sample) implementation. When creating/updating an index using report COM_SE_DISPATCHER, the methods of the corresponding BADI implementation are called to retrieve object IDs, attribute names, attribute values and so on. As described before, this seems to be not delivered by SAP standard, thus, we have to do the coding in methods IF_HAP_SES_BUSOBJ_AESGET_ATTRIBUTE_NAME_LIST, IF_HAP_SES_BUSOBJ_AESGET_ATTRIBUTE_VALUES, IF_HAP_SES_BUSOBJ_AES~GET_OBJECT_ID_LIST on ourselves?
    So my question is: Is the ready-to-use implementation of SES for CRM business objects already contained (and I didn't find it) or will it be part of further shipments?
    Many thanks & regards
    Wolfgang

    Hi Wolfgang,
    unfortunately, CRM did not include the SES methods in all their objects.
    CRM will focus on enabling their objects on "Embedded Search", which is basically "the next version of SES" that will beavailable for Business Suite 2008 applications. This will then also enable CRM content to be searched through SAP NetWeaver Enterprise Search.
    Of course you can - in the meantime - attempt your own implementation of SES for CRM objects. Unfortunately, I am not the right guy to further help with coding details for that.
    Best, Karsten

  • What is the "Count" property for Servlet in Console?

    Wondering what the "Count" property for Servlet means in the Console. Is it instances
    or current uses? In other words, if the number is >1 does this mean that the Servlet
    implements the single-threaded model?
    Thanks,
    -Daniel

    btw one of the nice things about java is if you can't find the answer
    in the API or you are not sure what the API is saying you can always
    look at the source for the class your are looking at. the source files
    are in a file called src.zip or src.jar depending on the version.
    anyway just to make sure i understood i looked at the properties method
    in question.
    public String getProperty(String key) {
         Object oval = super.get(key);
         String sval = (oval instanceof String) ? (String)oval : null;
         return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval;
        public String getProperty(String key, String defaultValue) {
         String val = getProperty(key);
         return (val == null) ? defaultValue : val;

  • Conventions for XML-files

    Hi!
    I'm working on the text of a Bible translation that will be quite an extensive file when it's finished. The publisher has requested that I make an XML file in addition to the print-ready inDesign files they will use themselves. This is because there will be other publishers and companies that will want to use their translation (or parts of it) and it's inconvenient to send them inDesign files. An XML file with all of the paragraph styles, character styles and footnotes would be more convenient.
    Now, I've been trying to find information on how such a XML should look. Are there any code conventions for it? Most of the issues on this forum concerns importing xml files for use in indesign - but what I'm wondering is what I must think of when exporting XML files that other people will use?
    Also, is it possible to create inline xml tags based on character styles? (Such as bold, italic, suberscript etc.)
    I'm using CS6 and Mac OS X Lion.
    EDIT: Another thing just struck me. If anyone thinks that XML is not the best format for this then I'd very much like to hear about any other suggestions.

    InDesign has a native "Export XML" option, but that requires that you tag each separate item as an "XML item". Some of this can be automated, using "Map Styles to Tags". I don't have any experience with it, positive or negative, but if you exclusively used paragraph and character styles to layout your text it should be straightforward.
    Fastest way to get re-usable text in a not too difficult to parse file format is to export as Tagged Text. It's not really proper XML, but it may be Close Enough; if the above route is too complickated, try this (and send your publisher a test file).
    SimonLinden wrote:
    I've been trying to find information on how such a XML should look. Are there any code conventions for it? Most of the issues on this forum concerns importing xml files for use in indesign - but what I'm wondering is what I must think of when exporting XML files that other people will use?
    There are no "conventions". XML itself only has some very basic requirements (the way of writing element and attribute tags, correct nesting, some special characters that may not be used in plain text; that sort of things). So you can make up your own set of tags, or, to not confuse your receiving party, use a well-known set of tags such as XHTML (ie., <p> is for Paragraph, <i> is for Italic, and so on) or DocBook. There are also Scripture specific schema's of XML; http://ebible.org/usfx/ is one found with a quick Google.

  • Need to enable autoreload feature for servlet in Tomcat

    Hello
    I wants to enable autoreload feature for servlet in tomcat so that i need not to stop tomcat 4.0 web server again and again
    Thanks

    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html
    It is amazing what reading the manual might do for ya.

  • Could not find coding page for receiving system

    Hi,
    We have set up the configuration of RFC connections in SM59. We want to send an IDoc from a Unicode to a non-Unicode system. Message 'Could not find coding page for receiving system' appears. We activated some solutions described in OSS notes and added the required authorization to the communication user but it still doesn't work. What else can cause (solve) this problem?
    Regards, Jan

    Hello Jan,
    I had the following situation:
    After seup of an ALE/IDOC scenario with another SAP but Non unicode system sometimes the outbound PROJECT idocs failed with the error message "Could not find code page for receiving system". Status of Idoc was 02. When reprocessed some minutes later with report RBDAGAIN it worked.
    It turned out that for what'o'ever reason the connectivity was down for a very short time but long enough to get the Idocs failed.
    That's what I meant with the error text could be misleading.
    We solved this problem with a daily job with report RBDAGAIN for reprocessing.
    Regards
    Michael

Maybe you are looking for

  • Can we print header text in a tabular format...? urgent

    Hi, In the below program i need the text type payment history in a proper format.so plz help me regarding this. this a just a test program,you just execute this program.its running. i am feching the text payment history using the function module READ

  • Adobe Acrobat 9 Pro

    Hi, I am using Adobe Acrobat 9 Pro, and my friend is also using the same, but he has Adobe Reader installed as well?,why I do not know?,is it possible to have the both installed together?,just curious,thanks.

  • Oracle 11g - Error ORA-22275: invalid LOB locator specified

    Getting error during oBlob.freeTemporary() as clearBlobValues() throws Exception oracle.sql.BLOB oBlob = oset.getBLOB(i); oBlob.freeTemporary(); I googled this error and get some solution "Cause: There are several causes: (1) the LOB locator was neve

  • Shipment cost vi01

    Hi Gurus, As I had done shipment cost by vi01 and for every time i am getting the same message with pop up like.. three options: 1. log 2. save 3.cancle it is not transfered.....transfered type is   A   in place of C. PLEASE HELP ME OUT... THANKS RAH

  • Help! - N80 as a dial-up modem not through GPRS

    Does anybody know if it is possible to use the N80 to connect to a laptop for dial-up connection to my ISP. I'm talking about actually dialing a phone number to connect and not through GPRS (tethering). I already got tethering working, I'm just wonde