Search Results

Search found 720 results on 29 pages for 'conventions'.

Page 8/29 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Interface naming in Java

    - by Allain Lalonde
    Most OO languages prefix their interface names with a capital I, why does Java not do this? What was the rationale for not following this convention? To demonstrate what I mean, if I wanted to have a User interface and a User implementation I'd have two choices in Java: Class = User, Interface = UserInterface Class = UserImpl, Interface = User Where in most languages: Class = User, Interface = IUser Now, you might argue that you could always pick a most descriptive name for the user implementation and the problem goes away, but Java's pushing a POJO approach to things and most IOC containers use DynamicProxies extensively. These two things together mean that you'll have lots of interfaces with a single POJO implementation. So, I guess my question boils down to: "Is it worth following the broader Interface naming convention especially in light of where Java Frameworks seem to be heading?"

    Read the article

  • C# naming convention for extension methods for interface

    - by Sarah Vessels
    I typically name my C# interfaces as IThing. I'm creating an extension method class for IThing, but I don't know what to name it. On one hand, calling it ThingExtensions seems to imply it is an extension class to some Thing class instead of to the IThing interface. It also makes the extension class be sorted away from the interface it extends, when viewing files alphabetically. On the other hand, naming it IThingExtensions makes it look like it is an interface itself, instead of an extension class for an interface. What would you suggest?

    Read the article

  • Naming convention in Objective C /C , start with "_"?

    - by Tattat
    Something I see ppl define the variable like this: b2World *_world; b2Body *_body; CCSprite *_ball; instead of b2World *world; b2Body *body; CCSprite *ball; I familiar with the second one, but not the first one. So, I checked the Wikipedia about naming convention: Names beginning with double underscore or an underscore and a capital letter are reserved for implementation (compiler, standard library) and should not be used (e.g. __reserved or _Reserved). So, is that any special meaning which is start with "_"? The wiki page.

    Read the article

  • What is the advantage of the 'src/main/java'' convention?

    - by Chris
    I've noticed that a lot of projects have the following structure: Project-A bin lib src main java RootLevelPackageClass.java I currently use the following convention (as my projects are 100% java): Project-A bin lib src RootLevelPackageClass.java I'm not currently using Maven but am wondering if this is a Maven convention or not or if there is another reason. Can someone explain why the first version is so popular these days and if I should adopt this new convention or not? Chris

    Read the article

  • Name of several objects that have the same type

    - by Tomek Tarczynski
    Lets assume we have a class car. How would You name parameters of function that takes two different cars? void Race(Car first, Car second); or maybe void Race(Car car1, Car car2); The same situation with function that takes car and list of cars as a parameters. I'm used to name 'cars' for list of cars, so it is inconvenient to use names like: void Race(Car car, List<Car> cars); Any suggestions about names?

    Read the article

  • Can Fluent nhibernate's automapper be configured to handle private readonly backing fields?

    - by Mark Rogers
    I like private readonly backing fields because some objects are mostly read-only after creation, and for collections, which rarely need to be set wholesale (instead using collection methods to modify the collection). For example: public class BuildingType : DomainEntity { /* rest of class */ public IEnumerable<ActionType> ActionsGranted { get { return _actionsGranted; } } private readonly IList<ActionType> _actionsGranted = new List<ActionType>(); private readonly Image _buildingTile; public virtual Image BuildingTile { get { return _buildingTile; } } } But as far as I remember fluent-nhibernate's automapper never had a solution for private readonly backing fields, I'm wondering if that's changed in the last few months. So here's my question: How do I configure automapper or create an automapping convention to map private readonly backing fields?

    Read the article

  • When to throw exceptions?

    - by FRKT
    Exceptions are wonderful things, but I sometimes worry that I throw too many. Consider this example: Class User { public function User(user){ // Query database for user data if(!user) throw new ExistenceException('User not found'); } } I'd argue that it makes as much sense to simply return false (or set all user data to false in this case), rather than throwing an exception. Which do you prefer?

    Read the article

  • How many address fields would you use for a UK database?

    - by Draemon
    Address records are probably used in most database, but I've seen a number of slightly different sets of fields used to store them. The number of fields seems to vary from 3-7, and sometimes all fields are simple labelled address1..addressN, other times given specific meaning (town, city, etc). This is UK specific, though I'm open to comments about the rest of the world too. Here you need the first line of the address (actually just the number) and the post code to identify the address - everything else is mostly an added bonus. I'm currently favouring: Address 1 Address 2 Address 3 Town County Post Code We could add Country if we ever needed it (unlikely). What do you think? Is this too little, too much?

    Read the article

  • How to name an event handler of a private variable in Vb.Net following FxCop rules and Vb.Net standa

    - by SoMoS
    Hello, On one side, in Vb.Net when you add an event handler to an object the created method is named: <NameOfTheObject>_<NameOfTheMethod>. As I like to have consistent syntax I always follow this rule when creating event handlers by hand. On the other side when I create private variables I prefix them with m_ as this is a common thing used by the community, in C# people use to put _ at the beginning of a variable but this is no CLS compliant. At the end, when I create event handlers for events raised by private variables I end with Subs like m_myVariable_MyEvent. Code Analysis (Fx Cop) is complainig about this way of naming because the method does not start with uppercase and because the _, so the question is: What naming standards do you follow when creating event handlers by hand that follow the Fxcop rules if any? Thanks in advance.

    Read the article

  • code style for private methods in c#

    - by illdev
    I just found out, that it seems a common pattern to user UpperFirstLetterPascalCase() for private methods. I for myself, find this completely inconsistent with naming rules of private instance fields and variables and I find it difficult to read/debug, too. I would want to ask, why using a first upper letter for methods could be a better choice than a first lower (doThis())? Just out of curiosity...

    Read the article

  • Is there any benefit to declaring a private property with a getter and setter?

    - by AmoebaMan17
    I am reviewing another developer's code and he has written a lot of code for class level variables that is similar to the following: /// <summary> /// how often to check for messages /// </summary> private int CheckForMessagesMilliSeconds { get; set; } /// <summary> /// application path /// </summary> private string AppPath { get; set; } Doesn't coding this way add unnecessary overhead since the variable is private? Am I not considering a situation where this pattern of coding is required for private variables?

    Read the article

  • Primary key/foreign Key naming convention

    - by Jeremy
    In our dev group we have a raging debate regarding the naming convention for Primary and Foreign Keys. There's basically two schools of thought in our group: 1) Primary Table (Employee) Primary Key is called ID Foreign table (Event) Foreign key is called EmployeeID 2) Primary Table (Employee) Primary Key is called EmployeeID Foreign table (Event) Foreign key is called EmployeeID I prefer not to duplicate the name of the table in any of the columns (So I prefer option 1 above). Conceptually, it is consisted with a lot of the recommended practices in other languages, where you don't use the name of the object in its property names. I think that naming the foreign key EmployeeID (or Employee_ID might be better) tells the reader that it is the ID column of the Employee Table. Some others prefer option 2 where you name the primary key prefixed with the table name so that the column name is the same throughout the database. I see that point, but you now can not visually distinguish a primary key from a foreign key. Also, I think it's redundant to have the table name in the column name, because if you think of the table as an entity and a column as a property or attribute of that entity, you think of it as the ID attribute of the Employee, not the EmployeeID attribute of an employee. I don't go an ask my coworker what his PersonAge or PersonGender is. I ask him what his Age is. So like I said, it's a raging debate and we go on and on and on about it. I'm interested to get some new perspective.

    Read the article

  • Where to put files that will be read in a Rails app?

    - by Guilherme
    I'm developing a Rails application and within that application I developed a Rake task that will read entries from a file and store them into the DB. Producing the code was no problem, but I'd like to know, where do I place the file that is read? Is there a convention for that, if yes, what is it? I know I could have used the seed.rb file but is it ok, by the standards, to load and read a file from there? Thanks in advance!

    Read the article

  • Overwriting arguments object for a Javascript function

    - by Ian Storm Taylor
    If I have the following: // Clean input. $.each(arguments, function(index, value) { arguments[index] = value.replace(/[\W\s]+/g, '').toLowerCase(); }); Would that be a bad thing to do? I have no further use for the uncleaned arguments in the function, and it would be nice not to create a useless copy of arguments just to use them, but are there any negative effects to doing this? Ideally I would have done this, but I'm guessing this runs into problems since arguments isn't really an Array: arguments = $.map(arguments, function(value) { return value.replace(/[\W\s]+/g, '').toLowerCase(); }); Thanks for any input. EDIT: I've just realized that both of these are now inside their own functions, so the arguments object has changed. Any way to do this without creating an unnecessary variable?

    Read the article

  • In a web app, is it wise to give log files ".txt" suffix?

    - by Pekka
    I am building a logging mechanism in a web application. Being a Windows man, I tend to give files with textual content the .txt ending. The suffix is automatically registered to be opened in a text editor in any Windows environment, and is just a nice convention. The app is going to be redistributed, and running mostly on Linux, though. The Linux convention for log files is .log. Is there any good reason on the Linux end, besides convention, why I should use .log? Any filters, real-life applications that could become relevant and that will work only with a .log suffix? Or can I merrily call it error_log.txt?

    Read the article

  • What programming/techy name should I give my new pup? [closed]

    - by Nate
    I am getting a Border Collie puppy tomorrow. If I can get my wife to agree to do so I want to give it a techy/programming type of name. The vast majority of my development is in Microsoft .NET / C# on mobile devices (WinMo and tablets) as well as Silverlight and ASP.NET. I would like the name to be something in that area although I am open other technologies, etc. I have not seen him yet. I assume he is typical Border Collie colored - black/white. One name that crossed my mind is Xaml (pronounced Zammel). What other name ideas do you have?

    Read the article

  • typedef boost::shared_ptr<MyJob> Ptr; or #define Ptr boost::shared_ptr

    - by danio
    I've just started wrking on a new codebase where each class contains a shared_ptr typedef (similar to this) like: typedef boost::shared_ptr<MyClass> Ptr; Is the only purpose to save typing boost::shared_ptr? If that is the case why not do #define Ptr boost::shared_ptr in one common header? Then you can do: Ptr<MyClass> myClass(new MyClass); which is no more typing than MyClass::Ptr myClass(new MyClass); and saves the Ptr definition in each class.

    Read the article

  • Handling Data Hierarchies in code

    - by Miau
    Hi there So, say I have a string to parse with a given format that maps to a tree like data structure. The string is kinda similar to a folder path, and the structure is similar to a file structure, except its got some rules so for something@cat1@otherSomething you would get /something/cat1/otherSomething for something@cat2@otherSomething you would get /something/cat2/otherSomething other examples /OtherThing/cat1/otherSomething/Blah /OtherThing/cat4/otherSomething Where something, cat1, otherSomethign, etc are some sort of instances of ICategory There are certain rules that control what subcategories are valid and which subcategories are not acceptable, at the moment I m considering a heavy Object hierachy, but I know this is not a flexible solution, I d prefer the categories to be a bit more general but again, since there are rules about what can go next I m not sure how to do this. An example of a rule can be: OtherThing can only have subcategories cat1 and cat4 ( anything else is invalid) An option would be to use some sort of convention based aproach to instantiate a particular class given a subsection of the string(like cat4) but it seems a bit too complex, I m all ears Thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >