I sense a weakness in someone's editor/IDE. Personally I'd call it controller.js and expect my tools to not make that problemmatic
foo.service.js
foo.directive.js
would all be in different folders, one for controllers, one for services one for directives etc. if you have multiple tabs open in your ide like Webstorm you'd only see foo.js three times over, if you did not prefix it, and be hard pressed to know which is which at first glance.
With that said Angular 1 is dead long live Angular 2 :)
I hope "somebody" forks Angular 1. The 2 way binding (ng-model) makes CRUD apps very simple to write, even if digest/watch type operations are somewhat slow. As far as I can tell, the ng-model feature is OUT of Angular 2, and some kind of React style event communication must be set up instead.
I don't know React yet, but Angular 2 sounds like they are chasing the same design goals: be efficient at gluing huge mounds of similar crap to a never ending page (e.g. - a la Facebook). I am more interested in quickly grinding out code for huge CRUD forms with a large number of distinct fields.
Me neither.
> When almost every class has the same prefix. IE, when a user clicks on the button, a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController. The SmurfID is used to fetch a SmurfOrderHistory which is passed to the SmurfHistoryMatch before forwarding to either SmurfHistoryReviewView or SmurfHistoryReportingView. If a SmurfErrorEvent occurs it is logged by SmurfErrorLogger to ${app}/smurf/log/smurf/smurflog.log
https://github.com/johnpapa/angular-styleguide/blob/master/a...
My team uses Angular 1.4.7 for a very large project (hundreds of JS files, dozens of views/controllers/services). We have in our JS folder a services folder, controllers, directives, etc. No subfolders except in our directives folder which has some directives which are only applicable to a specific area of the application. Services by convention are just the name of the topic at hand, no "service" suffix (i.e. alert.js, user.js). We have had no issues as far as file navigation goes. I grant that convenience to our development environment. We run a primarily .NET stack and leverage Visual Studio 2015 so the "CTRL + comma" keyboard shortcut makes it very easy to work with these relatively large folders. My main point being I think the development environment plays a very large role in whether structure A or structure B will be more optimal for your team. If a CLI were going to be our means of navigation, this structure would be much more challenging to work with and I don't have a good suggestion for that circumstance.
Even for angular, it's a pretty nice workflow... I really don't care as much for angular as react. When the workflow is mostly the same, the quirkiness of angular (1 & 2) just stand out more imho.
That said, within the source directory for client side web files, we have the following:
* html/ - app pages (a small number of files) are within this directory.
-- html/help/ - sundry help pages put together by analysts are stored here.
* css/ - probably overkill, but the main css file is here, and, so far, an alternate "skin" for a subsystem of the app.
* js/ - empty in the source, but we do concatenate js files and place them in this spot in the final deployment package (.war file)
-- js/lib/ - 3rd party library scripts (e.g. - jQuery, Angular, moment, Ramda ...)
-- js/<<app name>>/ - in house scripts. There is a (short-ish) controller script for each page, and perhaps 6 to 10 shared utility scripts. The utility scripts tend to be somewhat long, rather than having hundreds of files, which really bothers me. E.g. - "tags.js" has the directives ("tag libraries", although there are a few custom attributes as well); rest.js is a wrapper around $http and some error / message handling code that does communication with the server.
I can't stand the directory structure, which I attribute to JEE historically, that has hundreds (thousands?) of files, and grossly redundant "MaryHartman/MaryHartman" / "Smurf" / "Bat" naming style (directory bat contains BatMobile.src; BatPhone.src; BatBelt.src; BatShit.src and so on)
Also, much of what is in the utility files are just single functions (within a namespace object), rather than classes. Currying goes a long way to inject dependencies into a chunk of code, rather than making a bunch of one-trick-pony (single action method) classes.
This is an odd statement to me. If you are in tech, do you count how many years you've been programming professionally?
I can't, and honestly I don't know if I'm programming professionally in my daily job.
/feature/subfeature/(constants|actions|reducers|api|controls)
This way features can be N layers deep, a given feature may not have all of those pieces, some may be data only, some may have actions that are called from other features... in the end, the data/controls etc are closer to the feature that binds them. Api is to abstract any foreign system integration (api calls), where actions (action creators) may use it, and the reducers manage the result... Redux workflow, variance on structure.Tends to work pretty well that way. Actions/reducers may listen/dispatch those defined under other features... again, it's the shape of the data and application that defines these features and their structure.